From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,RCVD_IN_DNSWL_HI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 87B491F5AE for ; Sun, 18 Jul 2021 09:13:12 +0000 (UTC) Received: from localhost ([::1]:49414 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m52rH-00054H-Fx for normalperson@yhbt.net; Sun, 18 Jul 2021 05:13:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50008) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m52rB-00051g-RZ for bug-gnulib@gnu.org; Sun, 18 Jul 2021 05:13:06 -0400 Received: from mo4-p01-ob.smtp.rzone.de ([81.169.146.167]:28826) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m52r9-0001AT-Lu for bug-gnulib@gnu.org; Sun, 18 Jul 2021 05:13:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1626599574; s=strato-dkim-0002; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=Gn7kuWQElxp4u1EwJuFE4AUP/e3suFz60P146gQa0oE=; b=H/HyQCVf6y8+/xlQjUXBmBjI1ke79Q1N41szN2+jgvIBaYYU6RgyJ02IbWw2DR5T6Y 03K1/a5MXMn3EHCt4kSaMF4kOxYtZ1y2y65rJGMx1z3SW7wjrRO+7pagCQvWTODVWin+ 0gVxJlKhy/1ogdjlTkJETJ4P/lCNIGW+mWq8jpRaqXvsUMYkxRO+Nq2RsPJSXela9Zqo ZoTX4sZr28mel4/aqSx8VqmHTw2gRPkNDnxKQPCat+wDvUVgwHtl/pVMPaSa7+kira75 ICSRAzb35HcNDNYfleB6XeTOuSenXocRuMFOKnXrq66bKHXehLcTzF/WBd0+O2awS52Z RkaQ== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH/DXj0JGsbh0vbrMZq" X-RZG-CLASS-ID: mo00 Received: from bruno.haible.de by smtp.strato.de (RZmta 47.28.1 DYNA|AUTH) with ESMTPSA id u08ae3x6I9CrGQa (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (curve X9_62_prime256v1 with 256 ECDH bits, eq. 3072 bits RSA)) (Client did not present a certificate); Sun, 18 Jul 2021 11:12:53 +0200 (CEST) From: Bruno Haible To: bug-gnulib@gnu.org Subject: Re: [PATCH 1/2] explicit_bzero-tests: pacify GCC Date: Sun, 18 Jul 2021 11:12:53 +0200 Message-ID: <1970409.cXUO0us07v@omega> User-Agent: KMail/5.1.3 (Linux/4.4.0-210-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: <20210718045621.1058412-1-eggert@cs.ucla.edu> References: <20210718045621.1058412-1-eggert@cs.ucla.edu> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Received-SPF: none client-ip=81.169.146.167; envelope-from=bruno@clisp.org; helo=mo4-p01-ob.smtp.rzone.de X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paul Eggert Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" Hi Paul, > diff --git a/tests/test-explicit_bzero.c b/tests/test-explicit_bzero.c > index cdb839245..c42aba93f 100644 > --- a/tests/test-explicit_bzero.c > +++ b/tests/test-explicit_bzero.c > @@ -126,12 +126,12 @@ test_heap (void) > /* There are two passes: > 1. Put a secret in memory and invoke explicit_bzero on it. > 2. Verify that the memory has been erased. > - Implement them in the same function, so that they access the same memory > - range on the stack. */ > + Access the memory via a volatile pointer, so the compiler > + does not assume the pointer's value and optimize away accesses. */ > +static char *volatile stackbuf; > static int _GL_ATTRIBUTE_NOINLINE > do_secret_stuff (volatile int pass) > { > - char stackbuf[SECRET_SIZE]; > if (pass == 1) > { > memcpy (stackbuf, SECRET, SECRET_SIZE); I disagree with this change, as it significantly reduces the strength of the test. The purpose of the test is to verify that the compiler does not eliminate a call to explicit_bzero, even if data flow analysis reveals that the stack area is "dead" at the end of the function. With this patch, it was turned into a weaker assertion: namely, that the compiler does not eliminate a call to explicit_bzero if it cannot make inferences about the pointer argument. I would suggest to revert this patch, and instead use a #pragma, like you did in the test-memrchr.c patch. Bruno