Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp188332ybl; Tue, 28 Jan 2020 01:10:01 -0800 (PST) X-Google-Smtp-Source: APXvYqwgeIf0dRXMdFokohaLwrVMl+kgDG4uZey7cFaTMX51yREsTYolheNzN24oeV7C4ZIsfuGk X-Received: by 2002:a05:6830:1d7b:: with SMTP id l27mr14603372oti.251.1580202600862; Tue, 28 Jan 2020 01:10:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580202600; cv=none; d=google.com; s=arc-20160816; b=EsGq4GCp3IE1lgkPz+coIx244DwCVZTyp6xbi+0g/YSV/daU8v2JWuzrVgjB4S8Q1I 0pMF4ohDWEAEbQQZrpbwpJ7wRpsuqa1axFpMiX2we9/mez1KIsIf+osoSEqob7YLKBrf L4cT/3rGDKRNoHWmyrm1Nh0Hlt8br6PjegQEPQatCeT+YWRq9vpuq3N/v8HLakcqROT/ 6qpapnd7/PSX4k3Ak7X656sSh+3ylBx2/YP3kitF2bHnLc9JQMhyeNASrKSGtbVeeWT+ 7Qv5aeqETk1tNeybygx4M2HdmyveVP4VHu4QzGbvXCPCTWjjpwIz2+zFJ2/Hac3Fv6EJ Tuug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=V9xAyfYvshxDtwWMgT0zgZJ0j7N3J44CYOXm6ENX55s=; b=ftaUxwolPIPgRqDdpjeeZbODmkWMcAgk3lbELaNFFQKW+Zl3WDlnvZgVfVRVzdA4uu bdsNXvLVp3h8Q06TK7fAwLcpVJuLtW+sL6TJtKUWsLSZW298g14nR9z876YYdPiY+N9e qlMjBAErCirppo/kLFqsvdG62SxuBjq+/Xr+YagwpxB41giPyB6z3nLLPvMYKip1VAGD QHETIXUqFgQHEeSzu3lTcCWDNFNLOwnk75V/JBpY1e6vW3rC80vO+8VIF2C+4qFDJIUo y3DE3PMbuiNHK9akkWDbb7KTMeAPzHj6gp4VnjPHDY129gflU/Kt37OTcOslumR9L/9X DKjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=UBM+ALw8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v11si4931874otp.279.2020.01.28.01.09.48; Tue, 28 Jan 2020 01:10:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=UBM+ALw8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725920AbgA1JIv (ORCPT + 99 others); Tue, 28 Jan 2020 04:08:51 -0500 Received: from mail-qv1-f68.google.com ([209.85.219.68]:37397 "EHLO mail-qv1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725882AbgA1JIu (ORCPT ); Tue, 28 Jan 2020 04:08:50 -0500 Received: by mail-qv1-f68.google.com with SMTP id m5so2771590qvv.4 for ; Tue, 28 Jan 2020 01:08:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=V9xAyfYvshxDtwWMgT0zgZJ0j7N3J44CYOXm6ENX55s=; b=UBM+ALw8CpI4ev4pjKDHghR0t6BBgD/1R2c9dxpJJ6uPN9cRyxne6hUg5PZwNOH19H hALAbYYOUfFDKSm9eXlQN/NN9tzITc8DjLZasBqt0hIvKjly0Ib0N0yaoST95Mz7bcOH yHUd/Ry/FDID53tCKpDPzxkj2EC5C/cx2d3fJ5OCFyt/5hV84RF+AVzLtLlKjUUmLdPv PIDvbbRM4Azq4pGaUJRRihjz1nnK1UZxiMh5EIoaA2yPIjBtT0ylGPpHdc8NExuKyL76 3FToEHAO9Du/AIujx4S9AAJSMPjihk4fOihEnKx8WkOM42Nx51bgYn4zoo+7/j+a0o2i B/ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=V9xAyfYvshxDtwWMgT0zgZJ0j7N3J44CYOXm6ENX55s=; b=uI3UG419wYo0GAbcyVjLzxN3tF/lmDNNUiWcP1bFVeRrxAVopUPMyMpkiBgAKm3odh 1Z8RQHhtlXtlTu9HOBkU3XhUpH0hlhNRooFcDHRY0rXUU+2etbUk+sGSjkB/OxgO9Bkw q0pQW2xWL1h1XlZePCHNfwLBcFqm8XjectQCbwXEZX8RpIUukaeVCvRccKQGGMaHoVCa P6ehxzXOBiFkjPNpGjVA4ZBUxg6qoTCZ6Fe3kH/P+C2b4ob7vPBNX2P7rPW2OhuPSpq9 ZOZWR6Z4RWAXkDX0I168eZ0UfM5gmJorkpZA5QXXaA/xqWxW2SX1y5ogKizTRZ5pI8TK J7vg== X-Gm-Message-State: APjAAAVVkTh695L0JulYgHiyo5sJYhZ6nimx7TxAqgsP7yj2PDu3oSWd uCaGG+6rEt88VX7ReMWSGU77M7GQm0cX4X2GAeu7iA== X-Received: by 2002:a05:6214:1874:: with SMTP id eh20mr21684750qvb.122.1580202529263; Tue, 28 Jan 2020 01:08:49 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Dmitry Vyukov Date: Tue, 28 Jan 2020 10:08:37 +0100 Message-ID: Subject: Re: mmotm 2020-01-23-21-12 uploaded (efi) To: Ard Biesheuvel Cc: Qian Cai , Randy Dunlap , Andrew Morton , Mark Brown , linux-fsdevel , Linux Kernel Mailing List , Linux-MM , Linux-Next Mailing List , Michal Hocko , mm-commits@vger.kernel.org, Stephen Rothwell , Ard Biesheuvel , linux-efi , kasan-dev Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 28, 2020 at 8:33 AM Ard Biesheuvel wrote: > > > > Should be fixed by > > > > > > > > https://lore.kernel.org/linux-efi/20200121093912.5246-1-ardb@kernel.org/ > > > > > > Cc kasan-devel@ > > > > > > If everyone has to disable KASAN for the whole subdirectories like this, I am worried about we are losing testing coverage fairly quickly. Is there a bug in compiler? > > > > My understanding is that this is invalid C code in the first place, > > no? It just happened to compile with some compilers, some options and > > probably only with high optimization level. > > No, this is not true. The whole point of favoring IS_ENABLED(...) over > #ifdef ... has always been that the code remains visible to the > compiler, regardless of whether the option is selected or not, but > that it gets optimized away entirely. The linker errors prove that > there is dead code remaining in the object files, which means we can > no longer rely on IS_ENABLED() to work as intended. I agree that exposing more code to compiler is good, I prefer to do it as well. But I don't see how this proves anything wrt this particular code being invalid C. Called functions still need to be defined. There is no notion of dead code in C. Yes, this highly depends on compiler, options, optimization level, etc. Some combinations may work, some won't. E.g. my compiler compiles it just fine (clang 10) without disabling instrumentation... what does it prove? I don't know. To clarify: I completely don't object to patching this case in gcc with -O2, it just may be hard to find anybody willing to do this work if we are talking about fixing compilation of invalid code. > > There is a known, simple fix that is used throughout the kernel - > > provide empty static inline stub, or put whole calls under ifdef. > > No, sorry, that doesn't work for me. I think it is great that we have > diagnostic features that are as powerful as KASAN, but if they require > code changes beyond enable/disable, I am not going to rely on them.