public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v3 0/4] fix wrong program abort on __FD_ELT
@ 2013-04-12  5:33 KOSAKI Motohiro
  2013-04-12  5:34 ` [PATCH 3/4] tst-chk1: add fd_set dynamic allocation test KOSAKI Motohiro
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: KOSAKI Motohiro @ 2013-04-12  5:33 UTC (permalink / raw)
  To: libc-alpha, libc-ports

Changes from v2
 - rebase to latest tree
 - remove [PATCH 1/6] mips: fix abi sort order
 - merge libc.abilist updates into [PATCH 2/4] Reinstantiate fd range check if and only if defined

Currently, FD_SET, FD_CLR and FD_ISSET make program abort when
passing >__FD_SETSIZE value and _FORTIFY_SOURCE is greater than 0.

However it is wrong. Linux accept BSD style dynamic fd table allocations
likes below over 10 years. 

    http://netbsd.gw.com/cgi-bin/man-cgi?select++NetBSD-4.0

		   fd_set *fdsr;
                   int max = fd;

                   fdsr = (fd_set *)calloc(howmany(max+1, NFDBITS),
                       sizeof(fd_mask));
                   if (fdsr == NULL) {
                           ...
                           return (-1);
                   }
                   FD_SET(fd, fdsr);
                   n = select(max+1, fdsr, NULL, NULL, &tv);
                   ...
                   free(fdsr);

Moreover this technique is already in use multiple applications. And unfortunately, Ubuntu turn on _FORTIFY_SOURCE=2 by default and then user can hit this issue easily if bump up RLIMIT_NOFILE.

This patch series restrict fd argument check to only work when _STRICT_FD_SIZE_CHECK is set.

KOSAKI Motohiro (4):
  __fdelt_chk: Removed range check
  Reinstantiate fd range check if and only if defined
    _STRICT_FD_SIZE_CHECK=1
  tst-chk1: add fd_set dynamic allocation test
  __FDS_BITS: Added cast to __fd_mask* to avoid warning.

 ChangeLog                                          |   41 ++++++++++++++++++++
 debug/Makefile                                     |    8 +++-
 debug/Versions                                     |    3 +
 debug/fdelt_chk.c                                  |   12 +++++-
 debug/tst-chk1.c                                   |   31 +++++++++++++-
 debug/tst-chk7.c                                   |    3 +
 debug/tst-lfschk7.c                                |    2 +
 misc/bits/select2.h                                |    8 ++--
 misc/sys/select.h                                  |    6 +-
 ports/ChangeLog.aarch64                            |    5 ++
 ports/ChangeLog.alpha                              |    5 ++
 ports/ChangeLog.arm                                |    5 ++
 ports/ChangeLog.ia64                               |    5 ++
 ports/ChangeLog.m68k                               |    7 +++
 ports/ChangeLog.mips                               |    8 ++++
 ports/ChangeLog.powerpc                            |    5 ++
 ports/ChangeLog.tile                               |    9 ++++
 .../unix/sysv/linux/aarch64/nptl/libc.abilist      |    2 +
 .../unix/sysv/linux/alpha/nptl/libc.abilist        |    2 +
 .../sysdeps/unix/sysv/linux/arm/nptl/libc.abilist  |    2 +
 .../sysdeps/unix/sysv/linux/ia64/nptl/libc.abilist |    2 +
 .../sysv/linux/m68k/coldfire/nptl/libc.abilist     |    2 +
 .../unix/sysv/linux/m68k/m680x0/nptl/libc.abilist  |    2 +
 .../unix/sysv/linux/mips/mips32/nptl/libc.abilist  |    2 +
 .../sysv/linux/mips/mips64/n32/nptl/libc.abilist   |    2 +
 .../sysv/linux/mips/mips64/n64/nptl/libc.abilist   |    2 +
 .../powerpc/powerpc32/nofpu/nptl/libc.abilist      |    2 +
 .../linux/tile/tilegx/tilegx32/nptl/libc.abilist   |    2 +
 .../linux/tile/tilegx/tilegx64/nptl/libc.abilist   |    2 +
 .../unix/sysv/linux/tile/tilepro/nptl/libc.abilist |    2 +
 sysdeps/unix/sysv/linux/i386/nptl/libc.abilist     |    2 +
 .../linux/powerpc/powerpc32/fpu/nptl/libc.abilist  |    2 +
 .../sysv/linux/powerpc/powerpc64/nptl/libc.abilist |    2 +
 .../unix/sysv/linux/s390/s390-32/nptl/libc.abilist |    2 +
 .../unix/sysv/linux/s390/s390-64/nptl/libc.abilist |    2 +
 sysdeps/unix/sysv/linux/sh/nptl/libc.abilist       |    2 +
 .../sysv/linux/sparc/sparc32/nptl/libc.abilist     |    2 +
 .../sysv/linux/sparc/sparc64/nptl/libc.abilist     |    2 +
 .../unix/sysv/linux/x86_64/64/nptl/libc.abilist    |    2 +
 .../unix/sysv/linux/x86_64/x32/nptl/libc.abilist   |    2 +
 40 files changed, 195 insertions(+), 14 deletions(-)
 create mode 100644 debug/tst-chk7.c
 create mode 100644 debug/tst-lfschk7.c

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 3/4] tst-chk1: add fd_set dynamic allocation test
  2013-04-12  5:33 [PATCH v3 0/4] fix wrong program abort on __FD_ELT KOSAKI Motohiro
@ 2013-04-12  5:34 ` KOSAKI Motohiro
  2013-04-12  5:34 ` [PATCH 2/4] Reinstantiate fd range check if and only if defined _STRICT_FD_SIZE_CHECK=1 KOSAKI Motohiro
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: KOSAKI Motohiro @ 2013-04-12  5:34 UTC (permalink / raw)
  To: libc-alpha, libc-ports; +Cc: KOSAKI Motohiro

---
 ChangeLog        |    5 +++++
 debug/tst-chk1.c |   25 +++++++++++++++++++++++++
 2 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0ca0a47..4b80b8b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,11 @@
 	* debug/tst-lfschk7.c: Likewise.
 	* debug/Makefile: Added tst-chk7.c and tst-lfschk7.c.
 
+	* debug/tst-chk1.c (do_test): Added tests for fd_set allocation
+	from heap.
+
+2013-03-29  KOSAKI Motohiro  <kosaki.motohiro@gmail.com>
+
 	* sysdeps/unix/sysv/linux/i386/nptl/libc.abilist:
 	Add __fdelt_check and __fdelt_check_warn.
 	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist:
diff --git a/debug/tst-chk1.c b/debug/tst-chk1.c
index 4ca0596..54016c5 100644
--- a/debug/tst-chk1.c
+++ b/debug/tst-chk1.c
@@ -1451,6 +1451,7 @@ do_test (void)
 #endif
 
   fd_set s;
+  fd_set *pfdset;
   FD_ZERO (&s);
   FD_SET (FD_SETSIZE - 1, &s);
 #if __USE_FORTIFY_LEVEL >= 1 && _STRICT_FD_SIZE_CHECK >= 1
@@ -1458,18 +1459,42 @@ do_test (void)
   FD_SET (FD_SETSIZE, &s);
   CHK_FAIL_END
 #endif
+#if __USE_FORTIFY_LEVEL >= 1 && !(_STRICT_FD_SIZE_CHECK >= 1)
+  pfdset = (fd_set*)calloc(howmany(FD_SETSIZE+1, NFDBITS), sizeof(fd_mask));
+  if (pfdset == NULL) {
+    printf("malloc failed %m\n");
+    return 1;
+  }
+  FD_SET (FD_SETSIZE, pfdset);
+#endif
   FD_CLR (FD_SETSIZE - 1, &s);
 #if __USE_FORTIFY_LEVEL >= 1 && _STRICT_FD_SIZE_CHECK >= 1
   CHK_FAIL_START
   FD_CLR (FD_SETSIZE, &s);
   CHK_FAIL_END
 #endif
+#if __USE_FORTIFY_LEVEL >= 1 && !(_STRICT_FD_SIZE_CHECK >= 1)
+  pfdset = (fd_set*)calloc(howmany(FD_SETSIZE+1, NFDBITS), sizeof(fd_mask));
+  if (pfdset == NULL) {
+    printf("malloc failed %m\n");
+    return 1;
+  }
+  FD_CLR (FD_SETSIZE, pfdset);
+#endif
   FD_ISSET (FD_SETSIZE - 1, &s);
 #if __USE_FORTIFY_LEVEL >= 1 && _STRICT_FD_SIZE_CHECK >= 1
   CHK_FAIL_START
   FD_ISSET (FD_SETSIZE, &s);
   CHK_FAIL_END
 #endif
+#if __USE_FORTIFY_LEVEL >= 1 && !(_STRICT_FD_SIZE_CHECK >= 1)
+  pfdset = (fd_set*)calloc(howmany(FD_SETSIZE+1, NFDBITS), sizeof(fd_mask));
+  if (pfdset == NULL) {
+    printf("malloc failed %m\n");
+    return 1;
+  }
+  FD_ISSET (FD_SETSIZE, pfdset);
+#endif
 
   struct pollfd fds[1];
   fds[0].fd = STDOUT_FILENO;
-- 
1.7.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/4] __fdelt_chk: Removed range check
  2013-04-12  5:33 [PATCH v3 0/4] fix wrong program abort on __FD_ELT KOSAKI Motohiro
                   ` (2 preceding siblings ...)
  2013-04-12  5:34 ` [PATCH 4/4] __FDS_BITS: Added cast to __fd_mask* to avoid warning KOSAKI Motohiro
@ 2013-04-12  5:34 ` KOSAKI Motohiro
  2013-04-12  7:42   ` Florian Weimer
  3 siblings, 1 reply; 8+ messages in thread
From: KOSAKI Motohiro @ 2013-04-12  5:34 UTC (permalink / raw)
  To: libc-alpha, libc-ports; +Cc: KOSAKI Motohiro

Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
---
 ChangeLog         |    5 +++++
 debug/fdelt_chk.c |    8 +++-----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 36efa0b..5311919 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-03-25  KOSAKI Motohiro  <kosaki.motohiro@gmail.com>
+
+	* debug/fdelt_chk.c (__fdelt_chk): Removed range check
+	and renamed to __fdelt_nochk.
+
 2013-04-11  Carlos O'Donell  <carlos@redhat.com>
 
 	* math/libm-test.inc (cos_test): Fix PI/2 test.
diff --git a/debug/fdelt_chk.c b/debug/fdelt_chk.c
index d149476..6588be0 100644
--- a/debug/fdelt_chk.c
+++ b/debug/fdelt_chk.c
@@ -19,11 +19,9 @@
 
 
 long int
-__fdelt_chk (long int d)
+__fdelt_nochk (long int d)
 {
-  if (d < 0 || d >= FD_SETSIZE)
-    __chk_fail ();
-
   return d / __NFDBITS;
 }
-strong_alias (__fdelt_chk, __fdelt_warn)
+strong_alias (__fdelt_nochk, __fdelt_chk)
+strong_alias (__fdelt_nochk, __fdelt_warn)
-- 
1.7.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/4] Reinstantiate fd range check if and only if defined _STRICT_FD_SIZE_CHECK=1
  2013-04-12  5:33 [PATCH v3 0/4] fix wrong program abort on __FD_ELT KOSAKI Motohiro
  2013-04-12  5:34 ` [PATCH 3/4] tst-chk1: add fd_set dynamic allocation test KOSAKI Motohiro
