From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qv1-xf29.google.com (mail-qv1-xf29.google.com [IPv6:2607:f8b0:4864:20::f29]) by sourceware.org (Postfix) with ESMTPS id 6E17E393C033 for ; Wed, 28 Apr 2021 14:49:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6E17E393C033 Received: by mail-qv1-xf29.google.com with SMTP id h3so30100149qve.13 for ; Wed, 28 Apr 2021 07:49:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=0FauvH0qe/QD249i5ckljJXN2w96v+EOq2B0yQeT6Jo=; b=OFZdREz02ODGL3GkjEq7jolqIifH3+txMUo83jexM8jFAME5S+vr4vemVMWu+tPQw5 lvFcE8aZ1UwaCIiPdKRK+ujTfVfKstIqajS052qozd98AnktacfslYkCt+aEn/pzU1Nw L5R4cBKOqAQnagiey4sc4gGVGcfyG5Ho35rauvhZ1//h7AZIdwZheCllyOgkz1y8qp6I UdOTTPIz3ezO6KNyLx5DdX9eQwSZtE0Q5V68pOPsK1MFdi8tSES9T6iP74SPl6eFM0VE k+gJr6YNk7UQy14ipisvFmVGaMZXJdIbK6+T/fSJ3zPngjVLJiak5G9kCu9tRGeQ63LM Uz4g== X-Gm-Message-State: AOAM533d5TcGb75XsctCp6wGvYMUxyhSBYE1o2XOXfvRdJnsswRYQ3Zo Pwh5k7duaXiNCnYVI0ImPh6JOFlLb60= X-Google-Smtp-Source: ABdhPJzH34XS5x7ETtdgOdZaXF7Vk22uKLrYnPbs02Yv/mgbsQdSYBU4kt8rg8MPeVCORCyRcVforA== X-Received: by 2002:ad4:5bef:: with SMTP id k15mr28870558qvc.16.1619621375809; Wed, 28 Apr 2021 07:49:35 -0700 (PDT) Received: from [192.168.0.41] (71-218-14-121.hlrn.qwest.net. [71.218.14.121]) by smtp.gmail.com with ESMTPSA id q84sm5286903qke.13.2021.04.28.07.49.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 28 Apr 2021 07:49:35 -0700 (PDT) Subject: Re: [PATCH] add attribute none to pthread_setspecific (BZ #27714) To: Florian Weimer Cc: Joseph Myers , Martin Sebor via Libc-alpha References: <2ec7fadb-cc15-a005-f708-d2adecc8cc39@gmail.com> <875z08qqy8.fsf@oldenburg.str.redhat.com> <571eb466-8979-8579-3b52-38f29a628a39@gmail.com> <47fc35d1-05b0-c02e-77dc-b3193aefd865@gmail.com> <8e311d8e-2b4a-06af-b086-7beb0e494422@gmail.com> <87eeeulv93.fsf@oldenburg.str.redhat.com> From: Martin Sebor Message-ID: Date: Wed, 28 Apr 2021 08:49:33 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <87eeeulv93.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Apr 2021 14:49:37 -0000 On 4/28/21 1:32 AM, Florian Weimer wrote: > * Martin Sebor: > >> diff --git a/nptl/tst-tsd3.c b/nptl/tst-tsd3.c >> index 0dd39ccb2b..45c7e4e1ea 100644 >> --- a/nptl/tst-tsd3.c >> +++ b/nptl/tst-tsd3.c >> @@ -37,7 +37,8 @@ destr1 (void *arg) >> { >> puts ("set key2"); >> >> - if (pthread_setspecific (key2, (void *) 1l) != 0) >> + /* Use an arbirary but valid pointer to avoid GCC warnings. */ >> + if (pthread_setspecific (key2, (void *) &left) != 0) >> { >> puts ("destr1: setspecific failed"); >> exit (1); >> @@ -53,7 +54,8 @@ destr2 (void *arg) >> { >> puts ("set key1"); >> >> - if (pthread_setspecific (key1, (void *) 1l) != 0) >> + /* Use an arbirary but valid pointer to avoid GCC warnings. */ >> + if (pthread_setspecific (key1, (void *) &left) != 0) >> { >> puts ("destr2: setspecific failed"); >> exit (1); > > Sorry, this is clearly a bug in attribute access (none). No access > should mean no access, not access to one byte, as the warning currently > implies. It's not a bug. Access none was introduced as a check whether the object has the expected size without assuming it's written to or read from (each access mode has its own checks). Pointers to void are treated as char*. This was documented in the GCC 10 manual when attribute access was first added and hasn't changed with GCC 11. The motivating use case for access none was a Linux kernel API (I think check_copy_size) used to verify that a pointer points to an object with the expected size. > > Please fix this for GCC 11.2 and adjust the glibc version check for the > none variant of the attribute. I'll see if I can come up with a solution for the pthread_setspecific use case. Martin