lkml.org 
[lkml]   [1999]   [Feb]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [linux-security] When a shell says no (clobber) it means maybe.
If you mean noclobber as in bash's "set -o noclobber",
then it only applies to shell redirection (try: help set)

Antonomasia wrote:
>
> As will be seen from these code fragments (and experiment) a noclobber
> option in bash or pdksh (or ksh on AIX) will do limited clobbers.
>
> 1) They will clobber named pipes.
> (mknod /tmp/predicted p
> cat /tmp/predicted > $stolen
> cat $switched > /tmp/predicted ) &

What are the values of $stolen & $switched?
FIFO named pipes is not a real file, they do
not contain any data, so to clobber or not to clobber
is not a question.

But there is an interesting behaviour of pipes (I have
no other unix box I can try, but linux 2.0.36 & 2.2.2pre2)

1 $ mkfifo fifo
2 $ echo "blah" > fifo &
3 $ cat fifo > fifo &
4 $ cat fifo #if this does not exit after "blah" string is read
press ctrl-C, line #2 should exit.
5 $ echo "blah again" > fifo # this should return immediately

and BOOM! Job line #3 will loop with 90-99% CPU usage time.
Note this doesn't not happen if you skip line #2 (and/or #4).

Could someone with access to other Unix flavour check
this one out...

> 2) They will clobber symlinks.
> ln -s /some/new/target /tmp/predicted
>
> 3) They can be raced.
> mkdir /tmp/predicted
> echo "hoping stat() happens now: returns 0 and non S_ISREG"
> mv /tmp/predicted /tmp/other
> ln -s /some/old/target /tmp/predicted

These commands does not involve any shell redirection...

--
+---| Netscape Communicator 4.x |---| Powered by Linux 2.1.x |---+
|/v\ Agus Budy Wuysang MIS Department |
| | Phone: +62-21-344-1316 ext 317 GSM: +62-816-1972-051 |
+--------| http://www.rad.net.id/users/personal/s/supes |--------+
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/IT dx s: a- C+++ UL++++$ P- L+++(++++) E--- W++ N+++ o? K? w-- O-
M- V-- PS+ PE Y-- PGP t+@ 5 X+ R- tv- b+ DI? D++(+) G e++ h* r+ y++
------END GEEK CODE BLOCK------

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:50    [W:0.028 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site