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-next>] [day] [month] [year] [list]
Message-ID: <20120724181209.GA10534@zod.bos.redhat.com>
Date:	Tue, 24 Jul 2012 14:12:10 -0400
From:	Josh Boyer <jwboyer@...hat.com>
To:	Linus Torvalds <torvalds@...ux-foundation.org>,
	Andrew Morton <akpm@...ux-foundation.org>
Cc:	law@...hat.com, linux-kernel@...r.kernel.org
Subject: [PATCH] posix_types.h: make __NFDBITS match glibc definition

Recent glibc made a change to suppress sign-conversion warnings from FD_SET
(glibc commit ceb9e56b3d1).  That patch solved the particular error it was
aiming to, however applications that #include <linux/types.h> after
including <sys/select.h> can now hit a build failure if -Werror=sign-compare
and -D_FORTIFY_SOURCE=2 is passed to gcc.  This can be seen when building
this trivial application against a recent enough glibc:

| #include <sys/select.h>
| #include <linux/types.h>
|
| int main(int argc, char **argv)
| {
|   fd_set fds;
|   FD_ZERO(&fds);
|   FD_SET(0, &fds);
|   return FD_ISSET(0, &fds);
| }

It was suggested the kernel should either match the glibc definition of
__NFDBITS in linux/posix_types.h or remove it entirely.  Given that we
don't know what applications may be relying on the header having a
definition, we opt for the former.

This resolves https://bugzilla.redhat.com/show_bug.cgi?id=837641

Reported-by: Jeff Law <law@...hat.com>
Signed-off-by: Josh Boyer <jwboyer@...hat.com>
---
 include/linux/posix_types.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/posix_types.h b/include/linux/posix_types.h
index f04c98c..cc8530e 100644
--- a/include/linux/posix_types.h
+++ b/include/linux/posix_types.h
@@ -19,7 +19,7 @@
  * use the ones here. 
  */
 #undef __NFDBITS
-#define __NFDBITS	(8 * sizeof(unsigned long))
+#define __NFDBITS	(8 * (int) sizeof(long int))
 
 #undef __FD_SETSIZE
 #define __FD_SETSIZE	1024
-- 
1.7.10.4

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