Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2255966ybt; Tue, 16 Jun 2020 00:52:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBAz4vXZ0hrqoToNbiVvlK4w1Bwaa4xqjq2AHS2RFYal+2U6QrIWBEcHO1h17VtDw4A17b X-Received: by 2002:a17:906:7e19:: with SMTP id e25mr1527348ejr.319.1592293962762; Tue, 16 Jun 2020 00:52:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592293962; cv=none; d=google.com; s=arc-20160816; b=LnWfzYxKbAxhdek/yTTHP8NYixG8aT11zwe6DjB5587ENr61LVGWuhfDURxsnxU2GZ waw9fT4+a1NMyuLyjx5m3xUdkkMjoNlsOcdgbtEn4mues49qQ92FKAdY4mE2+1k3O8Gs 48Ve6Nh0aATo9r2efGnQAd0xrdKrO/bHIfPCo4TsDSnLzukfLA2m7NGHHVw0fzVNsO/V 6LaFqOdnVcwOwRkVAcyj+u9fTb/WJ38ZvlQhcPpOyDUBwRRu/fBSa6IhrWDQi3B+uQZ1 KpE4+sPAKxVyfensv46GObAajDNpn3wXNp3/AXaEut21eJ5uMJ4YxigGJXv8qDUbMZ+M 0TYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LpGj0LlWhL2sX6NdVIScVPST1vvxv4HP5Xz6PQqXsUs=; b=h8mTgH1SAUs+YTd5DSOrV8kDdFE8tvqs5YR/Doliq32WZet8Ys6gW+5IGagz2dq6/B 24ZS6oQVF91cf0susNUyMDAowPBbVoYRD9cWi9rJi+viklfFD4cQSG0N4Il8FvcN2RIN cEbPfabqEl2cCvzLW0rDJYWxVMm0kxT+yxm2044Jq29wr91yBFmhfcGIDczQUhIhoN0p 499O77d/2DAtnFf87a2MkwZXesnl1v31IjImv2mKxYgkfz7WRI6mCj2dAVzPqyBFLWFs dxIrDzezwC/KRJpl+adPX0f5v8pyndCXKtAgmV/hq64uaWqThT5myoFCpP6wCwLVyXr7 m+Fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="mBMsu/H3"; 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=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a22si10784777ejx.579.2020.06.16.00.52.20; Tue, 16 Jun 2020 00:52:42 -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=@chromium.org header.s=google header.b="mBMsu/H3"; 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=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727097AbgFPHuK (ORCPT + 99 others); Tue, 16 Jun 2020 03:50:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726965AbgFPHt6 (ORCPT ); Tue, 16 Jun 2020 03:49:58 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACB77C08C5C2 for ; Tue, 16 Jun 2020 00:49:48 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id a127so9089960pfa.12 for ; Tue, 16 Jun 2020 00:49:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LpGj0LlWhL2sX6NdVIScVPST1vvxv4HP5Xz6PQqXsUs=; b=mBMsu/H37l5/82lF78S3TFrEkOg5oaDeSPvONr2tsAmEU8cRaPFfhq+CvSo+fcCXID IaaYZg3VqQimghB/9or2O9e8aLGitYBJVNAhSN6fjjNL8HkLB1nz+Zgd5nThB33PKaA+ TdE8nGpBIfY9arDLD7VJCBRTPkHDuKf0fytoA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LpGj0LlWhL2sX6NdVIScVPST1vvxv4HP5Xz6PQqXsUs=; b=tlmGc0wVmSWcSB5WLvgsLMKjgh2djbUf7H8ciyzZ/SuREMcSUPww5b+oKMj/NkG2RO V0nrgjSgQeYXSzc4IYYrmOz1B31XVrGbhwY9sZX1vX2TlqhzdQimUzzQcf2aY/a3oVY3 ONd5V/jWapSCN2rq7aA4An4bhdYHcEh09g6bTzG+/btEx3M/E8PWR1rml9UDi+FW9nPr NsZ0ntE6uu1EW96YYDvKd8e394iKLfRpJqK0/Blbq7Vus98q4IcUVwpB7WmqNUtCFGll vM667YG4QIGuKre2xajOxfzGFzegmLv1BgHo0wpIj4zirS4ApRINn+pOt25f2KHfZJH6 CfIw== X-Gm-Message-State: AOAM533E8Oqw8jFAmJ91wPx2FeaxVLXPOb2l6+nQ7zEmuRGGxbA27rTP 5rSqD5M2MYMpdq3CM9cW2z/VBQ== X-Received: by 2002:a62:1bc5:: with SMTP id b188mr970686pfb.119.1592293788235; Tue, 16 Jun 2020 00:49:48 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id l23sm13485938pgc.55.2020.06.16.00.49.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jun 2020 00:49:46 -0700 (PDT) From: Kees Cook To: linux-kernel@vger.kernel.org Cc: Kees Cook , Christian Brauner , Sargun Dhillon , Tycho Andersen , Jann Horn , "zhujianwei (C)" , Dave Hansen , Matthew Wilcox , Andy Lutomirski , Will Drewry , Shuah Khan , Matt Denton , Chris Palmer , Jeffrey Vander Stoep , Aleksa Sarai , Hehuazhen , x86@kernel.org, Linux Containers , linux-security-module@vger.kernel.org, linux-api@vger.kernel.org Subject: [PATCH 7/8] x86: Enable seccomp constant action bitmaps Date: Tue, 16 Jun 2020 00:49:33 -0700 Message-Id: <20200616074934.1600036-8-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200616074934.1600036-1-keescook@chromium.org> References: <20200616074934.1600036-1-keescook@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that CPU-local kernel TLB flushes are available to seccomp, define the specific architectures seccomp should be expected to reason about, so that constant action bitmaps can be enabled for x86. TODO: handle x32 via a "synthetic architecture" check, like done in syscall entry. Signed-off-by: Kees Cook --- arch/x86/Kconfig | 1 + arch/x86/include/asm/syscall.h | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 6a0cc524882d..0f7a0abab88f 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -149,6 +149,7 @@ config X86 select HAVE_ARCH_COMPAT_MMAP_BASES if MMU && COMPAT select HAVE_ARCH_PREL32_RELOCATIONS select HAVE_ARCH_SECCOMP_FILTER + select HAVE_ARCH_SECCOMP_BITMAP if !X86_X32 select HAVE_ARCH_THREAD_STRUCT_WHITELIST select HAVE_ARCH_STACKLEAK select HAVE_ARCH_TRACEHOOK diff --git a/arch/x86/include/asm/syscall.h b/arch/x86/include/asm/syscall.h index 7cbf733d11af..b89e86f4c061 100644 --- a/arch/x86/include/asm/syscall.h +++ b/arch/x86/include/asm/syscall.h @@ -97,6 +97,7 @@ static inline void syscall_set_arguments(struct task_struct *task, memcpy(®s->bx + i, args, n * sizeof(args[0])); } +#define SECCOMP_ARCH AUDIT_ARCH_I386 static inline int syscall_get_arch(struct task_struct *task) { return AUDIT_ARCH_I386; @@ -152,6 +153,10 @@ static inline void syscall_set_arguments(struct task_struct *task, } } +#define SECCOMP_ARCH AUDIT_ARCH_X86_64 +#ifdef CONFIG_COMPAT +#define SECCOMP_ARCH_COMPAT AUDIT_ARCH_I386 +#endif static inline int syscall_get_arch(struct task_struct *task) { /* x32 tasks should be considered AUDIT_ARCH_X86_64. */ -- 2.25.1