Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp814393pxk; Wed, 23 Sep 2020 17:39:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJ2u0Fwt8E4sJuN1UmYm8PPmo+UJj9EO/2oy3coYh6n0f4L8nlXKd1uMLMU+gpmbV4tbI8 X-Received: by 2002:a17:906:6409:: with SMTP id d9mr2122000ejm.344.1600907945847; Wed, 23 Sep 2020 17:39:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600907945; cv=none; d=google.com; s=arc-20160816; b=BTn1WuBTTja2ZJ8NhXYDhk+80DqNfiuBkbqNMSfZoeT3oaVeBaVqRbsyOdXH9wvZm6 42BQW98ZRFffLjJ9R9oG2VIDU5WVQ/90uaCd+W1vdk5U9NIuNyc9mSD7ZgDsj9TRNWbK dsLq20WNprkYqgk7TfjnxCL6GDPH8teBAVQjFw8EkqX6Y4LbcBMSjAOYTXk3Fql1qjhf tCqLwl1Jhgxguizsfsy//crlWKX+9c6/L14+yPYT+7WFFNrYSCa15/7Y00l+Cnbh+/rc vB0NpON52Q75t62w6JkDhoOjiqWX7fOCuyzCddrpq9YXF7XKmfz1MB/ULNowing8IFnB ISZQ== 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=dDFv/RhyMEgSIdYNNun/DQyCy7wkiVHBQ14Pm7oiRaY=; b=vbvEd2kPCgPlP6Y2fxSbdOOXOXF1dxoWPCLl8gPr8JJqs1vH3l67z/ncokJfQ5uXgM B2W3K7ghrb3ynEmb7W5+VCUv/Zoh6Re8rL71xw0w2e47hPIIsEyAXd4vIVSAqO/t3r+u yvhRDUzEQyYc0qO0T3KKO4KXuYp7Ha2XJzI58TJCFegaeLNHWeZs+obeYuo15MnJ9yaN yBD4FcwQC2AYo05S0cLyLrMMi8bjwJP4ynl2u17YiYYxQrSHLsC3JEX8d0sC044PpmWl iHcs12Yaga3YozWfldomonnAKTOUwv92G4C8gPxy2vUJp+y8QMr+mc7hL4lY6EOOL5nP gYbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=S+45JSXz; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p15si963883ejm.293.2020.09.23.17.38.42; Wed, 23 Sep 2020 17:39:05 -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=@gmail.com header.s=20161025 header.b=S+45JSXz; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726798AbgIXAg7 (ORCPT + 99 others); Wed, 23 Sep 2020 20:36:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726775AbgIXAg7 (ORCPT ); Wed, 23 Sep 2020 20:36:59 -0400 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80D65C0613CE; Wed, 23 Sep 2020 17:36:59 -0700 (PDT) Received: by mail-pj1-x1043.google.com with SMTP id kk9so632137pjb.2; Wed, 23 Sep 2020 17:36:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=dDFv/RhyMEgSIdYNNun/DQyCy7wkiVHBQ14Pm7oiRaY=; b=S+45JSXzgkr09sRCcCdhdTWZqKjGiqaOTVPh6x4Hr3IKq7yQGY+AZH+183mxSCLvjf 2wRiljZuy+jzjhGx4hWUxnqPHkZSewMIC4SsfqC7sYaruiXEAYfAz0dUFhu/LdBzxnSc T/iryvQXvuvaXswywD1clzhRhQfWhW1MViaAwsLawhN5ieaIH6OPi+WcbeNL4aBPmXiP IVU24kMSqalWd6B+dv+TIWsi49MBYZ37xmHIgUmCrtpfjvOHVPm0V4BOjrEe9R+/Xg35 LHOtkejtneIjgUaU/n2/kZeHlVMc7Olyns38MZQUuio2vVwhMNsgaSAGXF2IFjL2Nxes I68g== 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=dDFv/RhyMEgSIdYNNun/DQyCy7wkiVHBQ14Pm7oiRaY=; b=A84O3SBhwMamp41MvRAt2WVCBeKGEbguu12+TwdUjSVR0taq7Nzhb2Uh0WP3pmmzQB 9VnwTDm1Vc0cyJTgOsjc7NRZHpU4WmOoByhfEaUH/gPMbtmI6wxGvzExfTqmfHM+AMeN ARB9UeLnFjygbV0H5PuVBz6EUDSrS08o2FO1cuKdqyv3Hp6t2rSZtE0TMnYjAl9E9B+F xpv4mzXnFxUS9mQbN/m7JGcrMO5Jy0OGo80bTYyGRYfM7cAdgoWyBo58dIgEPC3JL4NE daQ+pygxmbt6TLbvu8mqIjfiVi/E8nilC6dwU2ouGuczXRdzBlPbXyCkxKFnqjpokTVn na2A== X-Gm-Message-State: AOAM533Q992lPM2jW4rg0s5vmHROG4B71t/QtmxMh9pJykIC/nKt6L+Q Wm1g//T3F2jvt8cKoStB7NYKkul8TawO+8En3/8= X-Received: by 2002:a17:902:7445:b029:d1:dea3:a3ca with SMTP id e5-20020a1709027445b02900d1dea3a3camr2137109plt.19.1600907819053; Wed, 23 Sep 2020 17:36:59 -0700 (PDT) MIME-Version: 1.0 References: <20200923232923.3142503-1-keescook@chromium.org> <20200923232923.3142503-4-keescook@chromium.org> In-Reply-To: From: YiFei Zhu Date: Wed, 23 Sep 2020 19:36:47 -0500 Message-ID: Subject: Re: [PATCH 3/6] seccomp: Implement constant action bitmaps To: Kees Cook Cc: Jann Horn , Christian Brauner , Tycho Andersen , Andy Lutomirski , Will Drewry , Andrea Arcangeli , Giuseppe Scrivano , Tobin Feldman-Fitzthum , Dimitrios Skarlatos , Valentin Rothberg , Hubertus Franke , bpf , Linux Containers , linux-api@vger.kernel.org, kernel list , Jack Chen , Josep Torrellas , Tianyin Xu , YiFei Zhu Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 23, 2020 at 6:29 PM Kees Cook wrote: > In order to optimize these cases from O(n) to O(1), seccomp can > use bitmaps to immediately determine the desired action. A critical > observation in the prior paragraph bears repeating: the common case for > syscall tests do not check arguments. For any given filter, there is a > constant mapping from the combination of architecture and syscall to the > seccomp action result. (For kernels/architectures without CONFIG_COMPAT, > there is a single architecture.). As such, it is possible to construct > a mapping of arch/syscall to action, which can be updated as new filters > are attached to a process. Would you mind educating me how this patch plan one handling MIPS? For one kernel they seem to have up to three arch numbers per build, AUDIT_ARCH_MIPS{,64,64N32}. Though ARCH_TRACE_IGNORE_COMPAT_SYSCALLS does not seem to be defined for MIPS so I'm assuming the syscall numbers are the same, but I think it is possible some client uses that arch number to pose different constraints for different processes, so it would better not accelerate them rather than break them. YiFei Zhu