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-Status: No, score=-3.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, 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 11BBD1F4B4 for ; Sat, 23 Jan 2021 11:05:17 +0000 (UTC) Received: from localhost ([::1]:60396 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l3GjE-0006W4-7r for normalperson@yhbt.net; Sat, 23 Jan 2021 06:05:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52718) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l3GUX-0005rm-45 for bug-gnulib@gnu.org; Sat, 23 Jan 2021 05:50:05 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:37224) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l3GUV-0006a1-9e for bug-gnulib@gnu.org; Sat, 23 Jan 2021 05:50:04 -0500 Received: by mail-wr1-x432.google.com with SMTP id v15so7470574wrx.4 for ; Sat, 23 Jan 2021 02:50:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HbwDwmnRPV0+wNtwV7ngBVfhWkDkoXquxIuGXReW8l0=; b=DkwEmkArNkBx15XL1s5Ta58of3ppu1lNjR1pVQa7I2xopuvnkl32hbbxuyBFliAyZQ WUtk7ZpOs9fCiNYqnoSB0PNBzCnofb0vy+nW4Pu5Ys8+58tpoKvY+PfHExIYjswMss4r Y0bbS9R9numQ3SX9vrQXCV4BX8txL+uDtUSc2Lag8MQ2KZtnhyaNdPdBbEXVwIYwScv1 n3RaLnTAlsIGRAV4oZrK1f4exXQNM4AF4/GRwRsbcrdXH6RvRRUywtQH0duO68ngtp9n h5rT/64/NMITfdYZMAQ7VWeKnSg6ZytLheuM3fPe25IF9epM8RdCx86CxDy+nlSWwz9I E6Sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HbwDwmnRPV0+wNtwV7ngBVfhWkDkoXquxIuGXReW8l0=; b=sZHq0sVAwTWO0grlyDmeb3WHc5QJhQ4jjKOysLYHAkxeziQ07iNOr35GCuMkFV1kpf tXnwtaIaLpJ6CalrXKlm7Ji7RwtB5O7s+wMfcl1C+g1mKaXJQl2krKI4HPbPy+AKlhBD aextgnuCzIyTyJr4fqqr4xIHMWEV769jA1wfON1S9cHXIUuJTU501RkEADOvufZL5BSy WC6UHBu/ZbAhjlrvU1qAmK8oA8eUOCww2ASSM71ofrSdjf404ZutinI0Ir9fQi++825i H1BJn2xV1gDwd3ZbZvA/06pQAa6HfFj6A/gZnw3NG0ncYp3OmRqcqDjMH8FhnxLCiZFy TbVg== X-Gm-Message-State: AOAM533N9DzpiQACIENle8B3cugtS883tMDkREJ2EmmIzVQnO6TcpwxN RNNrb/b94qaSFFjzBsHFdgWuwjOzKXg= X-Google-Smtp-Source: ABdhPJwD0P5fv0n2dgx6xRVkSBB/qAvKtWeUAzRKqKBtzH3CWrhDfwtDO8rzyXw1XgHQGeu/DsarQw== X-Received: by 2002:adf:e7d0:: with SMTP id e16mr185182wrn.363.1611399001366; Sat, 23 Jan 2021 02:50:01 -0800 (PST) Received: from localhost ([2a01:e0a:3d3:9cc1:c5e2:6877:2efd:7c77]) by smtp.gmail.com with ESMTPSA id h16sm14092599wmb.41.2021.01.23.02.50.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Jan 2021 02:50:00 -0800 (PST) From: roucaries.bastien@gmail.com X-Google-Original-From: rouca@debian.org To: bug-gnulib@gnu.org Subject: [PATCH 2/2] Implement fallback for explicit_bzero using jump to volatile pointer Date: Sat, 23 Jan 2021 10:49:45 +0000 Message-Id: <20210123104945.194017-3-rouca@debian.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210123104945.194017-1-rouca@debian.org> References: <20210123104945.194017-1-rouca@debian.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=roucaries.bastien@gmail.com; helo=mail-wr1-x432.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-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: =?UTF-8?q?Bastien=20Roucari=C3=A8s?= Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" From: Bastien Roucariès Signed-off-by: Bastien Roucariès --- lib/explicit_bzero.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/explicit_bzero.c b/lib/explicit_bzero.c index 71a1cca3b0..86a5fd35d7 100644 --- a/lib/explicit_bzero.c +++ b/lib/explicit_bzero.c @@ -54,11 +54,10 @@ explicit_bzero (void *s, size_t len) explicit_memset (s, '\0', len); #elif HAVE_MEMSET_S (void) memset_s (s, len, '\0', len); -#else +#elif defined __GNUC__ memset (s, '\0', len); -# if defined __GNUC__ /* Compiler barrier. */ -# if !defined __clang__ +# if !defined __clang__ asm volatile ("" ::: "memory"); # else /* See https://bugs.llvm.org/show_bug.cgi?id=15495#c11 @@ -70,5 +69,8 @@ explicit_bzero (void *s, size_t len) __asm__ volatile("" : : "g"(s) : "memory"); # endif # endif +#else + void * (* const volatile volatile_memset)(void *, int, size_t) = memset; + (void) volatile_memset(s, '\0', len); #endif } -- 2.29.2