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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 884C9C3F6B0 for ; Thu, 18 Aug 2022 06:32:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 00BD68D0002; Thu, 18 Aug 2022 02:32:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EFD8F6B0074; Thu, 18 Aug 2022 02:32:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DC5188D0002; Thu, 18 Aug 2022 02:32:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id CA2A86B0073 for ; Thu, 18 Aug 2022 02:32:28 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 8C98A1A0A3A for ; Thu, 18 Aug 2022 06:32:28 +0000 (UTC) X-FDA: 79811744376.16.D9681CC Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf03.hostedemail.com (Postfix) with ESMTP id 0BEA6201DD for ; Thu, 18 Aug 2022 06:32:27 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0ED52B820E2; Thu, 18 Aug 2022 06:32:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25A5FC433C1; Thu, 18 Aug 2022 06:32:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660804344; bh=Kqr77NyLJGS64iGu/RtqfYqcdRHgst5RRJdReOBJ4MA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rE3Ul1r/xBzy8REQeOSMR5W9G3qtjDIFEqDZwzPjSHVs6/tM/sOEIKW1kULxas2S8 UfeAwG7e0k+L51z4LgM//64ayk4rwS8oP1bO/8jKUtlUAHfZxuXVAmaYXgC9Q+1xh1 uDRyYrP60BbBsqlTH9X1oxB4yGYRUh5a4g/3dg+4= Date: Thu, 18 Aug 2022 08:32:22 +0200 From: Greg KH To: Axel Rasmussen Cc: Alexander Viro , Andrew Morton , Dave Hansen , "Dmitry V . Levin" , Gleb Fotengauer-Malinovskiy , Hugh Dickins , Jan Kara , Jonathan Corbet , Mel Gorman , Mike Kravetz , Mike Rapoport , Nadav Amit , Peter Xu , Shuah Khan , Suren Baghdasaryan , Vlastimil Babka , zhangyi , linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, linux-security-module@vger.kernel.org, Mike Rapoport Subject: Re: [PATCH v6 2/5] userfaultfd: add /dev/userfaultfd for fine grained access control Message-ID: References: <20220817214728.489904-1-axelrasmussen@google.com> <20220817214728.489904-3-axelrasmussen@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=korg header.b="rE3Ul1r/"; spf=pass (imf03.hostedemail.com: domain of gregkh@linuxfoundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org; dmarc=pass (policy=none) header.from=linuxfoundation.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660804348; a=rsa-sha256; cv=none; b=qzkhf7K5CaYPtNGDobiguczJHXkVnkdcpKX5yfK9h+GETmsVUEJLu4pQM82FuWjOWKKAst ZztvsFVwfiBH9rx8rGdXE/5TsqO/mW3FapKwl8RfoQMeAxYD7NdaoTVqoQmz7Onz7I896m ExjvaDZtJtSq88+InExaHVUAdAhleOU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660804348; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=vpEViii+1Yq1utHla3iQ3gG2MXstIdO2aBqCJvIJ/WI=; b=xm2Vq3yzP4SqqBa0GO/S6BZZ8BRuVlp8qGSVbLdzPXNBEpu6AQQ1hM81+WMUmiWZiU8Xf2 a/ft8PRjbB1oJi4ZX2Bj/JeneBJiiXjbXPx3/hSmapaw8bouOJqxEI7wlscDJd6yQ2XBL+ 80TugYXNEbdRzNzmkG/bZANnQ9RFDSo= X-Stat-Signature: w5oyshkceqof6ier1aoefcm7s8e1dyey X-Rspam-User: Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=korg header.b="rE3Ul1r/"; spf=pass (imf03.hostedemail.com: domain of gregkh@linuxfoundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org; dmarc=pass (policy=none) header.from=linuxfoundation.org X-Rspamd-Queue-Id: 0BEA6201DD X-Rspamd-Server: rspam03 X-HE-Tag: 1660804347-574068 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Aug 18, 2022 at 08:26:38AM +0200, Greg KH wrote: > On Wed, Aug 17, 2022 at 02:47:25PM -0700, Axel Rasmussen wrote: > > +static int userfaultfd_dev_open(struct inode *inode, struct file *file) > > +{ > > + return 0; > > If your open does nothing, no need to list it here at all, right? > > > +} > > + > > +static long userfaultfd_dev_ioctl(struct file *file, unsigned int cmd, unsigned long flags) > > +{ > > + if (cmd != USERFAULTFD_IOC_NEW) > > + return -EINVAL; > > + > > + return new_userfaultfd(flags); > > +} > > + > > +static const struct file_operations userfaultfd_dev_fops = { > > + .open = userfaultfd_dev_open, > > + .unlocked_ioctl = userfaultfd_dev_ioctl, > > + .compat_ioctl = userfaultfd_dev_ioctl, > > Why do you need to set compat_ioctl? Shouldn't it just default to the > existing one? > > And why is this a device node at all? Shouldn't the syscall handle all > of this (to be honest, I didn't read anything but the misc code, sorry.) Ah, read the documentation now. Seems you want to make it easier for people to get permissions on a system. Doesn't seem wise, but hey, it's not my feature... thanks, greg k-h