From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-f196.google.com ([209.85.210.196]:43820 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726084AbgAPFe2 (ORCPT ); Thu, 16 Jan 2020 00:34:28 -0500 Received: by mail-pf1-f196.google.com with SMTP id x6so9639725pfo.10 for ; Wed, 15 Jan 2020 21:34:26 -0800 (PST) From: Daniel Axtens Subject: Re: [PATCH 1/2] kasan: stop tests being eliminated as dead code with FORTIFY_SOURCE In-Reply-To: References: <20200115063710.15796-1-dja@axtens.net> <20200115063710.15796-2-dja@axtens.net> <917cc571-a25c-3d3e-547c-c537149834d6@c-s.fr> Date: Thu, 16 Jan 2020 16:34:23 +1100 Message-ID: <87zheoj76o.fsf@dja-thinkpad.axtens.net> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-s390-owner@vger.kernel.org List-ID: To: Dmitry Vyukov , Christophe Leroy Cc: linux-s390 , linux-xtensa@linux-xtensa.org, the arch/x86 maintainers , LKML , kasan-dev , Linux-MM , Daniel Micay , Alexander Potapenko , Andrey Ryabinin , linuxppc-dev , Linux ARM >> >> +/* >> >> + * We assign some test results to these globals to make sure the tests >> >> + * are not eliminated as dead code. >> >> + */ >> >> + >> >> +int int_result; >> >> +void *ptr_result; >> > >> > These are globals, but are not static and don't have kasan_ prefix. >> > But I guess this does not matter for modules? >> > Otherwise: >> > >> > Reviewed-by: Dmitry Vyukov >> > >> >> I think if you make them static, GCC will see they aren't used and will >> eliminate everything still ? > > static volatile? :) Yeah so these are module globals. They'd be accessible from any other files you linked into the module (currently there are no such files). They're not visible outside the module because they're not EXPORTed. Making them static does lead to them getting eliminated, and 'static volatile' seems both gross and like something checkpatch would complain about. I'll leave them as they are but stick a kasan_ prefix on them just for the additional tidiness. Regards, Daniel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A076AC33CB1 for ; Thu, 16 Jan 2020 05:34:31 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6D8E7206E6 for ; Thu, 16 Jan 2020 05:34:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mOI0dwC1"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=axtens.net header.i=@axtens.net header.b="ZgcbuRsf" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6D8E7206E6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=axtens.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:References :In-Reply-To:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PScc/BJ2XSKIQFbZF9wT3V9g+50DdidG9q3QZxekbYc=; b=mOI0dwC113Z/i9 z0xPBq4XJRt4SpSS2u4hZ2JSxFPf88nzztXmvMy/UoSwAdHclyMXMyohtdJge3RCeJkGYa2dNRu8s Wx0QJ1A4xvHgen2KrWZ/FsOxMbvLtQ6N0WK2d/LnOanjOMYJA2zouhUq6ZlKtUqF7yzXwXz8SW4LA lTB49iN4qMT8cFGU+jQXTOhPNHEwYAFvIdhWvZtGv/RTE3dPhmGGHKik3X5YunYb+Sde2i62fO+2D X5JRCrqCe6q8aNXtn9QAcmBDutCF3G5oSseb6L4+f23iTvZaov77lNXP2LZZsC2E8FZXFsUgSerok 1T0WWzGgrVdqdYELaG6A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1irxna-0004JX-Fp; Thu, 16 Jan 2020 05:34:30 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1irxnX-0004J4-HU for linux-arm-kernel@lists.infradead.org; Thu, 16 Jan 2020 05:34:28 +0000 Received: by mail-pg1-x543.google.com with SMTP id s64so9303638pgb.9 for ; Wed, 15 Jan 2020 21:34:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axtens.net; s=google; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=OjhLrwSUixWKfHPYVjag4pJ4Twky6Gk6dHImQohRolQ=; b=ZgcbuRsf2JHWAKem4b8L9QCIstpEILQ+LtgpSvVyEIFmuJkHkq4wV3UhW+NB3I/p7L g8PhhD9MkXc8GNcgMLwPiGkXbVvTxOXXqfpvUxWGjbrkeerRAqqt7CgHVi3clSMsX94r 2eu6s/C0/gJJDbr9MjhIhO6KsPExdslbKPn1s= 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:in-reply-to:references:date :message-id:mime-version; bh=OjhLrwSUixWKfHPYVjag4pJ4Twky6Gk6dHImQohRolQ=; b=KfTnpa/vT/T8GHtw9bCyKqlRye05tzxq7bMbC3YFwJamPECMMjvzf6AD5yPBGiviRi wz2DIyNt7/Dij/3p/wwYHwvI4bOQTPgP6cspNrbbpqZfZCo8YKORIGvRlTMffaXgQS8T yV1OiGV8ZB9mxU4Tjb2fHsecI7am4xJcPXZ0wVsM0lTX8K0Knt/yG6/8OfoNdQTF7GUe afsrDtv/ZFtsaUwJ3kVE0vZkGQCy0PdFcjozo9pXoZRA2N6KliEcmAFxuYBedy/SE+cc OrzsTO8eyuXfy+R8JThfg8nfQAujVrMUnj7aGokwYTRWyyq4nQQUWkg9/I5X+Fl4+VYx 548Q== X-Gm-Message-State: APjAAAUB0rTJfGMpEeG/VBINZzHelDCOFsGIjYUsGFb0lhRZBWJm/np0 0/ftWNHJyxOLaFCzbFRvjrzLCQ== X-Google-Smtp-Source: APXvYqxrN0+qBEVUpua94Qb8xZteFhv2nkLn9S7EhrqzK/2c5Vhq+y51pzR4+MJYtOWvoNtguucHYw== X-Received: by 2002:aa7:98d0:: with SMTP id e16mr34318946pfm.77.1579152866617; Wed, 15 Jan 2020 21:34:26 -0800 (PST) Received: from localhost (2001-44b8-1113-6700-097c-7eed-afd4-cd15.static.ipv6.internode.on.net. [2001:44b8:1113:6700:97c:7eed:afd4:cd15]) by smtp.gmail.com with ESMTPSA id p16sm24333466pfq.184.2020.01.15.21.34.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2020 21:34:25 -0800 (PST) From: Daniel Axtens To: Dmitry Vyukov , Christophe Leroy Subject: Re: [PATCH 1/2] kasan: stop tests being eliminated as dead code with FORTIFY_SOURCE In-Reply-To: References: <20200115063710.15796-1-dja@axtens.net> <20200115063710.15796-2-dja@axtens.net> <917cc571-a25c-3d3e-547c-c537149834d6@c-s.fr> Date: Thu, 16 Jan 2020 16:34:23 +1100 Message-ID: <87zheoj76o.fsf@dja-thinkpad.axtens.net> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200115_213427_583242_5DC82C84 X-CRM114-Status: UNSURE ( 9.54 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-s390 , linux-xtensa@linux-xtensa.org, the arch/x86 maintainers , LKML , kasan-dev , Linux-MM , Daniel Micay , Alexander Potapenko , Andrey Ryabinin , linuxppc-dev , Linux ARM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org >> >> +/* >> >> + * We assign some test results to these globals to make sure the tests >> >> + * are not eliminated as dead code. >> >> + */ >> >> + >> >> +int int_result; >> >> +void *ptr_result; >> > >> > These are globals, but are not static and don't have kasan_ prefix. >> > But I guess this does not matter for modules? >> > Otherwise: >> > >> > Reviewed-by: Dmitry Vyukov >> > >> >> I think if you make them static, GCC will see they aren't used and will >> eliminate everything still ? > > static volatile? :) Yeah so these are module globals. They'd be accessible from any other files you linked into the module (currently there are no such files). They're not visible outside the module because they're not EXPORTed. Making them static does lead to them getting eliminated, and 'static volatile' seems both gross and like something checkpatch would complain about. I'll leave them as they are but stick a kasan_ prefix on them just for the additional tidiness. Regards, Daniel _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel