Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp723700pxk; Thu, 24 Sep 2020 17:29:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlEZJ3U9KlIB1xliw5pG3Ez9QKWu28uHjf6ixFwOv4qgEER3AwpwICMXZ8VIFv7xHt/iYW X-Received: by 2002:a50:abc3:: with SMTP id u61mr1299158edc.129.1600993796512; Thu, 24 Sep 2020 17:29:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600993796; cv=none; d=google.com; s=arc-20160816; b=wwWeKtRXVa5zFwRTsP7KBNAncBXogfgPd0b9FemXPi8FTYCI6pJVyupWCOrCvbpbaN kdEPRQWHAPtiCJqdF/tjf6+U4+xrfbHWtYqPBh0vzyD1IxvMgZPSUIg8OD44/HDLZlcT 6i53vme/0KrJtZ/90QeXSeyleLagQH84DAF2K6etV+r/bzLN2HWci97Ex7/wcqi6naXy YRZmAQA+eUj0JwZFqmdi88xvlhpd2FxVqGHEHe1D3NnguQSHx5Fn6Ubq3+lO99/11XLX PVXY3400bYWocTLm32ULenW71ukAHYIh/pbT2/GD4UBhaWeQqL9Z8zkFmBBEEqyjoq2k o5xQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Mb/Gyht1d42k5WLRRBLSKrU8LIj1ziyutaDcZAUiiDE=; b=lsgbocKez9b0O1xOoq5+gehQCy6dMeZF2ZxSZryTNMjKeswwprdFzJuWkg48Imf//j U+Z2elACn+OMA5shAZYCB4PEzibHlDGPBLW6LppSqQWlJwmxBsHIqsieuTFLC+4Xao8w xZzXcOB4MNAFcyDMjAAK3uh5TCyNRtMXcmcVMcEHbPWolg1cordEYpCPpnW0LckmK0se LJW24PhEKA3c8I7GW2YaYZ3CEFAnxCpr1iBEhGE1Kzfcr3b3nv8HWEVL8JzoQQVvQTPH w/MqipOf6WPUTfeaGX78mk7Y+QhuwnIb9/BOVUh8hzs69J8SrvGPcObK50IqWjmowIem pz2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="f9l5Zd3/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c10si718235edw.68.2020.09.24.17.29.33; Thu, 24 Sep 2020 17:29:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="f9l5Zd3/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726821AbgIYAZM (ORCPT + 99 others); Thu, 24 Sep 2020 20:25:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726704AbgIYAZM (ORCPT ); Thu, 24 Sep 2020 20:25:12 -0400 Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01D60C0613D3 for ; Thu, 24 Sep 2020 17:25:11 -0700 (PDT) Received: by mail-ed1-x544.google.com with SMTP id n13so694138edo.10 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=SG1z0prCSUup8BenKoLP7J+ubqPrc42VK2tUuP3db5IXeFDU+mm3Zx/pvrx0svytkP hCKmYDMoN3P8k0yAf74xl6XeHb2tsbqODZS7/HjibSh74GOM7nDXVsEAaGQj0BxYf6bU Sw715pELtEsqH7b71ZrDDR+RFREJlurfSnA+lpgYDaAqBuB+b9o9ikMyS16oe+E5d6PS 487cNmIIt63+Ql4aacVporkPjx96E7r5MHKb6v6P+llBhtXPzTm56ezHPW2DDlp75OEe jL54hq7HTHxN9Rq2BW5BQVEubYSuAPfE0UFsanOHvAIXncXiRoUYlxzYfCpyP5Puytle 3Dow== X-Gm-Message-State: AOAM533JG5jwdhuXaWBHIrb+IpgIcVpqZr9DnqAn9M3fSy7ggNwrGwrS 0tcjstSOSPUe/aSzAslrS0gLmdOWAMo4bBhjgVL9vA== 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: linux-kernel@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...)