@ 2013-04-12  5:34 ` KOSAKI Motohiro
  2013-04-12  5:34 ` [PATCH 4/4] __FDS_BITS: Added cast to __fd_mask* to avoid warning KOSAKI Motohiro
  2013-04-12  5:34 ` [PATCH 1/4] __fdelt_chk: Removed range check KOSAKI Motohiro
  3 siblings, 0 replies; 8+ messages in thread
From: KOSAKI Motohiro @ 2013-04-12  5:34 UTC (permalink / raw)
  To: libc-alpha, libc-ports; +Cc: KOSAKI Motohiro

Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
---
 ChangeLog                                          |   26 ++++++++++++++++++++
 debug/Makefile                                     |    8 ++++-
 debug/Versions                                     |    3 ++
 debug/fdelt_chk.c                                  |   10 +++++++
 debug/tst-chk1.c                                   |    6 ++--
 debug/tst-chk7.c                                   |    3 ++
 debug/tst-lfschk7.c                                |    2 +
 misc/bits/select2.h                                |    8 +++---
 misc/sys/select.h                                  |    2 +-
 ports/ChangeLog.aarch64                            |    5 ++++
 ports/ChangeLog.alpha                              |    5 ++++
 ports/ChangeLog.arm                                |    5 ++++
 ports/ChangeLog.ia64                               |    5 ++++
 ports/ChangeLog.m68k                               |    7 +++++
 ports/ChangeLog.mips                               |    8 ++++++
 ports/ChangeLog.powerpc                            |    5 ++++
 ports/ChangeLog.tile                               |    9 +++++++
 .../unix/sysv/linux/aarch64/nptl/libc.abilist      |    2 +
 .../unix/sysv/linux/alpha/nptl/libc.abilist        |    2 +
 .../sysdeps/unix/sysv/linux/arm/nptl/libc.abilist  |    2 +
 .../sysdeps/unix/sysv/linux/ia64/nptl/libc.abilist |    2 +
 .../sysv/linux/m68k/coldfire/nptl/libc.abilist     |    2 +
 .../unix/sysv/linux/m68k/m680x0/nptl/libc.abilist  |    2 +
 .../unix/sysv/linux/mips/mips32/nptl/libc.abilist  |    2 +
 .../sysv/linux/mips/mips64/n32/nptl/libc.abilist   |    2 +
 .../sysv/linux/mips/mips64/n64/nptl/libc.abilist   |    2 +
 .../powerpc/powerpc32/nofpu/nptl/libc.abilist      |    2 +
 .../linux/tile/tilegx/tilegx32/nptl/libc.abilist   |    2 +
 .../linux/tile/tilegx/tilegx64/nptl/libc.abilist   |    2 +
 .../unix/sysv/linux/tile/tilepro/nptl/libc.abilist |    2 +
 sysdeps/unix/sysv/linux/i386/nptl/libc.abilist     |    2 +
 .../linux/powerpc/powerpc32/fpu/nptl/libc.abilist  |    2 +
 .../sysv/linux/powerpc/powerpc64/nptl/libc.abilist |    2 +
 .../unix/sysv/linux/s390/s390-32/nptl/libc.abilist |    2 +
 .../unix/sysv/linux/s390/s390-64/nptl/libc.abilist |    2 +
 sysdeps/unix/sysv/linux/sh/nptl/libc.abilist       |    2 +
 .../sysv/linux/sparc/sparc32/nptl/libc.abilist     |    2 +
 .../sysv/linux/sparc/sparc64/nptl/libc.abilist     |    2 +
 .../unix/sysv/linux/x86_64/64/nptl/libc.abilist    |    2 +
 .../unix/sysv/linux/x86_64/x32/nptl/libc.abilist   |    2 +
 40 files changed, 153 insertions(+), 10 deletions(-)
 create mode 100644 debug/tst-chk7.c
 create mode 100644 debug/tst-lfschk7.c

diff --git a/ChangeLog b/ChangeLog
index 5311919..0ca0a47 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,31 @@
 2013-03-25  KOSAKI Motohiro  <kosaki.motohiro@gmail.com>
 
+	* debug/fdelt_chk.c (__fdelt_check): New.
+	* misc/bits/select2.h (__FD_ELT): Uses __fdelt_check and
+	__fdelt_check_warn instead of __fdelt_chk and __fdelt_warn.
+	* misc/sys/select.h: Added _STRICT_FD_SIZE_CHECK check.
+	* Versions.def: Added GLIBC_2.18
+	* debug/Versions: Added __fdelt_check and __fdelt_check_warn.
+	* debug/tst-chk1.c (do_test): Added _STRICT_FD_SIZE_CHECK check.
+	* debug/tst-chk7.c: New file for testing _STRICT_FD_SIZE_CHECK.
+	* debug/tst-lfschk7.c: Likewise.
+	* debug/Makefile: Added tst-chk7.c and tst-lfschk7.c.
+
+	* sysdeps/unix/sysv/linux/i386/nptl/libc.abilist:
+	Add __fdelt_check and __fdelt_check_warn.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist:
+	Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libc.abilist: Likewise.
+	* sysdeps/unix/sysv/linux/s390/s390-32/nptl/libc.abilist: Likewise.
+	* sysdeps/unix/sysv/linux/s390/s390-64/nptl/libc.abilist: Likewise.
+	* sysdeps/unix/sysv/linux/sh/nptl/libc.abilist: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libc.abilist: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libc.abilist: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/64/nptl/libc.abilist: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/x32/nptl/libc.abilist: Likewise
+
+2013-03-25  KOSAKI Motohiro  <kosaki.motohiro@gmail.com>
+
 	* debug/fdelt_chk.c (__fdelt_chk): Removed range check
 	and renamed to __fdelt_nochk.
 
diff --git a/debug/Makefile b/debug/Makefile
index 55017d3..f336511 100644
--- a/debug/Makefile
+++ b/debug/Makefile
@@ -96,24 +96,28 @@ CFLAGS-tst-chk3.c = -Wno-format
 CFLAGS-tst-chk4.cc = -Wno-format
 CFLAGS-tst-chk5.cc = -Wno-format
 CFLAGS-tst-chk6.cc = -Wno-format
+CFLAGS-tst-chk7.c = -Wno-format
 CFLAGS-tst-lfschk1.c = -Wno-format
 CFLAGS-tst-lfschk2.c = -Wno-format
 CFLAGS-tst-lfschk3.c = -Wno-format
 CFLAGS-tst-lfschk4.cc = -Wno-format
 CFLAGS-tst-lfschk5.cc = -Wno-format
 CFLAGS-tst-lfschk6.cc = -Wno-format
+CFLAGS-tst-lfschk7.c = -Wno-format
 tst-chk1-ENV = LOCPATH=$(common-objpfx)localedata
 tst-chk2-ENV = LOCPATH=$(common-objpfx)localedata
 tst-chk3-ENV = LOCPATH=$(common-objpfx)localedata
 tst-chk4-ENV = LOCPATH=$(common-objpfx)localedata
 tst-chk5-ENV = LOCPATH=$(common-objpfx)localedata
 tst-chk6-ENV = LOCPATH=$(common-objpfx)localedata
+tst-chk7-ENV = LOCPATH=$(common-objpfx)localedata
 tst-lfschk1-ENV = LOCPATH=$(common-objpfx)localedata
 tst-lfschk2-ENV = LOCPATH=$(common-objpfx)localedata
 tst-lfschk3-ENV = LOCPATH=$(common-objpfx)localedata
 tst-lfschk4-ENV = LOCPATH=$(common-objpfx)localedata
 tst-lfschk5-ENV = LOCPATH=$(common-objpfx)localedata
 tst-lfschk6-ENV = LOCPATH=$(common-objpfx)localedata
+tst-lfschk7-ENV = LOCPATH=$(common-objpfx)localedata
 LDLIBS-tst-chk4 = -lstdc++
 LDLIBS-tst-chk5 = -lstdc++
 LDLIBS-tst-chk6 = -lstdc++
@@ -135,8 +139,8 @@ LDFLAGS-tst-backtrace5 = -rdynamic
 tests = backtrace-tst tst-longjmp_chk tst-chk1 tst-chk2 tst-chk3 \
 	tst-lfschk1 tst-lfschk2 tst-lfschk3 test-strcpy_chk test-stpcpy_chk \
 	tst-chk4 tst-chk5 tst-chk6 tst-lfschk4 tst-lfschk5 tst-lfschk6 \
-	tst-longjmp_chk2 tst-backtrace2 tst-backtrace3 tst-backtrace4 \
-	tst-backtrace5
+	tst-chk7 tst-lfschk7 tst-longjmp_chk2 tst-backtrace2 tst-backtrace3 \
+	tst-backtrace4 tst-backtrace5
 
 tests-ifunc := $(stpcpy_chk strcpy_chk:%=test-%-ifunc)
 tests += $(tests-ifunc)
diff --git a/debug/Versions b/debug/Versions
index c1722fa..9d7f097 100644
--- a/debug/Versions
+++ b/debug/Versions
@@ -55,6 +55,9 @@ libc {
   GLIBC_2.16 {
     __poll_chk; __ppoll_chk;
   }
+  GLIBC_2.18 {
+    __fdelt_check; __fdelt_check_warn;
+  }
   GLIBC_PRIVATE {
     __fortify_fail;
   }
diff --git a/debug/fdelt_chk.c b/debug/fdelt_chk.c
index 6588be0..67ab87e 100644
--- a/debug/fdelt_chk.c
+++ b/debug/fdelt_chk.c
@@ -25,3 +25,13 @@ __fdelt_nochk (long int d)
 }
 strong_alias (__fdelt_nochk, __fdelt_chk)
 strong_alias (__fdelt_nochk, __fdelt_warn)
+
+long int
+__fdelt_check (long int d)
+{
+  if (d < 0 || d >= FD_SETSIZE)
+    __chk_fail ();
+
+  return d / __NFDBITS;
+}
+strong_alias (__fdelt_check, __fdelt_check_warn)
diff --git a/debug/tst-chk1.c b/debug/tst-chk1.c
index 6ca8d9d..4ca0596 100644
--- a/debug/tst-chk1.c
+++ b/debug/tst-chk1.c
@@ -1453,19 +1453,19 @@ do_test (void)
   fd_set s;
   FD_ZERO (&s);
   FD_SET (FD_SETSIZE - 1, &s);
-#if __USE_FORTIFY_LEVEL >= 1
+#if __USE_FORTIFY_LEVEL >= 1 && _STRICT_FD_SIZE_CHECK >= 1
   CHK_FAIL_START
   FD_SET (FD_SETSIZE, &s);
   CHK_FAIL_END
 #endif
   FD_CLR (FD_SETSIZE - 1, &s);
-#if __USE_FORTIFY_LEVEL >= 1
+#if __USE_FORTIFY_LEVEL >= 1 && _STRICT_FD_SIZE_CHECK >= 1
   CHK_FAIL_START
   FD_CLR (FD_SETSIZE, &s);
   CHK_FAIL_END
 #endif
   FD_ISSET (FD_SETSIZE - 1, &s);
-#if __USE_FORTIFY_LEVEL >= 1
+#if __USE_FORTIFY_LEVEL >= 1 && _STRICT_FD_SIZE_CHECK >= 1
   CHK_FAIL_START
   FD_ISSET (FD_SETSIZE, &s);
   CHK_FAIL_END
diff --git a/debug/tst-chk7.c b/debug/tst-chk7.c
new file mode 100644
index 0000000..9ef58f3
--- /dev/null
+++ b/debug/tst-chk7.c
@@ -0,0 +1,3 @@
+#define _FORTIFY_SOURCE 1
+#define _STRICT_FD_SIZE_CHECK 1
+#include "tst-chk1.c"
diff --git a/debug/tst-lfschk7.c b/debug/tst-lfschk7.c
new file mode 100644
index 0000000..14cc1fb
--- /dev/null
+++ b/debug/tst-lfschk7.c
@@ -0,0 +1,2 @@
+#define _FILE_OFFSET_BITS 64
+#include "tst-chk7.c"
diff --git a/misc/bits/select2.h b/misc/bits/select2.h
index 03558c9..27ad3c3 100644
--- a/misc/bits/select2.h
+++ b/misc/bits/select2.h
@@ -21,8 +21,8 @@
 #endif
 
 /* Helper functions to issue warnings and errors when needed.  */
-extern long int __fdelt_chk (long int __d);
-extern long int __fdelt_warn (long int __d)
+extern long int __fdelt_check (long int __d);
+extern long int __fdelt_check_warn (long int __d)
   __warnattr ("bit outside of fd_set selected");
 #undef __FD_ELT
 #define	__FD_ELT(d) \
@@ -31,5 +31,5 @@ extern long int __fdelt_warn (long int __d)
      (__builtin_constant_p (__d)					    \
       ? (0 <= __d && __d < __FD_SETSIZE					    \
 	 ? (__d / __NFDBITS)						    \
-	 : __fdelt_warn (__d))						    \
-      : __fdelt_chk (__d)); })
+	 : __fdelt_check_warn (__d))					    \
+      : __fdelt_check (__d)); })
diff --git a/misc/sys/select.h b/misc/sys/select.h
index 21351fe..6a6dce6 100644
--- a/misc/sys/select.h
+++ b/misc/sys/select.h
@@ -124,7 +124,7 @@ extern int pselect (int __nfds, fd_set *__restrict __readfds,
 
 
 /* Define some inlines helping to catch common problems.  */
-#if __USE_FORTIFY_LEVEL > 0 && defined __GNUC__
+#if __USE_FORTIFY_LEVEL > 0 && defined __GNUC__ && _STRICT_FD_SIZE_CHECK > 0
 # include <bits/select2.h>
 #endif
 
diff --git a/ports/ChangeLog.aarch64 b/ports/ChangeLog.aarch64
index f01388f..36af4af 100644
--- a/ports/ChangeLog.aarch64
+++ b/ports/ChangeLog.aarch64
@@ -1,3 +1,8 @@
+2013-03-29  KOSAKI Motohiro  <kosaki.motohiro@gmail.com>
+
+	* ports/sysdeps/unix/sysv/linux/aarch64/nptl/libc.abilist:
+	Add __fdelt_check and __fdelt_check_warn.
+
 2013-03-19  Andreas Schwab  <schwab@suse.de>
 
 	* sysdeps/unix/sysv/linux/aarch64/configure.in: Set
diff --git a/ports/ChangeLog.alpha b/ports/ChangeLog.alpha
index 9a77d27..5067164 100644
--- a/ports/ChangeLog.alpha
+++ b/ports/ChangeLog.alpha
@@ -1,3 +1,8 @@
+2013-03-29  KOSAKI Motohiro  <kosaki.motohiro@gmail.com>
+
+	* ports/sysdeps/unix/sysv/linux/alpha/nptl/libc.abilist:
+	Add __fdelt_check and __fdelt_check_warn.
+
 2013-03-06  Andreas Jaeger  <aj@suse.de>
 
 	* sysdeps/unix/sysv/linux/alpha/bits/mman.h (MAP_HUGE_MASK)
diff --git a/ports/ChangeLog.arm b/ports/ChangeLog.arm
index 355d980..ada5148 100644
--- a/ports/ChangeLog.arm
+++ b/ports/ChangeLog.arm
@@ -1,3 +1,8 @@
+2013-03-29  KOSAKI Motohiro  <kosaki.motohiro@gmail.com>
+
+	* ports/sysdeps/unix/sysv/linux/arm/nptl/libc.abilist:
+	Add __fdelt_check and __fdelt_check_warn.
+
 2013-03-26  Mans Rullgard  <mans@mansr.com>
 
 	* sysdeps/arm/preconfigure.in: Use "test" instead of [ ].
diff --git a/ports/ChangeLog.ia64 b/ports/ChangeLog.ia64
index 50b5604..d876356 100644
--- a/ports/ChangeLog.ia64
+++ b/ports/ChangeLog.ia64
@@ -1,3 +1,8 @@
+2013-03-29  KOSAKI Motohiro  <kosaki.motohiro@gmail.com>
+
+	* ports/sysdeps/unix/sysv/linux/ia64/nptl/libc.abilist:
+	Add __fdelt_check and __fdelt_check_warn.
+
 2013-03-12  Mike Frysinger  <vapier@gentoo.org>
 
 	* sysdeps/unix/sysv/linux/ia64/sysdep.h (INTERNAL_SYSCALL_DECL): Add
diff --git a/ports/ChangeLog.m68k b/ports/ChangeLog.m68k
index 16f3c75..8a6e52c 100644
--- a/ports/ChangeLog.m68k
+++ b/ports/ChangeLog.m68k
@@ -1,3 +1,10 @@
+2013-03-29  KOSAKI Motohiro  <kosaki.motohiro@gmail.com>
+
+	* ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libc.abilist:
+	Add __fdelt_check and __fdelt_check_warn.
+	* ports/sysdeps/unix/sysv/linux/m68k/m680x0/nptl/libc.abilist:
+	Likewise.
+
 2013-04-11  Andreas Schwab  <schwab@suse.de>
 
 	* sysdeps/m68k/m680x0/fpu/libm-test-ulps: Update
diff --git a/ports/ChangeLog.mips b/ports/ChangeLog.mips
index b221512..26bc179 100644
--- a/ports/ChangeLog.mips
+++ b/ports/ChangeLog.mips
@@ -1,3 +1,11 @@
+2013-03-29  KOSAKI Motohiro  <kosaki.motohiro@gmail.com>
+	* ports/sysdeps/unix/sysv/linux/mips/mips32/nptl/libc.abilist:
+	Add __fdelt_check and __fdelt_check_warn.
+	* ports/sysdeps/unix/sysv/linux/mips/mips64/n32/nptl/libc.abilist:
+	Likewise.
+	* ports/sysdeps/unix/sysv/linux/mips/mips64/n64/nptl/libc.abilist:
+	Likewise.
+
 2013-04-02  Thomas Schwinge  <thomas@codesourcery.com>
 
 	* sysdeps/mips/math_private.h: New file.
diff --git a/ports/ChangeLog.powerpc b/ports/ChangeLog.powerpc
index 2ba8e37..960af46 100644
--- a/ports/ChangeLog.powerpc
+++ b/ports/ChangeLog.powerpc
@@ -1,3 +1,8 @@
+2013-03-29  KOSAKI Motohiro  <kosaki.motohiro@gmail.com>
+
+	* ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist:
+	Add __fdelt_check and __fdelt_check_warn.
+
 2013-02-28  Joseph Myers  <joseph@codesourcery.com>
 
 	[BZ #13550]
diff --git a/ports/ChangeLog.tile b/ports/ChangeLog.tile
index f63bde4..93de274 100644
--- a/ports/ChangeLog.tile
+++ b/ports/ChangeLog.tile
@@ -1,3 +1,12 @@
+2013-03-29  KOSAKI Motohiro  <kosaki.motohiro@gmail.com>
+
+	* ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libc.abilist:
+	Add __fdelt_check and __fdelt_check_warn.
+	* ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libc.abilist:
+	Likewise.
+	* ports/sysdeps/unix/sysv/linux/tile/tilepro/nptl/libc.abilist:
+	Likewise.
+
 2013-03-11  Andreas Schwab  <schwab@suse.de>
 
 	[BZ #15234]
diff --git a/ports/sysdeps/unix/sysv/linux/aarch64/nptl/libc.abilist b/ports/sysdeps/unix/sysv/linux/aarch64/nptl/libc.abilist
index b04a761..6648ae7 100644
--- a/ports/sysdeps/unix/sysv/linux/aarch64/nptl/libc.abilist
+++ b/ports/sysdeps/unix/sysv/linux/aarch64/nptl/libc.abilist
@@ -2080,3 +2080,5 @@ GLIBC_2.17
 GLIBC_2.18
  GLIBC_2.18 A
  __cxa_thread_atexit_impl F
+ __fdelt_check F
+ __fdelt_check_warn F
diff --git a/ports/sysdeps/unix/sysv/linux/alpha/nptl/libc.abilist b/ports/sysdeps/unix/sysv/linux/alpha/nptl/libc.abilist
index 980e088..b9346dd 100644
--- a/ports/sysdeps/unix/sysv/linux/alpha/nptl/libc.abilist
+++ b/ports/sysdeps/unix/sysv/linux/alpha/nptl/libc.abilist
@@ -1822,6 +1822,8 @@ GLIBC_2.17
 GLIBC_2.18
  GLIBC_2.18 A
  __cxa_thread_atexit_impl F
+ __fdelt_check F
+ __fdelt_check_warn F
 GLIBC_2.2
  GLIBC_2.2 A
  _IO_adjust_wcolumn F
diff --git a/ports/sysdeps/unix/sysv/linux/arm/nptl/libc.abilist b/ports/sysdeps/unix/sysv/linux/arm/nptl/libc.abilist
index ce45208..03e4853 100644
--- a/ports/sysdeps/unix/sysv/linux/arm/nptl/libc.abilist
+++ b/ports/sysdeps/unix/sysv/linux/arm/nptl/libc.abilist
@@ -89,6 +89,8 @@ GLIBC_2.17
 GLIBC_2.18
  GLIBC_2.18 A
  __cxa_thread_atexit_impl F
+ __fdelt_check F
+ __fdelt_check_warn F
 GLIBC_2.4
  GLIBC_2.4 A
  _Exit F
diff --git a/ports/sysdeps/unix/sysv/linux/ia64/nptl/libc.abilist b/ports/sysdeps/unix/sysv/linux/ia64/nptl/libc.abilist
index 067552d..7005224 100644
--- a/ports/sysdeps/unix/sysv/linux/ia64/nptl/libc.abilist
+++ b/ports/sysdeps/unix/sysv/linux/ia64/nptl/libc.abilist
@@ -89,6 +89,8 @@ GLIBC_2.17
 GLIBC_2.18
  GLIBC_2.18 A
  __cxa_thread_atexit_impl F
+ __fdelt_check F
+ __fdelt_check_warn F
 GLIBC_2.2
  GLIBC_2.2 A
  _Exit F
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libc.abilist b/ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libc.abilist
index f06cc8e..06476e8 100644
--- a/ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libc.abilist
+++ b/ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libc.abilist
@@ -90,6 +90,8 @@ GLIBC_2.17
 GLIBC_2.18
  GLIBC_2.18 A
  __cxa_thread_atexit_impl F
+ __fdelt_check F
+ __fdelt_check_warn F
 GLIBC_2.4
  GLIBC_2.4 A
  _Exit F
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/m680x0/nptl/libc.abilist b/ports/sysdeps/unix/sysv/linux/m68k/m680x0/nptl/libc.abilist
index 9010ea7..424d2fb 100644
--- a/ports/sysdeps/unix/sysv/linux/m68k/m680x0/nptl/libc.abilist
+++ b/ports/sysdeps/unix/sysv/linux/m68k/m680x0/nptl/libc.abilist
@@ -1778,6 +1778,8 @@ GLIBC_2.17
 GLIBC_2.18
  GLIBC_2.18 A
  __cxa_thread_atexit_impl F
+ __fdelt_check F
+ __fdelt_check_warn F
 GLIBC_2.2
  GLIBC_2.2 A
  _IO_adjust_wcolumn F
diff --git a/ports/sysdeps/unix/sysv/linux/mips/mips32/nptl/libc.abilist b/ports/sysdeps/unix/sysv/linux/mips/mips32/nptl/libc.abilist
index f01278e..154f7d4 100644
--- a/ports/sysdeps/unix/sysv/linux/mips/mips32/nptl/libc.abilist
+++ b/ports/sysdeps/unix/sysv/linux/mips/mips32/nptl/libc.abilist
@@ -1403,6 +1403,8 @@ GLIBC_2.18
  __cxa_thread_atexit_impl F
  __mips_fpu_getcw F
  __mips_fpu_setcw F
+ __fdelt_check F
+ __fdelt_check_warn F
 GLIBC_2.2
  GLIBC_2.2 A
  _Exit F
diff --git a/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/nptl/libc.abilist b/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/nptl/libc.abilist
index 9dbbd97..0748b42 100644
--- a/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/nptl/libc.abilist
+++ b/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/nptl/libc.abilist
@@ -1401,6 +1401,8 @@ GLIBC_2.17
 GLIBC_2.18
  GLIBC_2.18 A
  __cxa_thread_atexit_impl F
+ __fdelt_check F
+ __fdelt_check_warn F
 GLIBC_2.2
  GLIBC_2.2 A
  _Exit F
diff --git a/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/nptl/libc.abilist b/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/nptl/libc.abilist
index c7e46aa..d9e69a6 100644
--- a/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/nptl/libc.abilist
+++ b/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/nptl/libc.abilist
@@ -1399,6 +1399,8 @@ GLIBC_2.17
 GLIBC_2.18
  GLIBC_2.18 A
  __cxa_thread_atexit_impl F
+ __fdelt_check F
+ __fdelt_check_warn F
 GLIBC_2.2
  GLIBC_2.2 A
  _Exit F
diff --git a/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist b/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist
index 9b6d663..c751016 100644
--- a/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist
+++ b/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libc.abilist
@@ -1784,6 +1784,8 @@ GLIBC_2.17
 GLIBC_2.18
  GLIBC_2.18 A
  __cxa_thread_atexit_impl F
+ __fdelt_check F
+ __fdelt_check_warn F
 GLIBC_2.2
  GLIBC_2.2 A
  _IO_adjust_wcolumn F
diff --git a/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libc.abilist b/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libc.abilist
index caf74b8..bbd53e7 100644
--- a/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libc.abilist
+++ b/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libc.abilist
@@ -2091,3 +2091,5 @@ GLIBC_2.17
 GLIBC_2.18
  GLIBC_2.18 A
  __cxa_thread_atexit_impl F
+ __fdelt_check F
+ __fdelt_check_warn F
diff --git a/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libc.abilist b/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libc.abilist
index 68d975b..a998243 100644
--- a/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libc.abilist
+++ b/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libc.abilist
@@ -2091,3 +2091,5 @@ GLIBC_2.17
 GLIBC_2.18
  GLIBC_2.18 A
  __cxa_thread_atexit_impl F
+ __fdelt_check F
+ __fdelt_check_warn F
diff --git a/ports/sysdeps/unix/sysv/linux/tile/tilepro/nptl/libc.abilist b/ports/sysdeps/unix/sysv/linux/tile/tilepro/nptl/libc.abilist
index caf74b8..bbd53e7 100644
--- a/ports/sysdeps/unix/sysv/linux/tile/tilepro/nptl/libc.abilist
+++ b/ports/sysdeps/unix/sysv/linux/tile/tilepro/nptl/libc.abilist
@@ -2091,3 +2091,5 @@ GLIBC_2.17
 GLIBC_2.18
  GLIBC_2.18 A
  __cxa_thread_atexit_impl F
+ __fdelt_check F
+ __fdelt_check_warn F
diff --git a/sysdeps/unix/sysv/linux/i386/nptl/libc.abilist b/sysdeps/unix/sysv/linux/i386/nptl/libc.abilist
index 3cb314d..4698cc7 100644
--- a/sysdeps/unix/sysv/linux/i386/nptl/libc.abilist
+++ b/sysdeps/unix/sysv/linux/i386/nptl/libc.abilist
@@ -1822,6 +1822,8 @@ GLIBC_2.17
 GLIBC_2.18
  GLIBC_2.18 A
  __cxa_thread_atexit_impl F
+ __fdelt_check F
+ __fdelt_check_warn F
 GLIBC_2.2
  GLIBC_2.2 A
  _IO_adjust_wcolumn F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist
index f27b48b..2fde0fc 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libc.abilist
@@ -1784,6 +1784,8 @@ GLIBC_2.17
 GLIBC_2.18
  GLIBC_2.18 A
  __cxa_thread_atexit_impl F
+ __fdelt_check F
+ __fdelt_check_warn F
 GLIBC_2.2
  GLIBC_2.2 A
  _IO_adjust_wcolumn F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libc.abilist
index 195b587..f569518 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libc.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libc.abilist
@@ -90,6 +90,8 @@ GLIBC_2.17
 GLIBC_2.18
  GLIBC_2.18 A
  __cxa_thread_atexit_impl F
+ __fdelt_check F
+ __fdelt_check_warn F
 GLIBC_2.3
  GLIBC_2.3 A
  _Exit F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libc.abilist
index b6256d5..7f3eb9d 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libc.abilist
@@ -1774,6 +1774,8 @@ GLIBC_2.17
 GLIBC_2.18
  GLIBC_2.18 A
  __cxa_thread_atexit_impl F
+ __fdelt_check F
+ __fdelt_check_warn F
 GLIBC_2.2
  GLIBC_2.2 A
  _IO_adjust_wcolumn F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libc.abilist
index 265f66d..22ce3fc 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libc.abilist
@@ -95,6 +95,8 @@ GLIBC_2.17
 GLIBC_2.18
  GLIBC_2.18 A
  __cxa_thread_atexit_impl F
+ __fdelt_check F
+ __fdelt_check_warn F
 GLIBC_2.2
  GLIBC_2.2 A
  _Exit F
diff --git a/sysdeps/unix/sysv/linux/sh/nptl/libc.abilist b/sysdeps/unix/sysv/linux/sh/nptl/libc.abilist
index a653292..cb915c1 100644
--- a/sysdeps/unix/sysv/linux/sh/nptl/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sh/nptl/libc.abilist
@@ -95,6 +95,8 @@ GLIBC_2.17
 GLIBC_2.18
  GLIBC_2.18 A
  __cxa_thread_atexit_impl F
+ __fdelt_check F
+ __fdelt_check_warn F
 GLIBC_2.2
  GLIBC_2.2 A
  _Exit F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libc.abilist
index 9defbdf..9bd44e1 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libc.abilist
@@ -1779,6 +1779,8 @@ GLIBC_2.17
 GLIBC_2.18
  GLIBC_2.18 A
  __cxa_thread_atexit_impl F
+ __fdelt_check F
+ __fdelt_check_warn F
 GLIBC_2.2
  GLIBC_2.2 A
  _IO_adjust_wcolumn F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libc.abilist
index 35987fa..3eb2570 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libc.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libc.abilist
@@ -100,6 +100,8 @@ GLIBC_2.17
 GLIBC_2.18
  GLIBC_2.18 A
  __cxa_thread_atexit_impl F
+ __fdelt_check F
+ __fdelt_check_warn F
 GLIBC_2.2
  GLIBC_2.2 A
  _Exit F
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/nptl/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/nptl/libc.abilist
index 914b590..8a6d04a 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/nptl/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/nptl/libc.abilist
@@ -91,6 +91,8 @@ GLIBC_2.17
 GLIBC_2.18
  GLIBC_2.18 A
  __cxa_thread_atexit_impl F
+ __fdelt_check F
+ __fdelt_check_warn F
 GLIBC_2.2.5
  GLIBC_2.2.5 A
  _Exit F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/nptl/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/nptl/libc.abilist
index 0f64c8d..8f9e270 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/nptl/libc.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/nptl/libc.abilist
@@ -2089,3 +2089,5 @@ GLIBC_2.17
 GLIBC_2.18
  GLIBC_2.18 A
  __cxa_thread_atexit_impl F
+ __fdelt_check F
+ __fdelt_check_warn F
-- 
1.7.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 4/4] __FDS_BITS: Added cast to __fd_mask* to avoid warning.
  2013-04-12  5:33 [PATCH v3 0/4] fix wrong program abort on __FD_ELT KOSAKI Motohiro
  2013-04-12  5:34 ` [PATCH 3/4] tst-chk1: add fd_set dynamic allocation test KOSAKI Motohiro
  2013-04-12  5:34 ` [PATCH 2/4] Reinstantiate fd range check if and only if defined _STRICT_FD_SIZE_CHECK=1 KOSAKI Motohiro
@ 2013-04-12  5:34 ` KOSAKI Motohiro
  2013-04-12  5:34 ` [PATCH 1/4] __fdelt_chk: Removed range check KOSAKI Motohiro
  3 siblings, 0 replies; 8+ messages in thread
From: KOSAKI Motohiro @ 2013-04-12  5:34 UTC (permalink / raw)
  To: libc-alpha, libc-ports; +Cc: KOSAKI Motohiro

---
 ChangeLog         |    5 +++++
 misc/sys/select.h |    4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4b80b8b..e0e945d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,11 @@
 	* debug/tst-lfschk7.c: Likewise.
 	* debug/Makefile: Added tst-chk7.c and tst-lfschk7.c.
 
+	* misc/sys/select.h (__FDS_BITS): Added a cast to
+	__fd_mask* to avoid warning.
+
+2013-03-29  KOSAKI Motohiro  <kosaki.motohiro@gmail.com>
+
 	* debug/tst-chk1.c (do_test): Added tests for fd_set allocation
 	from heap.
 
diff --git a/misc/sys/select.h b/misc/sys/select.h
index 6a6dce6..5d3f3cd 100644
--- a/misc/sys/select.h
+++ b/misc/sys/select.h
@@ -67,10 +67,10 @@ typedef struct
        from the global namespace.  */
 #ifdef __USE_XOPEN
     __fd_mask fds_bits[__FD_SETSIZE / __NFDBITS];
-# define __FDS_BITS(set) ((set)->fds_bits)
+# define __FDS_BITS(set) ((__fd_mask*)((set)->fds_bits))
 #else
     __fd_mask __fds_bits[__FD_SETSIZE / __NFDBITS];
-# define __FDS_BITS(set) ((set)->__fds_bits)
+# define __FDS_BITS(set) ((__fd_mask*)((set)->__fds_bits))
 #endif
   } fd_set;
 
-- 
1.7.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/4] __fdelt_chk: Removed range check
  2013-04-12  5:34 ` [PATCH 1/4] __fdelt_chk: Removed range check KOSAKI Motohiro
