From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94828C4363D for ; Wed, 30 Sep 2020 23:22:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 53F552076A for ; Wed, 30 Sep 2020 23:22:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="TZcivgXw" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732191AbgI3XVY (ORCPT ); Wed, 30 Sep 2020 19:21:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731255AbgI3XVX (ORCPT ); Wed, 30 Sep 2020 19:21:23 -0400 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72865C0613D0 for ; Wed, 30 Sep 2020 16:21:23 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id s31so2292616pga.7 for ; Wed, 30 Sep 2020 16:21:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=x63BBbB7KwIQqJxUqTsIaDJvuWLQtOEVBES32Yy+YAo=; b=TZcivgXw3I1epH9uT9vdPCWx/4ExuFu3+g4x3a/AhrJ47vzwURw8KdgwcFvZLA4x6R N43c1jc09gyZaUIARtJRdVpNBz8HLiKvE3J/YzFFtLaGuQ5vdTXiZAYuWGd1EBHOC14M xS08nPZAgFW9Y6dbf3e9FfTYtNlPH/Srf7U4I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=x63BBbB7KwIQqJxUqTsIaDJvuWLQtOEVBES32Yy+YAo=; b=ixG9/WJJE/0FDYsefWxH9RI+SDwJzpkysv1EAw7f8iEr/IB7olO4kUJlWtdFHEYbMF 3MxBxMXmCbL9QT8Ga8u2brQKnsaKeB/CVgx3MwDzdnnjvh0P+8TLnJZr25zL6qhJS4E4 9/TGLvWaJxoB3ARrDTRvl8QoZE1GNZRPKKj3v/gIpcEHmbyL6A7ixQPBkaTwaJ1o0RfU dHxIk9PxKkCVipD0BgdqLt9hag0uLI7ZXRWr+OEPG0wZVNckU1uJ/8ebw4wjLjHy58on LKDgn+eFHGhHd4uvRpsbhN8vOFwIKqb2EfDGfs33EJ1kZ+UV1OwCM4ad0yUdRkBdpv78 Z66g== X-Gm-Message-State: AOAM533E/MbpZ7b1q2Vxehy4WprIyf1Oo1A1HwyjuYM0b5+JJMBGDhWQ bdKw1yqTWyq2E8gLvoaOYbS7DA== X-Google-Smtp-Source: ABdhPJxuU0x2CWFLEU2A+WDs32aP0TdSrFtCY2CLnbAl54vDjrmQMaeG/VBOLgLEbehuqlqMS0xYoQ== X-Received: by 2002:a17:902:7002:b029:d2:950a:d82a with SMTP id y2-20020a1709027002b02900d2950ad82amr4444416plk.72.1601508082978; Wed, 30 Sep 2020 16:21:22 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id 206sm3071721pgh.26.2020.09.30.16.21.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Sep 2020 16:21:22 -0700 (PDT) Date: Wed, 30 Sep 2020 16:21:21 -0700 From: Kees Cook To: Jann Horn Cc: YiFei Zhu , Linux Containers , YiFei Zhu , bpf , kernel list , Aleksa Sarai , Andrea Arcangeli , Andy Lutomirski , David Laight , Dimitrios Skarlatos , Giuseppe Scrivano , Hubertus Franke , Jack Chen , Josep Torrellas , Tianyin Xu , Tobin Feldman-Fitzthum , Tycho Andersen , Valentin Rothberg , Will Drewry , Thomas Gleixner , Ingo Molnar , Borislav Petkov , the arch/x86 maintainers Subject: Re: [PATCH v3 seccomp 5/5] seccomp/cache: Report cache data through /proc/pid/seccomp_cache Message-ID: <202009301612.E9DD7361@keescook> References: <202009301554.590642EBE@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 01, 2020 at 01:08:04AM +0200, Jann Horn wrote: > [adding x86 folks to enhance bikeshedding] > > On Thu, Oct 1, 2020 at 12:59 AM Kees Cook wrote: > > On Wed, Sep 30, 2020 at 10:19:16AM -0500, YiFei Zhu wrote: > > > From: YiFei Zhu > > > > > > Currently the kernel does not provide an infrastructure to translate > > > architecture numbers to a human-readable name. Translating syscall > > > numbers to syscall names is possible through FTRACE_SYSCALL > > > infrastructure but it does not provide support for compat syscalls. > > > > > > This will create a file for each PID as /proc/pid/seccomp_cache. > > > The file will be empty when no seccomp filters are loaded, or be > > > in the format of: > > > > > > where ALLOW means the cache is guaranteed to allow the syscall, > > > and filter means the cache will pass the syscall to the BPF filter. > > > > > > For the docker default profile on x86_64 it looks like: > > > x86_64 0 ALLOW > > > x86_64 1 ALLOW > > > x86_64 2 ALLOW > > > x86_64 3 ALLOW > > > [...] > > > x86_64 132 ALLOW > > > x86_64 133 ALLOW > > > x86_64 134 FILTER > > > x86_64 135 FILTER > > > x86_64 136 FILTER > > > x86_64 137 ALLOW > > > x86_64 138 ALLOW > > > x86_64 139 FILTER > > > x86_64 140 ALLOW > > > x86_64 141 ALLOW > [...] > > > diff --git a/arch/x86/include/asm/seccomp.h b/arch/x86/include/asm/seccomp.h > > > index 7b3a58271656..33ccc074be7a 100644 > > > --- a/arch/x86/include/asm/seccomp.h > > > +++ b/arch/x86/include/asm/seccomp.h > > > @@ -19,13 +19,16 @@ > > > #ifdef CONFIG_X86_64 > > > # define SECCOMP_ARCH_DEFAULT AUDIT_ARCH_X86_64 > > > # define SECCOMP_ARCH_DEFAULT_NR NR_syscalls > > > +# define SECCOMP_ARCH_DEFAULT_NAME "x86_64" > > > # ifdef CONFIG_COMPAT > > > # define SECCOMP_ARCH_COMPAT AUDIT_ARCH_I386 > > > # define SECCOMP_ARCH_COMPAT_NR IA32_NR_syscalls > > > +# define SECCOMP_ARCH_COMPAT_NAME "x86_32" > > > > I think this should be "ia32"? Is there a good definitive guide on this > > naming convention? > > "man 2 syscall" calls them "x86-64" and "i386". The syscall table > files use ABI names "i386" and "64". The syscall stub prefixes use > "x64" and "ia32". > > I don't think we have a good consistent naming strategy here. :P Agreed. And with "i386" being so hopelessly inaccurate, I prefer "ia32" ... *shrug* I would hope we don't have to be super-pedantic and call them "x86-64" and "IA-32". :P -- Kees Cook