Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754212AbcL0K47 (ORCPT ); Tue, 27 Dec 2016 05:56:59 -0500 Received: from wp260.webpack.hosteurope.de ([80.237.133.29]:34848 "EHLO wp260.webpack.hosteurope.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752119AbcL0K46 (ORCPT ); Tue, 27 Dec 2016 05:56:58 -0500 X-Greylist: delayed 2173 seconds by postgrey-1.27 at vger.kernel.org; Tue, 27 Dec 2016 05:56:57 EST Date: Tue, 27 Dec 2016 11:20:37 +0100 From: Luis Ressel To: "Eric W. Biederman" , Alexander Viro , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: mount_pseudo(), sget() and MS_KERNMOUNT Message-ID: <20161227112037.015dc5ac@gentp.lnet> X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-bounce-key: webpack.hosteurope.de;aranea@aixah.de;1482836218;b7a91269; X-HE-SMSGID: 1cLos2-0002Bw-3c Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1113 Lines: 27 Hello, With Linux 4.8, the sget() function in fs/super.c got a new permission check: It now returns -EPERM if (!(flags & MS_KERNMOUNT) && !ns_capable(user_ns, CAP_SYS_ADMIN)) . I presume the first half is intented to detect in-kernel mounts? If so, why doesn't mount_pseudo() (in fs/libfs.c) pass the MS_KERNMOUNT flag to sget()? This behaviour has caused a problem for me: During graphics driver initalization, drm_fs_inode_new() (in drivers/gpu/drm/drm_drv.c) calls simple_pin_fs(). The MS_KERNMOUNT flag is indeed passed down the call chain from there, but it is lost when mount_pseudo() is called, as that function doesn't take a 'flags' argument. Hence, the first part of the above permission check fails. (The second part also fails under some cicumstances due to a SELinux quirk, and therefore the initalization of my graphics driver doesn't succeed.) Regards, Luis Ressel (Apologies if I'm sending this inquiry to the wrong people. I don't know much about the kernel development workflow, so I decided to send it to whomever get_maintainer.pl spat out, plus the author of the sget() change in 4.8.)