Cook: security things in Linux v5.1
Cook: security things in Linux v5.1
Posted May 30, 2019 15:43 UTC (Thu) by mgedmin (subscriber, #34497)In reply to: Cook: security things in Linux v5.1 by wahern
Parent article: Cook: security things in Linux v5.1
Posted May 30, 2019 16:21 UTC (Thu)
by nybble41 (subscriber, #55106)
[Link]
No, the O_DIRECTORY flag just causes the open() call to fail if the path does not refer to a directory. You can open directories without it. The shell has no issues redirecting from a directory rather than a file. You can test that yourself easily:
Cook: security things in Linux v5.1
$ ls -l /proc/self/fd 3</etc
total 0
lrwx------ 1 user group 64 May 30 11:16 0 -> /dev/pts/N
lrwx------ 1 user group 64 May 30 11:16 1 -> /dev/pts/N
lrwx------ 1 user group 64 May 30 11:16 2 -> /dev/pts/N
lr-x------ 1 user group 64 May 30 11:16 3 -> /etc/
lr-x------ 1 user group 64 May 30 11:16 4 -> /proc/NNNN/fd/