From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6878 invoked by alias); 12 Apr 2013 05:34:35 -0000 Mailing-List: contact libc-ports-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: libc-ports-owner@sourceware.org Received: (qmail 6830 invoked by uid 89); 12 Apr 2013 05:34:35 -0000 X-Spam-SWARE-Status: No, score=-5.7 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,TW_FD autolearn=ham version=3.3.1 X-Spam-User: qpsmtpd, 2 recipients Received: from mail-vb0-f42.google.com (HELO mail-vb0-f42.google.com) (209.85.212.42) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 12 Apr 2013 05:34:34 +0000 Received: by mail-vb0-f42.google.com with SMTP id p12so1879625vbe.1 for ; Thu, 11 Apr 2013 22:34:32 -0700 (PDT) X-Received: by 10.59.4.101 with SMTP id cd5mr7439264ved.14.1365744872266; Thu, 11 Apr 2013 22:34:32 -0700 (PDT) Received: from localhost.localdomain (pool-173-48-243-11.bstnma.fios.verizon.net. [173.48.243.11]) by mx.google.com with ESMTPS id bi15sm7308414vdc.6.2013.04.11.22.34.30 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 11 Apr 2013 22:34:30 -0700 (PDT) From: KOSAKI Motohiro To: libc-alpha@sourceware.org, libc-ports@sourceware.org Cc: KOSAKI Motohiro Subject: [PATCH 3/4] tst-chk1: add fd_set dynamic allocation test Date: Fri, 12 Apr 2013 05:34:00 -0000 Message-Id: <1365744803-19197-4-git-send-email-kosaki.motohiro@gmail.com> In-Reply-To: <1365744803-19197-1-git-send-email-kosaki.motohiro@gmail.com> References: <1365744803-19197-1-git-send-email-kosaki.motohiro@gmail.com> X-SW-Source: 2013-04/txt/msg00046.txt.bz2 --- 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 + * 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