@ 2013-04-12  7:42   ` Florian Weimer
  2013-04-12 20:28     ` KOSAKI Motohiro
  0 siblings, 1 reply; 8+ messages in thread
From: Florian Weimer @ 2013-04-12  7:42 UTC (permalink / raw)
  To: KOSAKI Motohiro; +Cc: libc-alpha, libc-ports

On 04/12/2013 07:33 AM, KOSAKI Motohiro wrote:
> +strong_alias (__fdelt_nochk, __fdelt_chk)
> +strong_alias (__fdelt_nochk, __fdelt_warn)

This change (which disables checking for existing compiled binaries) 
seems the wrong thing to do to me.

I tend to agree that it might make sense to make fd_set fortification 
optional, but it should be enabled by default.  Could you please change 
your patch so that it performs the checking by default, and preserves 
checking for applications which were compiled against pre-2.18 versions?

By the way, if you see crashes with Qt, we have a patch which replaces 
select with poll (qt-4.8-poll.patch in Fedora).   We tried to upstream 
it, but no luck so far.

-- 
Florian Weimer / Red Hat Product Security Team

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/4] __fdelt_chk: Removed range check
  2013-04-12  7:42   ` Florian Weimer
@ 2013-04-12 20:28     ` KOSAKI Motohiro
  2013-04-14  0:40       ` KOSAKI Motohiro
  0 siblings, 1 reply; 8+ messages in thread
From: KOSAKI Motohiro @ 2013-04-12 20:28 UTC (permalink / raw)
  To: Florian Weimer; +Cc: libc-alpha, libc-ports

On Fri, Apr 12, 2013 at 3:42 AM, Florian Weimer <fweimer@redhat.com> wrote:
> On 04/12/2013 07:33 AM, KOSAKI Motohiro wrote:
>>
>> +strong_alias (__fdelt_nochk, __fdelt_chk)
>> +strong_alias (__fdelt_nochk, __fdelt_warn)
>
>
> This change (which disables checking for existing compiled binaries) seems
> the wrong thing to do to me.
>
> I tend to agree that it might make sense to make fd_set fortification
> optional, but it should be enabled by default.  Could you please change your
> patch so that it performs the checking by default, and preserves checking
> for applications which were compiled against pre-2.18 versions?

Could you clarify why you think so? Because I proposed exact same approach
at first and Carlos disagreed it because he pointed out an application
shouldn't
crash when post-2.18 application link with pre-2.18 libraries. Now I
agreed him and
then I changed my patch.

OK, I don't think it's impossible. However, I need to understand more.
At least Carlos
explained why and it seems reasonable request to me.


> By the way, if you see crashes with Qt, we have a patch which replaces
> select with poll (qt-4.8-poll.patch in Fedora).   We tried to upstream it,
> but no luck so far.

Thanks. That's definitely forward step. Even though I don't think
select() is only used from Qt.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/4] __fdelt_chk: Removed range check
  2013-04-12 20:28     ` KOSAKI Motohiro
