{"id":808659,"url":"http://patchwork.ozlabs.org/api/1.2/patches/808659/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/20170901114804.GI2323@tucnak/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/1.2/projects/17/?format=json","name":"GNU Compiler Collection","link_name":"gcc","list_id":"gcc-patches.gcc.gnu.org","list_email":"gcc-patches@gcc.gnu.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170901114804.GI2323@tucnak>","list_archive_url":null,"date":"2017-09-01T11:48:04","name":"Fix asan create_odr_indicator (PR sanitizer/81923)","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"63024a482513d7ea8b20b5fdcf5c3a627ffbf821","submitter":{"id":671,"url":"http://patchwork.ozlabs.org/api/1.2/people/671/?format=json","name":"Jakub Jelinek","email":"jakub@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/20170901114804.GI2323@tucnak/mbox/","series":[{"id":1011,"url":"http://patchwork.ozlabs.org/api/1.2/series/1011/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=1011","date":"2017-09-01T11:48:04","name":"Fix asan create_odr_indicator (PR sanitizer/81923)","version":1,"mbox":"http://patchwork.ozlabs.org/series/1011/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/808659/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/808659/checks/","tags":{},"related":[],"headers":{"Return-Path":"<gcc-patches-return-461267-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-461267-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"msJkIwco\"; dkim-atps=neutral","sourceware.org; auth=none","ext-mx06.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx06.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=jakub@redhat.com"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xkHZH4ZYdz9sRV\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  1 Sep 2017 21:48:38 +1000 (AEST)","(qmail 128648 invoked by alias); 1 Sep 2017 11:48:27 -0000","(qmail 122497 invoked by uid 89); 1 Sep 2017 11:48:22 -0000","from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tFri, 01 Sep 2017 11:48:14 +0000","from smtp.corp.redhat.com\n\t(int-mx04.intmail.prod.int.phx2.redhat.com\n\t[10.5.11.14])\t(using TLSv1.2 with cipher AECDH-AES256-SHA\n\t(256/256 bits))\t(No client certificate requested)\tby\n\tmx1.redhat.com (Postfix) with ESMTPS id 7FE4F356CE;\n\tFri,  1 Sep 2017 11:48:08 +0000 (UTC)","from tucnak.zalov.cz (ovpn-116-33.ams2.redhat.com\n\t[10.36.116.33])\tby smtp.corp.redhat.com (Postfix) with ESMTPS\n\tid 168017B0C0; Fri,  1 Sep 2017 11:48:07 +0000 (UTC)","from tucnak.zalov.cz (localhost [127.0.0.1])\tby tucnak.zalov.cz\n\t(8.15.2/8.15.2) with ESMTP id v81Bm5cw007460;\n\tFri, 1 Sep 2017 13:48:06 +0200","(from jakub@localhost)\tby tucnak.zalov.cz (8.15.2/8.15.2/Submit)\n\tid v81Bm4gm007459; Fri, 1 Sep 2017 13:48:04 +0200"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:reply-to:mime-version\n\t:content-type; q=dns; s=default; b=Y1SqTVUAMAUguGWJkUjoYbR7npBB1\n\tq+rkRgKGWLzsPh+08m7lOpViwnvO2MyYHmOrhKZ8er/i8u0xTZ8okkf698zsjZIQ\n\tx//KSxB8B7LuJ4OYJzhzwCyUhDIf7Ry2AL9JM+A9Oy3+l4A55agM5Np4Ob6RPPHa\n\tHbQCR80/3TXslM=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:reply-to:mime-version\n\t:content-type; s=default; bh=knHHfiUa8cgwEgmry8b2WPlukiY=; b=msJ\n\tkIwcoWj+DpyI5XGD+PYvMEuJAdzE7yNwBHtZtlWAj5KmpuW0/ruJcoXjpuk++qMC\n\tMjWpHGnU3LN6RAL+sNHCSgwJGEHdlazMLMsq8uUOlKHzfv+eJcJ+xKmvsHUuXOUy\n\tv6zv5FKFGTYp+iAEXbg04kNWUE78qfriP6BshOnU=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-10.9 required=5.0 tests=BAYES_00, GIT_PATCH_2,\n\tGIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD,\n\tSPF_HELO_PASS autolearn=ham version=3.3.2\n\tspammy=Hx-languages-length:1758, theoretically","X-HELO":"mx1.redhat.com","DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 7FE4F356CE","Date":"Fri, 1 Sep 2017 13:48:04 +0200","From":"Jakub Jelinek <jakub@redhat.com>","To":"Richard Biener <rguenther@suse.de>","Cc":"gcc-patches@gcc.gnu.org","Subject":"[PATCH] Fix asan create_odr_indicator (PR sanitizer/81923)","Message-ID":"<20170901114804.GI2323@tucnak>","Reply-To":"Jakub Jelinek <jakub@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","User-Agent":"Mutt/1.7.1 (2016-10-04)","X-IsSubscribed":"yes"},"content":"Hi!\n\nglibc fails to build with -fsanitize=address, because DECL_ASSEMBLER_NAME\non some variables starts with the * character (e.g. for vars with __asm\nspecified names).  We need to strip name encoding from those before\nappending after __odr_asan. Fixed thusly, bootstrapped/regtested on\nx86_64-linux and i686-linux, ok for trunk?\n\n2017-09-01  Jakub Jelinek  <jakub@redhat.com>\n\n\tPR sanitizer/81923\n\t* asan.c (create_odr_indicator): Strip name encoding from assembler\n\tname before appending it after __odr_asan_.\n\n\t* gcc.dg/asan/pr81923.c: New test.\n\n\n\tJakub","diff":"--- gcc/asan.c.jj\t2017-08-10 02:31:21.000000000 +0200\n+++ gcc/asan.c\t2017-08-29 17:25:58.337595628 +0200\n@@ -2529,9 +2529,12 @@ create_odr_indicator (tree decl, tree ty\n   /* DECL_NAME theoretically might be NULL.  Bail out with 0 in this case.  */\n   if (decl_name == NULL_TREE)\n     return build_int_cst (uptr, 0);\n-  size_t len = strlen (IDENTIFIER_POINTER (decl_name)) + sizeof (\"__odr_asan_\");\n+  const char *dname = IDENTIFIER_POINTER (decl_name);\n+  if (HAS_DECL_ASSEMBLER_NAME_P (decl))\n+    dname = targetm.strip_name_encoding (dname);\n+  size_t len = strlen (dname) + sizeof (\"__odr_asan_\");\n   name = XALLOCAVEC (char, len);\n-  snprintf (name, len, \"__odr_asan_%s\", IDENTIFIER_POINTER (decl_name));\n+  snprintf (name, len, \"__odr_asan_%s\", dname);\n #ifndef NO_DOT_IN_LABEL\n   name[sizeof (\"__odr_asan\") - 1] = '.';\n #elif !defined(NO_DOLLAR_IN_LABEL)\n--- gcc/testsuite/gcc.dg/asan/pr81923.c.jj\t2017-08-29 18:08:59.183881570 +0200\n+++ gcc/testsuite/gcc.dg/asan/pr81923.c\t2017-08-29 18:09:27.643550083 +0200\n@@ -0,0 +1,10 @@\n+/* PR sanitizer/81923 */\n+/* { dg-do link } */\n+\n+int foobar __asm (__USER_LABEL_PREFIX__ \"barbaz\") = 34;\n+\n+int\n+main ()\n+{\n+  return 0;\n+}\n","prefixes":[]}