From patchwork Tue Jul 22 01:49:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Lutomirski X-Patchwork-Id: 4598981 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DD7B19F375 for ; Tue, 22 Jul 2014 01:52:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CACBB2013D for ; Tue, 22 Jul 2014 01:52:18 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D78C320117 for ; Tue, 22 Jul 2014 01:52:17 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X9PDt-0003nH-0F; Tue, 22 Jul 2014 01:50:33 +0000 Received: from mail-pd0-f181.google.com ([209.85.192.181]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X9PDV-0002Sh-0S for linux-arm-kernel@lists.infradead.org; Tue, 22 Jul 2014 01:50:09 +0000 Received: by mail-pd0-f181.google.com with SMTP id g10so8749429pdj.12 for ; Mon, 21 Jul 2014 18:49:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=sqawMfiK1To/ZSD72ook3pV9OW9w8NdRhlta7YjsL1I=; b=FzyS2ZcqR5sO17eoYyysxRHHpr4mAZcR/VYw4DTjpoSPJhKrgnz4SEwdI+HnGeZLNZ pP1ifKRsFgnCMJR9Kqk6/9jbb5BlhqftuxgVSOV7rvtxCtpqPdWLJKzggggsLL/hMORl +YfD3vIFJsKYMoR5PunH2gHSDZnps5c/2lYqphEkyM/oVqZFw/wg3IvIQDWiu0C6+AHO TcxZ9xOk42H2Yt/u+Bd+lOD2/YCkRw0VOlBDFkTLFHm3GWbjJ8rCVXjTT6jMY3/h/WRE c1V2/6BF0ONhbHcQ3PmwqEDLhN4kia5zPURCTt2HeAHxk+KFqPYDKGmDsmH3Q3Saelxp 4itg== X-Gm-Message-State: ALoCoQn3PqVdG8+SN6t5fWhrKUN7yhkvIhNVFeLzJ3IyD+PZUXuf7z5ZPiF7ZJJSKSGv4b1QdxCE X-Received: by 10.68.114.65 with SMTP id je1mr12554620pbb.124.1405993788116; Mon, 21 Jul 2014 18:49:48 -0700 (PDT) Received: from localhost ([2600:1010:b01b:59a8:9138:8dc8:286b:79c0]) by mx.google.com with ESMTPSA id p5sm2853612pdg.35.2014.07.21.18.49.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Jul 2014 18:49:47 -0700 (PDT) From: Andy Lutomirski To: linux-kernel@vger.kernel.org, Kees Cook , Will Drewry Subject: [PATCH v3 4/8] seccomp: Document two-phase seccomp and arch-provided seccomp_data Date: Mon, 21 Jul 2014 18:49:17 -0700 Message-Id: <7dc27063cc38b4b5a0d800ee16c1aa2a89953533.1405992946.git.luto@amacapital.net> X-Mailer: git-send-email 1.9.3 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140721_185009_110060_8F09AA73 X-CRM114-Status: GOOD ( 10.84 ) X-Spam-Score: -0.7 (/) Cc: linux-arch@vger.kernel.org, linux-mips@linux-mips.org, x86@kernel.org, Oleg Nesterov , Andy Lutomirski , linux-security-module@vger.kernel.org, hpa@zytor.com, linux-arm-kernel@lists.infradead.org, Alexei Starovoitov X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The description of how archs should implement seccomp filters was still strictly correct, but it failed to describe the newly available optimizations. Signed-off-by: Andy Lutomirski --- arch/Kconfig | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/Kconfig b/arch/Kconfig index 0eae9df..05d7a8a 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -323,6 +323,17 @@ config HAVE_ARCH_SECCOMP_FILTER results in the system call being skipped immediately. - seccomp syscall wired up + For best performance, an arch should use seccomp_phase1 and + seccomp_phase2 directly. It should call seccomp_phase1 for all + syscalls if TIF_SECCOMP is set, but seccomp_phase1 does not + need to be called from a ptrace-safe context. It must then + call seccomp_phase2 if seccomp_phase1 returns anything other + than SECCOMP_PHASE1_OK or SECCOMP_PHASE1_SKIP. + + As an additional optimization, an arch may provide seccomp_data + directly to seccomp_phase1; this avoids multiple calls + to the syscall_xyz helpers for every syscall. + config SECCOMP_FILTER def_bool y depends on HAVE_ARCH_SECCOMP_FILTER && SECCOMP && NET