From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C3E1C433E0 for ; Fri, 5 Feb 2021 19:46:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C032764FBA for ; Fri, 5 Feb 2021 19:46:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233581AbhBESDM (ORCPT ); Fri, 5 Feb 2021 13:03:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233034AbhBEPWa (ORCPT ); Fri, 5 Feb 2021 10:22:30 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EEA1C061793 for ; Fri, 5 Feb 2021 09:03:00 -0800 (PST) Received: from gallifrey.ext.pengutronix.de ([2001:67c:670:201:5054:ff:fe8d:eefb] helo=[IPv6:::1]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l84VW-00017l-SZ; Fri, 05 Feb 2021 18:02:58 +0100 Message-ID: Subject: Re: [PATCH] kernel: Expose SYS_kcmp by default From: Lucas Stach To: Chris Wilson , linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, Kees Cook , Andy Lutomirski , Will Drewry , Andrew Morton , Dave Airlie , Daniel Vetter Date: Fri, 05 Feb 2021 18:02:56 +0100 In-Reply-To: <20210205163752.11932-1-chris@chris-wilson.co.uk> References: <20210205163752.11932-1-chris@chris-wilson.co.uk> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.3 (3.38.3-1.fc33) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2001:67c:670:201:5054:ff:fe8d:eefb X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Freitag, dem 05.02.2021 um 16:37 +0000 schrieb Chris Wilson: > 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. This description undersells the abilities of kcmp, while fd compare is the only thing used by the graphics stack, kcmp can compare a handful of other system resources, see man 2 kcmp. I think the helptext should at least try to cover this fact somewhat. Regards, Lucas > + > + 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)