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=-11.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL 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 9DC30C4346E for ; Fri, 25 Sep 2020 00:25:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 524602396D for ; Fri, 25 Sep 2020 00:25:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="f9l5Zd3/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726730AbgIYAZM (ORCPT ); Thu, 24 Sep 2020 20:25:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726448AbgIYAZM (ORCPT ); Thu, 24 Sep 2020 20:25:12 -0400 Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D45FCC0613CE for ; Thu, 24 Sep 2020 17:25:11 -0700 (PDT) Received: by mail-ed1-x543.google.com with SMTP id ay8so703931edb.8 for ; Thu, 24 Sep 2020 17:25:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Mb/Gyht1d42k5WLRRBLSKrU8LIj1ziyutaDcZAUiiDE=; b=f9l5Zd3/T/siD3esxvK9V7YnPdrOPwx1tq742hlnDqkxlWrK/d7wadfgenOzWaholI EGlI6+dTP7IK4eZMyXFvN1jy4A1imuSMp+jrckKEPcgsAaYu5gsSQMyHqqwQWJF0sDU1 5xzCMwIddufxjAl9RoRLXKtXbm0VEXIvz+CyefndRGPpKrVrNRrKyvmhCstvSG054h75 /w7FRLohxgg+mkAxbgF06fH0/b5lpv0lS7KnVnWwZp6JamH8ekmXkyRaA0ONHW7gNWSj /xKm2wzh4qshXB/KxxZX2DfEOV9720E9nsisCdV28VmRKFCNLHI2UDRDSoq28tGoscpp 75SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Mb/Gyht1d42k5WLRRBLSKrU8LIj1ziyutaDcZAUiiDE=; b=mUQDV1842At9qy9+iE9k3vctqOhR0e0rtH0bFUqwJzuohDgoQW0Cv1C6nc3JMMcRvU BXI7/m3I92ychVI32LTQOcjQoBEGge/HTZntgGsgeV5Z6DmXvo++rED7gsjmdl2zOFl0 6wMj1bajb/xbwtYnMiWtqlOiXEOi+BBL9yxorTqVZzh2O0WANv0N1CoIZY4TR61bJQt5 nejoogVb55IOj9KZxt2tcByJ66rykba7y5rYs7nbyi5P69NLjWAHDKAqss9WHs76pdpa T0cj6ifM2HEPlgtuDUot5g9Qk1Do1ylZ12uvmXKpfZWQ3gSpSgoPwuYYyyfmTHhq9lJt Djag== X-Gm-Message-State: AOAM533VextRaUOCw7cywNoSR4npUlmBtGZBITjwZfDFs3FwjnqPIcPn s/LhW9wR3MhDwnnFbVpBLENOYAKkGNBTKSkGUlncXw== X-Google-Smtp-Source: ABdhPJyXMnD+DwkHGMzEgLFLrUX3vRxmEK0cIvo8M77oLrJDknVzbQ95k1e4VVTE9KNNBZHJjBqthcj+pzQZ1DxtQHI= X-Received: by 2002:a50:ccd2:: with SMTP id b18mr1328552edj.51.1600993510229; Thu, 24 Sep 2020 17:25:10 -0700 (PDT) MIME-Version: 1.0 References: <202009241658.A062D6AE@keescook> <20200925001803.GV3421308@ZenIV.linux.org.uk> In-Reply-To: <20200925001803.GV3421308@ZenIV.linux.org.uk> From: Jann Horn Date: Fri, 25 Sep 2020 02:24:43 +0200 Message-ID: Subject: Re: [PATCH v2 seccomp 2/6] asm/syscall.h: Add syscall_arches[] array To: Al Viro Cc: Kees Cook , YiFei Zhu , YiFei Zhu , Linux Containers , bpf , kernel list , Aleksa Sarai , Andrea Arcangeli , Andy Lutomirski , Dimitrios Skarlatos , Giuseppe Scrivano , Hubertus Franke , Jack Chen , Josep Torrellas , Tianyin Xu , Tobin Feldman-Fitzthum , Tycho Andersen , Valentin Rothberg , Will Drewry Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Fri, Sep 25, 2020 at 2:18 AM Al Viro wrote: > On Fri, Sep 25, 2020 at 02:15:50AM +0200, Jann Horn wrote: > > On Fri, Sep 25, 2020 at 2:01 AM Kees Cook wrote: > > > 2) seccomp needs to handle "multiplexed" tables like x86_x32 (distros > > > haven't removed CONFIG_X86_X32 widely yet, so it is a reality that > > > it must be dealt with), which means seccomp's idea of the arch > > > "number" can't be the same as the AUDIT_ARCH. > > > > Sure, distros ship it; but basically nobody uses it, it doesn't have > > to be fast. As long as we don't *break* it, everything's fine. And if > > we ignore the existence of X32 in the fastpath, that'll just mean that > > syscalls with the X32 marker bit always hit the seccomp slowpath > > (because it'll look like the syscall number is out-of-bounds ) - no > > problem. > > You do realize that X32 is amd64 counterpart of mips n32, right? And that's > not "basically nobody uses it"... What makes X32 weird for seccomp is that it has the syscall tables for X86-64 and X32 mushed together, using the single architecture identifier AUDIT_ARCH_X86_64. I believe that's what Kees referred to by "multiplexed tables". As far as I can tell, MIPS is more well-behaved there and uses the separate architecture identifiers AUDIT_ARCH_MIPS|__AUDIT_ARCH_64BIT and AUDIT_ARCH_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_CONVENTION_MIPS64_N32. (But no, I did not actually realize that that's what N32 is. Thanks for the explanation, I was wondering why MIPS was the only architecture with three architecture identifiers...)