lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Wed, 07 Jan 2009 15:32:09 +0900
From:	Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>
To:	miklos@...redi.hu
Cc:	viro@...IV.linux.org.uk, hch@....de, linux-fsdevel@...r.kernel.org,
	linux-security-module@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Introduce d_realpath().

Miklos Szeredi wrote:
> > Three differences compared to d_path().
> > (1) Ignores current process's root directory.
> 
> I'd suggest calling __d_path() and passing in the namespace root
> instead of the process root.  That would be a lot simpler and result
> in less code duplication.
> 
Yes, that'll be possible. But I won't do so. See (3).

> > (2) Trailing '/' is added if the pathname refers to a directory.
> 
> Caller can do this.
> 
Yes. But I'd like to add trailing '/' here.

Appending trailing '/' have to worry about buffer size, but removing trailing
'/' needn't to. Thus, I think it is more convenient for callers that trailing
'/' is automatically added.

> > (3) /proc/PID/ is represented as /proc/self/ if PID equals current->tgid.
> 
> This too.  Such hacks really don't belong in generic VFS functions.
> 
No.

How can the caller of __d_path() detect the /PID/ part and convert
to /self/ from returned string? You might think that I can use
strstr(returned_path, "/proc/") and strict_strtoul() .

The procfs is mounted on /proc/ by convention, but that is not guaranteed.
Some systems might mount procfs on /proc2/ , /p/ or /var/tmp/proc/100/proc/ .

Also, a pathname like /var/tmp/proc/100/file1.txt is possible.
In this case, /var/tmp/proc/ is not the mount point of the procfs.

Thus, it is too late for the caller of __d_path() to detect the /PID/ part.

If the caller of __d_path() traverses {dentry,mount} tree for checking
dentry->d_sb->s_magic == PROC_SUPER_MAGIC, the reason to call __d_path()
disappears.

Thus, I need to detect /proc/PID/ and convert it to /proc/self/ in
d_realpath().
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