From patchwork Mon Nov 11 14:01:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 290294 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8C0E42C00D1 for ; Tue, 12 Nov 2013 01:02:15 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:cc:date:message-id:mime-version:content-type; q=dns; s=default; b=jTOLLsCOrH7cOUqbDMuk8FqNeN3Bd/hroDq6fshGfEXwsusuon qyzl02GnpJYi6jEPK+Oq3xGgBRCbHSWQHv5LGyy+ZIXBwP0kb9iu+GCE+zMRd60m 5wlSgYDHwDkm2q9tsfzvhvp6fVailrqGKWEpZxDOq27UszgU4U6yw2noE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:cc:date:message-id:mime-version:content-type; s= default; bh=danL/Csqg7CiNRSH2+4lQCoKtvQ=; b=QgRHTva3zduyDebSOi0n H8sP2q96JkUEtDo7f+GULsmNqZ7SPudrRHPgZQFIJVzN0Smw32Roy5UQDQ5iB0nj OUoI57mGVxfaGObVVhLNEtQ50rQw26JAOe2PZc5L8cAAu5w+F0vNQP1xz9lhbjXr SrThGpQeQanMyb+a5gNd/0A= Received: (qmail 28690 invoked by alias); 11 Nov 2013 14:02:06 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 28677 invoked by uid 89); 11 Nov 2013 14:02:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.5 required=5.0 tests=AWL, BAYES_00, RDNS_NONE, SPF_HELO_PASS, URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from Unknown (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 11 Nov 2013 14:02:03 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rABE1tcv005064 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 11 Nov 2013 09:01:55 -0500 Received: from localhost (ovpn-113-46.phx2.redhat.com [10.3.113.46]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id rABE1ssn008246 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 11 Nov 2013 09:01:55 -0500 Received: by localhost (Postfix, from userid 1000) id 5053416503A; Mon, 11 Nov 2013 15:01:53 +0100 (CET) From: Dodji Seketeli To: Jakub Jelinek , Konstantin Serebryany Subject: [PATCH] Fix asan regtest failures c-c++-common/asan/{memcmp-1.c, strncpy-overflow-1.c} CC: GCC Patches X-URL: http://www.redhat.com Date: Mon, 11 Nov 2013 15:01:53 +0100 Message-ID: <87fvr39gvi.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Hello, Since a couple of days I am seeing failure on the tests above on my Fedora system. The errors look like: FAIL: c-c++-common/asan/memcmp-1.c -O0 output pattern test, is ================================================================= ==21832==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fff75df96f4 at pc 0x7f98ecbab68b bp 0x7fff75df96b0 sp 0x7fff75df95b8 READ of size 6 at 0x7fff75df96f4 thread T0 #0 0x7f98ecbab68a in __interceptor_memcmp /home/dodji/git/gcc/master/libsanitizer/asan/asan_interceptors.cc:295 (discriminator 7) #1 0x7f98ecbb6393 in __asan_report_error /home/dodji/git/gcc/master/libsanitizer/asan/asan_report.cc:774 (discriminator 9) #2 0x7f98ecbab6d0 in __interceptor_memcmp /home/dodji/git/gcc/master/libsanitizer/asan/asan_interceptors.cc:295 (discriminator 7) #3 0x400b0a in main /home/dodji/git/gcc/master/gcc/testsuite/c-c++-common/asan/memcmp-1.c:14 #4 0x3380821a04 in __libc_start_main ??:? #5 0x4007b8 in _start ??:? Address 0x7fff75df96f4 is located in stack of thread T0 at offset 36 in frame #0 0x40089f in main /home/dodji/git/gcc/master/gcc/testsuite/c-c++-common/asan/memcmp-1.c:11 [...] and FAIL: c-c++-common/asan/strncpy-overflow-1.c -O0 output pattern test, is ================================================================= ==30666==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000efd9 at pc 0x7f65c09fd8f9 bp 0x7fffd820d170 sp 0x7fffd820d0a0 WRITE of size 10 at 0x60200000efd9 thread T0 #0 0x7f65c09fd8f8 in __interceptor_strncpy /home/dodji/git/gcc/master/libsanitizer/asan/asan_interceptors.cc:509 (discriminator 7) #1 0x7f65c0a06393 in __asan_report_error /home/dodji/git/gcc/master/libsanitizer/asan/asan_report.cc:774 (discriminator 9) #2 0x7f65c09fd93e in __interceptor_strncpy /home/dodji/git/gcc/master/libsanitizer/asan/asan_interceptors.cc:509 (discriminator 7) #3 0x400a9c in main /home/dodji/git/gcc/master/gcc/testsuite/c-c++-common/asan/strncpy-overflow-1.c:11 #4 0x3380821a04 in __libc_start_main ??:? #5 0x400898 in _start ??:? 0x60200000efd9 is located 0 bytes to the right of 9-byte region [0x60200000efd0,0x60200000efd9) allocated by thread T0 here: #0 0x7f65c0a00cd9 in __interceptor_malloc /home/dodji/git/gcc/master/libsanitizer/asan/asan_malloc_linux.cc:72 (discriminator 9) #1 0x400a80 in main /home/dodji/git/gcc/master/gcc/testsuite/c-c++-common/asan/strncpy-overflow-1.c:10 [...] It turned out this is just due to the output emitted by the AddressSanitizer that has changed. The patch below just adapts the regexps of the above test to match the fact that a few new line patterns were inserted in the middle of the output. It also fixes what I think are typos namely, un-escaped ']' as in "\[something]". I believe the closing square bracket should be escaped as well (but well, how do I know about tcl really). Tested on x86_64-unknown-linux-gnu against trunk. gcc/testsuite/ChangeLog: * c-c++-common/asan/memcmp-1.c: Adapt the pattern for changed libsanitizer output. * c-c++-common/asan/strncpy-overflow-1.c: Likewise. --- gcc/testsuite/c-c++-common/asan/memcmp-1.c | 8 ++++++-- gcc/testsuite/c-c++-common/asan/strncpy-overflow-1.c | 9 +++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/gcc/testsuite/c-c++-common/asan/memcmp-1.c b/gcc/testsuite/c-c++-common/asan/memcmp-1.c index 03f32e9..9a62e33 100644 --- a/gcc/testsuite/c-c++-common/asan/memcmp-1.c +++ b/gcc/testsuite/c-c++-common/asan/memcmp-1.c @@ -16,5 +16,9 @@ main () } /* { dg-output "ERROR: AddressSanitizer: stack-buffer-overflow.*(\n|\r\n|\r)" } */ -/* { dg-output " #0 0x\[0-9a-f\]+ (in _*(interceptor_|)memcmp |\[(\])\[^\n\r]*(\n|\r\n|\r)" } */ -/* { dg-output " #1 0x\[0-9a-f\]+ (in _*main|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */ +/* { dg-output " #0 0x\[0-9a-f\]+ (in _*(interceptor_|)memcmp |\[(\])\[^\n\r\]*(\n|\r\n|\r)" } */ +/* { dg-output "(\[^\r\n\]*(\n|\r\n|\r))+" } */ +/* { dg-output " #\[0-9\]+ 0x\[0-9a-f\]+ in main"} */ +/* { dg-output "(\[^\r\n\]*(\n|\r\n|\r))+" } */ +/* { dg-output "Address 0x\[0-9a-f\] is located in stack of thread T0 at offset \[0-9\]+ in frame (\n|\r\n|\r)"} */ +/* { dg-output " #0 0x\[0-9a-f\]+ in main" } */ diff --git a/gcc/testsuite/c-c++-common/asan/strncpy-overflow-1.c b/gcc/testsuite/c-c++-common/asan/strncpy-overflow-1.c index 3ed9fd6..b1a4cda 100644 --- a/gcc/testsuite/c-c++-common/asan/strncpy-overflow-1.c +++ b/gcc/testsuite/c-c++-common/asan/strncpy-overflow-1.c @@ -13,9 +13,10 @@ int main(int argc, char **argv) { } /* { dg-output "WRITE of size \[0-9\]* at 0x\[0-9a-f\]+ thread T0\[^\n\r]*(\n|\r\n|\r)" } */ -/* { dg-output " #0 0x\[0-9a-f\]+ (in _*(interceptor_|)strncpy|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */ -/* { dg-output " #1 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*strncpy-overflow-1.c:11|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */ -/* { dg-output "\[^\n\r]*0x\[0-9a-f\]+ is located 0 bytes to the right of 9-byte region\[^\n\r]*(\n|\r\n|\r)" } */ +/* { dg-output " #0 0x\[0-9a-f\]+ (in _*(interceptor_|)strncpy|\[(\])\[^\n\r\]*(\n|\r\n|\r)" } */ +/* { dg-output "(\[^\r\n\]*(\n|\r\n|\r))+" } */ +/* { dg-output " #\[0-9\]+ 0x\[0-9a-f\]+ in main"} */ +/* { dg-output "\[^\n\r\]*0x\[0-9a-f\]+ is located 0 bytes to the right of 9-byte region\[^\n\r]*(\n|\r\n|\r)" } */ /* { dg-output "\[^\n\r]*allocated by thread T0 here:\[^\n\r]*(\n|\r\n|\r)" } */ /* { dg-output " #0 0x\[0-9a-f\]+ (in _*(interceptor_|)malloc|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */ -/* { dg-output " #1 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*strncpy-overflow-1.c:10|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */ +/* { dg-output " #1 0x\[0-9a-f\]+ (in main (\[^\n\r\]*strncpy-overflow-1.c:10|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */