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] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.2.01.0905111220270.3586@localhost.localdomain>
Date:	Mon, 11 May 2009 12:26:59 -0700 (PDT)
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	Al Viro <viro@...IV.linux.org.uk>
cc:	Jeff Mahoney <jeffm@...e.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Al Viro <viro@....linux.org.uk>
Subject: Re: [PATCH] dup2: Fix return value with oldfd == newfd and invalid
 fd



On Mon, 11 May 2009, Al Viro wrote:
> 
> I'm not sure that it's a right fix, actually.  Note that userland declaration
> of that sucker is int dup2(int, int); so should we really take unsigned int
> as arguments?

Hmm. They've been "unsigned int" for as long as our history goes back 
(including BK), but yes, making them "int" would have hidden this issue as 
well. 

That said, I think we had reasons to do our fd's as unsigned, ie the whole 
"compare against MAX" thing that doesn't take negative values into 
account.

In fact, I think we should do more of those. Right now we literally depend 
on things like "max_fds" being "unsigned int", and that the compiler then 
turns all the

	if (fd < fdt->max_fds)

tests silently into unsigned tests even when 'fd' is 'int'.

So I suspect we should probably make fs/file.c use _more_ "unsigned int" 
rather than having less of them.

			Linus
--
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