Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2274384pxb; Fri, 5 Feb 2021 13:29:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJwfaXEYpzNuHU01O9y9+VbgAmrL/vsUMzCFY0/dD8Er52TZA2BmrsjQydATN/VoiC0UiZZ5 X-Received: by 2002:a17:906:c296:: with SMTP id r22mr5921259ejz.158.1612560549915; Fri, 05 Feb 2021 13:29:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612560549; cv=none; d=google.com; s=arc-20160816; b=HcOcKyC+njDtRWNe9i9kxuA1s7TRig7TgqUpbkPLonB3Oj9p08C4fLMicTQR88eaH7 BcYTCC47b8ooVWkac+cwk8sZ1Uka7ydRT6FHAk3/B6hBJEQ146/3ePdLCA5Nue4eF+PD /rNNQ+MFuvMHfWauppsKZpiCZTuX5/Sr2RPsO3nEsAOIJs9kugduSBvNtxHz7pL4KFBJ IF8YCq96jUbk51Z0XUeIwTzb02xdhAANnQh3vHQqZmCol3XNiC7T6vFEpSzrlLX36fvJ P6BSqhKG0dgmfMSJxnNKHVTcZWOhk5eLPjT6XeEOnQk9p6/j+wVqgJXSgZQMXNZKOAZl pf0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=h4oxaeDdr/FUDFVn0GWxZrM93TFDy61YLBxtj6t71IM=; b=PHlzMwuVVgoJqNo8lb+GYiG9vx1B4U9naN7AVrhhwppmHJUFSf2Qd+UrR8YYY6i2FN IBZoGgpw+pXxxc6kQs8CXAqNRSVel9qiaJKeWVqHOJyzhmkG1VycBzLGCqqhz1cpPtwJ 6DT8/oH/KNBHhZcdK2Cwjg7o63aWo02V7IhPu3KnI59nfKTXmBPrztpQfyJnBe8Xupa2 diXVlMm29KVe7DRiR1Z8/pBCGHiuJg4mewgAYCkgj6ODF4HW40Jvp6PC/ALSBayF/Qos NOweWUNsM63edP3FjxKBAY8o2dHAE785o/oiIkJv/RCHTS6FOhwzmRYZ2Jqkw9gGC9e5 Bb3w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g21si5957110edb.12.2021.02.05.13.28.44; Fri, 05 Feb 2021 13:29:09 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233428AbhBEV1z (ORCPT + 99 others); Fri, 5 Feb 2021 16:27:55 -0500 Received: from mail.fireflyinternet.com ([77.68.26.236]:52150 "EHLO fireflyinternet.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S232802AbhBEPAc (ORCPT ); Fri, 5 Feb 2021 10:00:32 -0500 X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.69.177; Received: from build.alporthouse.com (unverified [78.156.69.177]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 23800349-1500050 for multiple; Fri, 05 Feb 2021 16:38:03 +0000 From: Chris Wilson To: linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, Chris Wilson , Kees Cook , Andy Lutomirski , Will Drewry , Andrew Morton , Dave Airlie , Daniel Vetter , Lucas Stach Subject: [PATCH] kernel: Expose SYS_kcmp by default Date: Fri, 5 Feb 2021 16:37:52 +0000 Message-Id: <20210205163752.11932-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Userspace has discovered the functionality offered by SYS_kcmp and has started to depend upon it. In particular, Mesa uses SYS_kcmp for os_same_file_description() in order to identify when two fd (e.g. device or dmabuf) point to the same struct file. Since they depend on it for core functionality, lift SYS_kcmp out of the non-default CONFIG_CHECKPOINT_RESTORE into the selectable syscall category. Signed-off-by: Chris Wilson Cc: Kees Cook Cc: Andy Lutomirski Cc: Will Drewry Cc: Andrew Morton Cc: Dave Airlie Cc: Daniel Vetter Cc: Lucas Stach --- init/Kconfig | 11 +++++++++++ kernel/Makefile | 2 +- tools/testing/selftests/seccomp/seccomp_bpf.c | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/init/Kconfig b/init/Kconfig index b77c60f8b963..f62fca13ac5b 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1194,6 +1194,7 @@ endif # NAMESPACES config CHECKPOINT_RESTORE bool "Checkpoint/restore support" select PROC_CHILDREN + select KCMP default n help Enables additional kernel features in a sake of checkpoint/restore. @@ -1737,6 +1738,16 @@ config ARCH_HAS_MEMBARRIER_CALLBACKS config ARCH_HAS_MEMBARRIER_SYNC_CORE bool +config KCMP + bool "Enable kcmp() system call" if EXPERT + default y + help + Enable the file descriptor comparison system call. It provides + user-space with the ability to compare two fd to see if they + point to the same file, and check other attributes. + + If unsure, say Y. + config RSEQ bool "Enable rseq() system call" if EXPERT default y diff --git a/kernel/Makefile b/kernel/Makefile index aa7368c7eabf..320f1f3941b7 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -51,7 +51,7 @@ obj-y += livepatch/ obj-y += dma/ obj-y += entry/ -obj-$(CONFIG_CHECKPOINT_RESTORE) += kcmp.o +obj-$(CONFIG_KCMP) += kcmp.o obj-$(CONFIG_FREEZER) += freezer.o obj-$(CONFIG_PROFILING) += profile.o obj-$(CONFIG_STACKTRACE) += stacktrace.o diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c index 26c72f2b61b1..1b6c7d33c4ff 100644 --- a/tools/testing/selftests/seccomp/seccomp_bpf.c +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c @@ -315,7 +315,7 @@ TEST(kcmp) ret = __filecmp(getpid(), getpid(), 1, 1); EXPECT_EQ(ret, 0); if (ret != 0 && errno == ENOSYS) - SKIP(return, "Kernel does not support kcmp() (missing CONFIG_CHECKPOINT_RESTORE?)"); + SKIP(return, "Kernel does not support kcmp() (missing CONFIG_KCMP?)"); } TEST(mode_strict_support) -- 2.20.1