@ 2013-04-14  0:40       ` KOSAKI Motohiro
  0 siblings, 0 replies; 8+ messages in thread
From: KOSAKI Motohiro @ 2013-04-14  0:40 UTC (permalink / raw)
  To: Florian Weimer; +Cc: libc-alpha, libc-ports, kosaki.motohiro

(4/12/13 1:28 PM), KOSAKI Motohiro wrote:
> On Fri, Apr 12, 2013 at 3:42 AM, Florian Weimer <fweimer@redhat.com> wrote:
>> On 04/12/2013 07:33 AM, KOSAKI Motohiro wrote:
>>>
>>> +strong_alias (__fdelt_nochk, __fdelt_chk)
>>> +strong_alias (__fdelt_nochk, __fdelt_warn)
>>
>>
>> This change (which disables checking for existing compiled binaries) seems
>> the wrong thing to do to me.
>>
>> I tend to agree that it might make sense to make fd_set fortification
>> optional, but it should be enabled by default.  Could you please change your
>> patch so that it performs the checking by default, and preserves checking
>> for applications which were compiled against pre-2.18 versions?
> 
> Could you clarify why you think so? Because I proposed exact same approach
> at first and Carlos disagreed it because he pointed out an application
> shouldn't
> crash when post-2.18 application link with pre-2.18 libraries. Now I
> agreed him and
> then I changed my patch.
> 
> OK, I don't think it's impossible. However, I need to understand more.
> At least Carlos
> explained why and it seems reasonable request to me.

After while thinking, I could implement better patch. I believe it fill you and
Carlos's request. Could you take a look next spin?

Thank you.




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-04-14  0:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-12  5:33 [PATCH v3 0/4] fix wrong program abort on __FD_ELT KOSAKI Motohiro
2013-04-12  5:34 ` [PATCH 3/4] tst-chk1: add fd_set dynamic allocation test KOSAKI Motohiro
2013-04-12  5:34 ` [PATCH 2/4] Reinstantiate fd range check if and only if defined _STRICT_FD_SIZE_CHECK=1 KOSAKI Motohiro
2013-04-12  5:34 ` [PATCH 4/4] __FDS_BITS: Added cast to __fd_mask* to avoid warning KOSAKI Motohiro
2013-04-12  5:34 ` [PATCH 1/4] __fdelt_chk: Removed range check KOSAKI Motohiro
2013-04-12  7:42   ` Florian Weimer
2013-04-12 20:28     ` KOSAKI Motohiro
2013-04-14  0:40       ` KOSAKI Motohiro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).