public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kay Sievers <kay.sievers@vrfy.org>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Ingo Molnar <mingo@elte.hu>, Greg KH <greg@kroah.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [bug] /etc/profile: line 30: /dev/null: Permission denied
Date: Fri, 18 Sep 2009 23:31:53 +0200	[thread overview]
Message-ID: <1253309513.1864.5.camel@yio.site> (raw)
In-Reply-To: <m14or0vul4.fsf@fess.ebiederm.org>

On Fri, 2009-09-18 at 13:58 -0700, Eric W. Biederman wrote:
> As a special case you can implement this much
> more simply in devtmpfs_mount just do:

I sent the patch to Greg already. I like to keep the things in the
subsystem where the non-default names are set. The issue will come back
from the embedded guys, who want to do be able to do that for a few more
nodes and run their stuff completely without userspace /dev. We are also
sure never to touch anything we did not create.

> int devtmpfs_mount(const char *mountpoint)
> {
>         sys_mount("none", "dev", "devtmpfs", MS_SILENT, NULL);
> 	sys_chmod("dev/console", 0666);
> 	sys_chmod("dev/tty", 0666);
> 	sys_chmod("dev/null", 0666);
> 	sys_chmod("dev/zero", 0666);
> }
> 
> Not using sys_mount is the problem Christoph was complaining about.
> 
> Grafting dev_mount into the global namespace (instead of making
> a copy and grafting that is pretty hideous).   It means that
> vfs_path_lookup will follow mounts, and it is a reference counting
> problem.

Ah, thanks.

> You can probably oops the kernel by going into single
> user mode and unmounting devtmpfs as the code stands right now.

It's busy here, and looks fine.



This change works for me here. Do you want to send or sign that off? :)

Thanks a lot,
Kay

---
 devtmpfs.c |    7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c
index fd488ad..685fc05 100644
--- a/drivers/base/devtmpfs.c
+++ b/drivers/base/devtmpfs.c
@@ -316,7 +316,6 @@ out:
  */
 int devtmpfs_mount(const char *mountpoint)
 {
-	struct path path;
 	int err;
 
 	if (!dev_mount)
@@ -325,15 +324,11 @@ int devtmpfs_mount(const char *mountpoint)
 	if (!dev_mnt)
 		return 0;
 
-	err = kern_path(mountpoint, LOOKUP_FOLLOW, &path);
-	if (err)
-		return err;
-	err = do_add_mount(dev_mnt, &path, 0, NULL);
+	err = sys_mount("none", mountpoint, "devtmpfs", MS_SILENT, NULL);
 	if (err)
 		printk(KERN_INFO "devtmpfs: error mounting %i\n", err);
 	else
 		printk(KERN_INFO "devtmpfs: mounted\n");
-	path_put(&path);
 	return err;
 }
 



  parent reply	other threads:[~2009-09-18 21:32 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-17  8:23 [PATCH] Remove broken by design and by implementation devtmpfs maintenance disaster Eric W. Biederman
2009-09-17 12:03 ` Kay Sievers
2009-09-17 13:13   ` Alan Cox
2009-09-17 16:35     ` Scott James Remnant
2009-09-17 17:47       ` Arjan van de Ven
2009-09-17 18:59         ` Scott James Remnant
2009-09-17 19:11           ` Arjan van de Ven
2009-09-18 12:57           ` Eric W. Biederman
2009-09-18 13:16   ` Eric W. Biederman
2009-09-18 13:54   ` Eric W. Biederman
2009-09-18 14:09     ` Arjan van de Ven
2009-09-18 14:11       ` Kay Sievers
2009-09-18 14:25         ` Arjan van de Ven
2009-09-18 14:32           ` Kay Sievers
2009-09-18 14:43             ` Arjan van de Ven
2009-09-18 14:58               ` Kay Sievers
2009-09-18 15:13                 ` Arjan van de Ven
2009-09-18 15:32                   ` Kay Sievers
2009-09-18 19:33                     ` Eric W. Biederman
2009-09-18 14:42       ` Eric W. Biederman
2009-09-17 12:57 ` Greg KH
2009-09-17 13:05   ` Alan Cox
2009-09-17 13:29     ` Greg KH
2009-09-17 15:43       ` Alan Cox
2009-09-18  6:03         ` Greg KH
2009-09-18  9:25           ` Alan Cox
2009-09-18 15:05             ` Greg KH
2009-09-17 17:29   ` Eric W. Biederman
2009-09-17 18:53     ` [bug] /etc/profile: line 30: /dev/null: Permission denied (Was: Re: [PATCH] Remove broken by design and by implementation devtmpfs maintenance disaster) Ingo Molnar
2009-09-17 19:18       ` Kay Sievers
2009-09-17 20:26         ` Linus Torvalds
2009-09-17 20:31           ` Ingo Molnar
2009-09-18  5:58             ` Greg KH
2009-09-25 20:49               ` Pavel Machek
2009-09-27 22:52                 ` Greg KH
2009-09-17 22:26           ` Kay Sievers
2009-09-17 22:41             ` Alan Cox
2009-09-18  0:18             ` Linus Torvalds
2009-09-18  1:50               ` Kay Sievers
2009-09-18  6:02                 ` Greg KH
2009-09-18 11:50                   ` Kay Sievers
2009-09-18 14:18                   ` Linus Torvalds
2009-09-18 15:05                     ` Greg KH
2009-09-18 15:37                       ` Kay Sievers
2009-09-18 19:35                         ` Kay Sievers
2009-09-18 19:41                           ` Linus Torvalds
2009-09-18 19:50                           ` Ingo Molnar
2009-09-20  1:43                             ` Dave Airlie
2009-09-20 15:08                               ` Greg KH
2009-09-21  2:58                                 ` Dave Airlie
     [not found]                                 ` <ac3eb2510909200912o76e0d4e4l2dcaf352fe6b4e19@mail.gmail.com>
     [not found]                                   ` <ac3eb2510909200914g1ed6a47cydc0edec6fff96ef4@mail.gmail.com>
2009-09-21  2:59                                     ` Dave Airlie
2009-10-20 20:32                                       ` Scott James Remnant
2009-09-20 17:33                               ` Ingo Molnar
2009-09-18 20:58                 ` [bug] /etc/profile: line 30: /dev/null: Permission denied Eric W. Biederman
2009-09-18 21:09                   ` Linus Torvalds
2009-09-18 21:19                     ` Kay Sievers
2009-09-18 22:06                       ` Linus Torvalds
2009-09-18 21:31                   ` Kay Sievers [this message]
2009-09-18 22:03                     ` Eric W. Biederman
2009-09-18  5:54     ` [PATCH] Remove broken by design and by implementation devtmpfs maintenance disaster Greg KH
2009-09-18 12:24       ` Eric W. Biederman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1253309513.1864.5.camel@yio.site \
    --to=kay.sievers@vrfy.org \
    --cc=ebiederm@xmission.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox