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=-17.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 C5CA8C433E0 for ; Fri, 5 Feb 2021 21:50:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7DBDB64FB2 for ; Fri, 5 Feb 2021 21:50:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233032AbhBEVuQ (ORCPT ); Fri, 5 Feb 2021 16:50:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231725AbhBEVse (ORCPT ); Fri, 5 Feb 2021 16:48:34 -0500 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9C2AC06174A for ; Fri, 5 Feb 2021 13:47:53 -0800 (PST) Received: by mail-ed1-x529.google.com with SMTP id s5so10626007edw.8 for ; Fri, 05 Feb 2021 13:47:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=5pnuSpNEKdmcoBjj2QdJNC7CgKySzqePnnhN0iJ74KE=; b=CazZD3gaSDfOEUuMFkR/IQY8QFmfUv80CHWEbco/8E0oftbEwwOIJ3fjX/atsGd7wj evBDAPwAJv0WyagdvYzl42paXlsjQMsJ/RGozF1eefiPC5SzIh4WIwOVjh4BY5hIiGBz N62/fb3kVV42RVbaHipmcM3KLdUFhQxMvqvNw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=5pnuSpNEKdmcoBjj2QdJNC7CgKySzqePnnhN0iJ74KE=; b=jvjTpd700ESw9FdEtATeXNkKiQKAaFGIIqMYdq3UjhejiDTR+4JQ68P2ynWhHXz+N0 i0Cc7s6gejurhIK7cQFIJeqROQuwi2qMUA1QECEZdtbMmMu2rfq7ZzumHrGK/xz5dKwY zq+tstHORgbnxjaMCaaSRox2vP1PGYEL/VLWQzT2mPlEauG21FLimaIwXWbIPFk3BsDn wITpz1LVAYCZ4RDiH+DgOOw69T9XD686xb+ftagioL8A1Is6HPXBOTR2DkWg6tyVMJhI rjq2RPwCn98Cf0uqvWLy7YSqNmxPq+drKCMj68tb/fgNwOMIG3a81Psh+/cL86ycWccr 5Zew== X-Gm-Message-State: AOAM533dcsAApVVvmJSOeXBE3CwrfquhQOddyo+nteG9RPzQhfBr1G6D aDz5Nxu/+6hHdVYnurmy6gIk1A== X-Google-Smtp-Source: ABdhPJzF+ubix/uZD3BGg6fAO3117ri17tLNIaKGiQba39MM+mUoaHvFRc/aLbJESW7rmz+oz9Wt1w== X-Received: by 2002:a05:6402:10ce:: with SMTP id p14mr5530673edu.261.1612561672579; Fri, 05 Feb 2021 13:47:52 -0800 (PST) Received: from [192.168.1.149] (5.186.115.188.cgn.fibianet.dk. [5.186.115.188]) by smtp.gmail.com with ESMTPSA id y11sm4515813ejd.72.2021.02.05.13.47.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 05 Feb 2021 13:47:52 -0800 (PST) Subject: Re: [PATCH v2] kernel: Expose SYS_kcmp by default 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 , Lucas Stach , Daniel Vetter , Cyrill Gorcunov References: <20210205163752.11932-1-chris@chris-wilson.co.uk> <20210205210610.29837-1-chris@chris-wilson.co.uk> From: Rasmus Villemoes Message-ID: Date: Fri, 5 Feb 2021 22:47:47 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210205210610.29837-1-chris@chris-wilson.co.uk> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/02/2021 22.06, Chris Wilson wrote: > 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. > > Note that some distributions such as Ubuntu are already enabling > CHECKPOINT_RESTORE in their configs and so, by extension, SYS_kcmp. > Looks a lot like https://lore.kernel.org/lkml/20200710075632.14661-1-linux@rasmusvillemoes.dk/. So FWIW, ack from me. cc += Cyrill. > References: https://gitlab.freedesktop.org/drm/intel/-/issues/3046 > 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 > Acked-by: Daniel Vetter # DRM depends on SYS_kcmp > > --- > v2: > - Default n. > - Borrrow help message from man kcmp. > - Export get_epoll_tfile_raw_ptr() for CONFIG_KCMP > --- > fs/eventpoll.c | 4 ++-- > include/linux/eventpoll.h | 2 +- > init/Kconfig | 12 ++++++++++++ > kernel/Makefile | 2 +- > tools/testing/selftests/seccomp/seccomp_bpf.c | 2 +- > 5 files changed, 17 insertions(+), 5 deletions(-) > > diff --git a/fs/eventpoll.c b/fs/eventpoll.c > index a829af074eb5..3196474cbe24 100644 > --- a/fs/eventpoll.c > +++ b/fs/eventpoll.c > @@ -979,7 +979,7 @@ static struct epitem *ep_find(struct eventpoll *ep, struct file *file, int fd) > return epir; > } > > -#ifdef CONFIG_CHECKPOINT_RESTORE > +#ifdef CONFIG_KCMP > static struct epitem *ep_find_tfd(struct eventpoll *ep, int tfd, unsigned long toff) > { > struct rb_node *rbp; > @@ -1021,7 +1021,7 @@ struct file *get_epoll_tfile_raw_ptr(struct file *file, int tfd, > > return file_raw; > } > -#endif /* CONFIG_CHECKPOINT_RESTORE */ > +#endif /* CONFIG_KCMP */ > > /** > * Adds a new entry to the tail of the list in a lockless way, i.e. > diff --git a/include/linux/eventpoll.h b/include/linux/eventpoll.h > index 0350393465d4..593322c946e6 100644 > --- a/include/linux/eventpoll.h > +++ b/include/linux/eventpoll.h > @@ -18,7 +18,7 @@ struct file; > > #ifdef CONFIG_EPOLL > > -#ifdef CONFIG_CHECKPOINT_RESTORE > +#ifdef CONFIG_KCMP > struct file *get_epoll_tfile_raw_ptr(struct file *file, int tfd, unsigned long toff); > #endif > > diff --git a/init/Kconfig b/init/Kconfig > index b77c60f8b963..1b75141bc18b 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,17 @@ config ARCH_HAS_MEMBARRIER_CALLBACKS > config ARCH_HAS_MEMBARRIER_SYNC_CORE > bool > > +config KCMP > + bool "Enable kcmp() system call" if EXPERT > + default n > + help > + Enable the kernel resource comparison system call. It provides > + user-space with the ability to compare two processes to see if they > + share a common resource, such as a file descriptor or even virtual > + memory space. > + > + If unsure, say N. > + > 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) > 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=-15.4 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable 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 8BD52C433E0 for ; Fri, 5 Feb 2021 22:00:23 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0FF3364FD5 for ; Fri, 5 Feb 2021 22:00:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0FF3364FD5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rasmusvillemoes.dk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5665C6F4FA; Fri, 5 Feb 2021 22:00:20 +0000 (UTC) Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by gabe.freedesktop.org (Postfix) with ESMTPS id 31AF76F4F5 for ; Fri, 5 Feb 2021 21:47:54 +0000 (UTC) Received: by mail-ed1-x532.google.com with SMTP id q2so10663989edi.4 for ; Fri, 05 Feb 2021 13:47:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=5pnuSpNEKdmcoBjj2QdJNC7CgKySzqePnnhN0iJ74KE=; b=CazZD3gaSDfOEUuMFkR/IQY8QFmfUv80CHWEbco/8E0oftbEwwOIJ3fjX/atsGd7wj evBDAPwAJv0WyagdvYzl42paXlsjQMsJ/RGozF1eefiPC5SzIh4WIwOVjh4BY5hIiGBz N62/fb3kVV42RVbaHipmcM3KLdUFhQxMvqvNw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=5pnuSpNEKdmcoBjj2QdJNC7CgKySzqePnnhN0iJ74KE=; b=UHmo6SKJiW87Rb+tyyB8bXXLpvILvGVPzEaacU8NhOLbyAf7dn8isb4Yzfel9nrLCo e5lFEvfUpzrgj22h8vwVWOjNt+7s9ZA2wis1s7U4yI0POw6pp0Aqy7GVPKaiuKeWzuc6 EzJSLlvR8phrC3hZ5OocRFfW7dGTbfXyJaN6JK7zCZRYLvmkwZQB2LiC57X6xOGEAZoL bC1+QBfH1pyuiaKl5/nLx74SU07TOwaS8yudDLaptYdMD5WYIAopK7NFJDlet+zXicZF z7f+YtoT0+ACQOznI+0/Cvsl+gMINcCcsuw8c1Ohi7PB25LYU/t8Uavr9uaUrY2NTARs Kulw== X-Gm-Message-State: AOAM532fP2MBVxTeLG+EY/ospmXCniMpaTnC8m6FuTRb464fkJQ0mlRI Qtak4otHFpm+YUaERoqVkoIFmQ== X-Google-Smtp-Source: ABdhPJzF+ubix/uZD3BGg6fAO3117ri17tLNIaKGiQba39MM+mUoaHvFRc/aLbJESW7rmz+oz9Wt1w== X-Received: by 2002:a05:6402:10ce:: with SMTP id p14mr5530673edu.261.1612561672579; Fri, 05 Feb 2021 13:47:52 -0800 (PST) Received: from [192.168.1.149] (5.186.115.188.cgn.fibianet.dk. [5.186.115.188]) by smtp.gmail.com with ESMTPSA id y11sm4515813ejd.72.2021.02.05.13.47.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 05 Feb 2021 13:47:52 -0800 (PST) Subject: Re: [PATCH v2] kernel: Expose SYS_kcmp by default To: Chris Wilson , linux-kernel@vger.kernel.org References: <20210205163752.11932-1-chris@chris-wilson.co.uk> <20210205210610.29837-1-chris@chris-wilson.co.uk> From: Rasmus Villemoes Message-ID: Date: Fri, 5 Feb 2021 22:47:47 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210205210610.29837-1-chris@chris-wilson.co.uk> Content-Language: en-US X-Mailman-Approved-At: Fri, 05 Feb 2021 22:00:18 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Will Drewry , Kees Cook , Daniel Vetter , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Andy Lutomirski , Cyrill Gorcunov , Andrew Morton Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On 05/02/2021 22.06, Chris Wilson wrote: > 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. > > Note that some distributions such as Ubuntu are already enabling > CHECKPOINT_RESTORE in their configs and so, by extension, SYS_kcmp. > Looks a lot like https://lore.kernel.org/lkml/20200710075632.14661-1-linux@rasmusvillemoes.dk/. So FWIW, ack from me. cc += Cyrill. > References: https://gitlab.freedesktop.org/drm/intel/-/issues/3046 > 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 > Acked-by: Daniel Vetter # DRM depends on SYS_kcmp > > --- > v2: > - Default n. > - Borrrow help message from man kcmp. > - Export get_epoll_tfile_raw_ptr() for CONFIG_KCMP > --- > fs/eventpoll.c | 4 ++-- > include/linux/eventpoll.h | 2 +- > init/Kconfig | 12 ++++++++++++ > kernel/Makefile | 2 +- > tools/testing/selftests/seccomp/seccomp_bpf.c | 2 +- > 5 files changed, 17 insertions(+), 5 deletions(-) > > diff --git a/fs/eventpoll.c b/fs/eventpoll.c > index a829af074eb5..3196474cbe24 100644 > --- a/fs/eventpoll.c > +++ b/fs/eventpoll.c > @@ -979,7 +979,7 @@ static struct epitem *ep_find(struct eventpoll *ep, struct file *file, int fd) > return epir; > } > > -#ifdef CONFIG_CHECKPOINT_RESTORE > +#ifdef CONFIG_KCMP > static struct epitem *ep_find_tfd(struct eventpoll *ep, int tfd, unsigned long toff) > { > struct rb_node *rbp; > @@ -1021,7 +1021,7 @@ struct file *get_epoll_tfile_raw_ptr(struct file *file, int tfd, > > return file_raw; > } > -#endif /* CONFIG_CHECKPOINT_RESTORE */ > +#endif /* CONFIG_KCMP */ > > /** > * Adds a new entry to the tail of the list in a lockless way, i.e. > diff --git a/include/linux/eventpoll.h b/include/linux/eventpoll.h > index 0350393465d4..593322c946e6 100644 > --- a/include/linux/eventpoll.h > +++ b/include/linux/eventpoll.h > @@ -18,7 +18,7 @@ struct file; > > #ifdef CONFIG_EPOLL > > -#ifdef CONFIG_CHECKPOINT_RESTORE > +#ifdef CONFIG_KCMP > struct file *get_epoll_tfile_raw_ptr(struct file *file, int tfd, unsigned long toff); > #endif > > diff --git a/init/Kconfig b/init/Kconfig > index b77c60f8b963..1b75141bc18b 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,17 @@ config ARCH_HAS_MEMBARRIER_CALLBACKS > config ARCH_HAS_MEMBARRIER_SYNC_CORE > bool > > +config KCMP > + bool "Enable kcmp() system call" if EXPERT > + default n > + help > + Enable the kernel resource comparison system call. It provides > + user-space with the ability to compare two processes to see if they > + share a common resource, such as a file descriptor or even virtual > + memory space. > + > + If unsure, say N. > + > 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) > _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel 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=-15.4 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 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 458F1C433E0 for ; Fri, 5 Feb 2021 21:47:57 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 987A164FCE for ; Fri, 5 Feb 2021 21:47:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 987A164FCE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rasmusvillemoes.dk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 26A496F4F3; Fri, 5 Feb 2021 21:47:56 +0000 (UTC) Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by gabe.freedesktop.org (Postfix) with ESMTPS id 315AC6F4F3 for ; Fri, 5 Feb 2021 21:47:53 +0000 (UTC) Received: by mail-ed1-x531.google.com with SMTP id z22so10583271edb.9 for ; Fri, 05 Feb 2021 13:47:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=5pnuSpNEKdmcoBjj2QdJNC7CgKySzqePnnhN0iJ74KE=; b=CazZD3gaSDfOEUuMFkR/IQY8QFmfUv80CHWEbco/8E0oftbEwwOIJ3fjX/atsGd7wj evBDAPwAJv0WyagdvYzl42paXlsjQMsJ/RGozF1eefiPC5SzIh4WIwOVjh4BY5hIiGBz N62/fb3kVV42RVbaHipmcM3KLdUFhQxMvqvNw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=5pnuSpNEKdmcoBjj2QdJNC7CgKySzqePnnhN0iJ74KE=; b=XX1sUiUG5+ADOyvzUOvjUYxLcklfMyAGl+ULkb2yNlFe0VzoAS3V1KGiWEA9Z4OAi9 FI6PiedVpswlB9thXtpfnka687pEBWxdIheA4TSvjjmiqZaBH9gIQCzrDz35Ckzj9vpr 7x/GH8YvT7vmI1EkPuKULQ0Ngl/y/emJftLmkzRjRot5nSeQ8TN6UEJP5L5z6VLPtamX w4JbCuMC/Zakbi/BSWEX6AEO26GBwP+qKg4ekiSIuNQ0VAZiYUNgcGvDVsuX/+uVpjK8 r+NQ0rKUD6B/gUdVtO9J2SX4FKKxWKwQqg57Qch3l0D28rQwKe0l6/a8prCPiGxplMED +e6Q== X-Gm-Message-State: AOAM533HVoH95crcRAn+Kfu/nLRSBD9ckQ0Kj5JpMFAfTPtFOidgL2uE +cVRg0dn8jMf9F02TMDgKeKiIQ== X-Google-Smtp-Source: ABdhPJzF+ubix/uZD3BGg6fAO3117ri17tLNIaKGiQba39MM+mUoaHvFRc/aLbJESW7rmz+oz9Wt1w== X-Received: by 2002:a05:6402:10ce:: with SMTP id p14mr5530673edu.261.1612561672579; Fri, 05 Feb 2021 13:47:52 -0800 (PST) Received: from [192.168.1.149] (5.186.115.188.cgn.fibianet.dk. [5.186.115.188]) by smtp.gmail.com with ESMTPSA id y11sm4515813ejd.72.2021.02.05.13.47.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 05 Feb 2021 13:47:52 -0800 (PST) To: Chris Wilson , linux-kernel@vger.kernel.org References: <20210205163752.11932-1-chris@chris-wilson.co.uk> <20210205210610.29837-1-chris@chris-wilson.co.uk> From: Rasmus Villemoes Message-ID: Date: Fri, 5 Feb 2021 22:47:47 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210205210610.29837-1-chris@chris-wilson.co.uk> Content-Language: en-US Subject: Re: [Intel-gfx] [PATCH v2] kernel: Expose SYS_kcmp by default X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Will Drewry , Kees Cook , Daniel Vetter , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Andy Lutomirski , Cyrill Gorcunov , Andrew Morton , Lucas Stach Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On 05/02/2021 22.06, Chris Wilson wrote: > 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. > > Note that some distributions such as Ubuntu are already enabling > CHECKPOINT_RESTORE in their configs and so, by extension, SYS_kcmp. > Looks a lot like https://lore.kernel.org/lkml/20200710075632.14661-1-linux@rasmusvillemoes.dk/. So FWIW, ack from me. cc += Cyrill. > References: https://gitlab.freedesktop.org/drm/intel/-/issues/3046 > 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 > Acked-by: Daniel Vetter # DRM depends on SYS_kcmp > > --- > v2: > - Default n. > - Borrrow help message from man kcmp. > - Export get_epoll_tfile_raw_ptr() for CONFIG_KCMP > --- > fs/eventpoll.c | 4 ++-- > include/linux/eventpoll.h | 2 +- > init/Kconfig | 12 ++++++++++++ > kernel/Makefile | 2 +- > tools/testing/selftests/seccomp/seccomp_bpf.c | 2 +- > 5 files changed, 17 insertions(+), 5 deletions(-) > > diff --git a/fs/eventpoll.c b/fs/eventpoll.c > index a829af074eb5..3196474cbe24 100644 > --- a/fs/eventpoll.c > +++ b/fs/eventpoll.c > @@ -979,7 +979,7 @@ static struct epitem *ep_find(struct eventpoll *ep, struct file *file, int fd) > return epir; > } > > -#ifdef CONFIG_CHECKPOINT_RESTORE > +#ifdef CONFIG_KCMP > static struct epitem *ep_find_tfd(struct eventpoll *ep, int tfd, unsigned long toff) > { > struct rb_node *rbp; > @@ -1021,7 +1021,7 @@ struct file *get_epoll_tfile_raw_ptr(struct file *file, int tfd, > > return file_raw; > } > -#endif /* CONFIG_CHECKPOINT_RESTORE */ > +#endif /* CONFIG_KCMP */ > > /** > * Adds a new entry to the tail of the list in a lockless way, i.e. > diff --git a/include/linux/eventpoll.h b/include/linux/eventpoll.h > index 0350393465d4..593322c946e6 100644 > --- a/include/linux/eventpoll.h > +++ b/include/linux/eventpoll.h > @@ -18,7 +18,7 @@ struct file; > > #ifdef CONFIG_EPOLL > > -#ifdef CONFIG_CHECKPOINT_RESTORE > +#ifdef CONFIG_KCMP > struct file *get_epoll_tfile_raw_ptr(struct file *file, int tfd, unsigned long toff); > #endif > > diff --git a/init/Kconfig b/init/Kconfig > index b77c60f8b963..1b75141bc18b 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,17 @@ config ARCH_HAS_MEMBARRIER_CALLBACKS > config ARCH_HAS_MEMBARRIER_SYNC_CORE > bool > > +config KCMP > + bool "Enable kcmp() system call" if EXPERT > + default n > + help > + Enable the kernel resource comparison system call. It provides > + user-space with the ability to compare two processes to see if they > + share a common resource, such as a file descriptor or even virtual > + memory space. > + > + If unsure, say N. > + > 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) > _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx