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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20111204213816.12121.qmail@science.horizon.com>
Date:	4 Dec 2011 16:38:16 -0500
From:	"George Spelvin" <linux@...izon.com>
To:	linux@...izon.com, viro@...IV.linux.org.uk
Cc:	linux-kernel@...r.kernel.org
Subject: Re: Is there a reason hard links from /proc/$PID/fd/$NUM are disallowed?

> You do realize that link(2) does *NOT* follow links, do you?  linkat(2)
> does, if you explicitly ask for that:
> 
> linkat(AT_FDCWD, "/proc/42/fd/1", AT_FDCWD, "/tmp/foo", AT_SYMLINK_FOLLOW)
> 
> will do it just fine.

Thank you very much!  What's embarrassing is that I actually *knew* that once.

That seems to change the error message.

cd /run/shm	# A tmpfs directory
echo foo > foo
sleep 10000 < foo &
pid=$!
rm foo
strace ln -L /proc/$pid/fd/0 bar

produces:
stat64("/run/shm/bar", 0xbfb7b46c)      = -1 ENOENT (No such file or directory)
stat64("/proc/25098/fd/0", {st_mode=S_IFREG|0644, st_size=4, ...}) = 0
linkat(AT_FDCWD, "/proc/25098/fd/0", AT_FDCWD, "/run/shm/bar", 1024) = -1 ENOENT
 (No such file or directory)

(1024 is indeed AT_SYMLINK_FOLLOW)

It seems to work, however, if the file is *not* deleted first.
--
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