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 45FC9C00140 for ; Thu, 18 Aug 2022 06:26:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A1BF96B0073; Thu, 18 Aug 2022 02:26:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9CB056B0074; Thu, 18 Aug 2022 02:26:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 893796B0075; Thu, 18 Aug 2022 02:26:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 79E0B6B0073 for ; Thu, 18 Aug 2022 02:26:44 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 1F7D91A0A45 for ; Thu, 18 Aug 2022 06:26:44 +0000 (UTC) X-FDA: 79811729928.11.4F82515 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf12.hostedemail.com (Postfix) with ESMTP id 8D6774008E for ; Thu, 18 Aug 2022 06:26:43 +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 dfw.source.kernel.org (Postfix) with ESMTPS id C681861620; Thu, 18 Aug 2022 06:26:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5C6EC433D7; Thu, 18 Aug 2022 06:26:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660804002; bh=EVJabPYCgEWslVXIIS5VTejmPf7jZfIhFfIDrDoGrMw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WTitW138d4FXxxArTaDl+vadMXEuef0DMy5kNFI2wQk1B2v5uTcpzXOQdV8WgYCGi 62f1oVsm0anAaezQ1daKMWbvNeruBv2BuWZBTMJG97kzOiUqIzdLg2nVgZ9p2lGN41 ZHCjW1vnf9imtDizIwk22LNZ4FsYuZwrBijO7xHM= Date: Thu, 18 Aug 2022 08:26:38 +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: <20220817214728.489904-3-axelrasmussen@google.com> ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=korg header.b=WTitW138; spf=pass (imf12.hostedemail.com: domain of gregkh@linuxfoundation.org designates 139.178.84.217 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=1660804003; a=rsa-sha256; cv=none; b=vKkCVNq25IYRLlSMLTNoSI+yWa/LCRFNAn8ONULw9ZE572zJq4LMSD71AWqzHYhx0TI8kN 2jRP0J6lsdjCApR0b9DMZYKOM4qKsaXZ/fJRMxGAvTQoYHqC6gQjYShq85Gk92Qn1zjlVY 9KAeMPQsTguUOOR8PS3pcX8Yj6PPm88= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660804003; 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=K/LixJwA3WLA9TBt7KtHnI6QQXgIa8pTcdz8Qgajil0=; b=I5Hkh35BHA7lswnYVlIYpD7Ym8dovJZuT2P1NHYrSmSBa77mSbwsnhEbwTCIX6QgaqDb+c kk/E2DtoBQXyzQASicd3xSUIKN3FCOf4PghqxWo39xv2hHpvRxBecaiHxBWjPkSdaWrd+j TJQjAkCjIEE+Rj/prk3YLBE4SNpJQIs= X-Rspam-User: X-Rspamd-Queue-Id: 8D6774008E X-Stat-Signature: qdosdt1qtk6x6rkhg7w7jk9kqu5jecoy Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=korg header.b=WTitW138; spf=pass (imf12.hostedemail.com: domain of gregkh@linuxfoundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org; dmarc=pass (policy=none) header.from=linuxfoundation.org X-Rspamd-Server: rspam11 X-HE-Tag: 1660804003-59581 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 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.) thanks, greg k-h