Re: Bug in set/gethostname.

Alan Cox (
Sun, 17 May 1998 23:07:31 +0100 (BST)

> It's not a security risk, and it's not a real problem as far as I can see.

It took my machine off the network when I accidentally set it at the same
time as a configure script I was running did it - an accident, a kernel

> Crap programs are _supposed_ to return crap.

So sethostname is a crap program, and uname and rpm and gnu autoconf and
yp and everything else that trusts gethostname,getdomainname to be right

> End even then you actually have to be root to get the bad behaviour. If
> you're root, you can do some _really_ bad things, so I don't see the point
> in changing this, adding code that sounds completely unnecessary unless
> you give a real-world example.

Wrong. Please follow the uname example. If Im running something trivial like
rpm --build something.spec or gnu configure and happen to need to set the
hostname on a live machine I could and will on odd occasions get a corrupted
hostname seen. Im a user not root, root just happened to set the hostname while
I was recording it.

> In short, give a better reason, because as it stands, this "bug" is not a
> bug, but just a case of "let's not add code to take care of a case we
> shouldn't care about anyway". It's a "bug" in the same sense as it's a
> "bug" that root can write to /dev/kmem and make the system unstable.

No its a bug as in its a _stupid_ long standing race condition in the kernel
thats going to take you 10 minutes to fix. if you want to be pedantic
look at the single unix spec

"string naming the current system"

thats what it says comes back in the sysname field. Not "normally the
string naming the current system but occasionally half of it and
some other random junk because Linux has a bug"

Im somewhat saddened by the tone of your reply. Even when I worked for 3com
I'd have been hard pressed to find someone with their head so far up their
arse that they'd be claiming that wasnt a bug.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to