Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4259560pxu; Wed, 9 Dec 2020 12:18:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJwqsy0jXtZQ60xN88XdfEzMCWB+KxwMbcJTRx1Ua9BL180xD3XkD+eIaXozLDOi8YhN3wTu X-Received: by 2002:a50:d552:: with SMTP id f18mr3636062edj.168.1607545128251; Wed, 09 Dec 2020 12:18:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607545128; cv=none; d=google.com; s=arc-20160816; b=FiPqG9nhCGl3rIiICiRsODN1y2A5PGL7bmThsDbsCJLY/ZyFsp/8HfVB9X6xjQloNB e4ZIxtqhJsUk9h1MjIKrIzKhO/OhoCrp+2K0bRrIsfmiUuvzxPzSaFRNAccJLAf4C0vF SF62/Sin0rmN94U4RQh4k6TrpPGLBUzQSxg6fhTWv/TkLg0WmoTZZhrreFBk+5CgQTC3 c5cHGcZwWDK7erkoAp9XqSnQHnxV7JNRgZCnrEkRAfXxbRmSZUpsp0orIpFcQx8P/jbo ahm11WpY1Ak+t8Vsh4iklEchL7+9Jt/JmzrlA6fh+ITGamSsBxltNJizqApEKGRcDR2t g9Wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=IZTyrzRaLAuBag0ZSHRmfby0IplUWH3Yq+4r83zmEVk=; b=jDgegYDF2pVIl340zkA86fV4Vm0B/zNqvW5A7NZjSG8sBK20uhCDCuJMO4UbVTbBuD dHLQ+dp7z6M1WRYJrvon3Z34k9OEujy0lghC9yeu7d1i/q3TlAiJeCxORIOSI/ykR+2U wOnSgOJM69dqsnbxAnSbNQlA176UFWwsLKmUyA2QisSjrFaLHwqVA9tXC4DHF4wUZZaV /gRpN6MDje5a+uVFSTnUHbQk2l0DZuUz31JaDSdeiO2P4u5o4YwnN8gRjkLQCf2eXNFg /fgF6I/HsM3sRrtyU6ChvedocP7EghKUZ05L1m69ukXbs3xYHnxvTHLJPGOeLPzK9RQg 6c0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nO+yHSD0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d92si1569937edd.33.2020.12.09.12.18.10; Wed, 09 Dec 2020 12:18:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nO+yHSD0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728003AbgLIRwk (ORCPT + 99 others); Wed, 9 Dec 2020 12:52:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:49798 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728375AbgLIRwe (ORCPT ); Wed, 9 Dec 2020 12:52:34 -0500 X-Gm-Message-State: AOAM530y4QUf0cGgU8zIRU8GLYcT9iFMN2zPz6qZljF3tBpaqdUei+kM PYF8OBSdIJK0mBtVaUng82kgkNjcDBZ33/ojEgA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1607536312; bh=PkhafiKufzKb4ug4EZv6MWBGYou8NhXyEMjpgO/uc5E=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=nO+yHSD0aD/myoaEBloVJSGAXz/9Z9jr2v13Ie8CZZquSOaxn9x54EWCBKPspHYr9 C7ov27bcIKqHGqsw0G2b+SRoGTpaMyzBiPtAowkH+Ri14rs1FZxhzgI1YDBJU3B6Yh wsPQInRPENeXuhDzJK8x93nWLhePtzQbjVQ4JCq8GZAw33D4KaIEBkodUp45W78tZY oMFyQlU9exNc1aSWvJld48xqQbYIdgpTXz8nY/aMrldCE2NXZTQj2Tn4uTZWfo1B5Q 6pvYNvOpCKBRZd+m8zIp2GDb95NKAzMEotGY/d8IZOzA4HjydrO2M2hq91pKktRA4J D4lKm4IJ0IP/Q== X-Received: by 2002:aca:bd0b:: with SMTP id n11mr2533645oif.11.1607536311473; Wed, 09 Dec 2020 09:51:51 -0800 (PST) MIME-Version: 1.0 References: <20201201213707.541432-1-samitolvanen@google.com> In-Reply-To: From: Arnd Bergmann Date: Wed, 9 Dec 2020 18:51:34 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v8 00/16] Add support for Clang LTO To: Sami Tolvanen Cc: Masahiro Yamada , Steven Rostedt , Will Deacon , Josh Poimboeuf , Peter Zijlstra , Greg Kroah-Hartman , "Paul E. McKenney" , Kees Cook , Nick Desaulniers , clang-built-linux , Kernel Hardening , linux-arch , Linux ARM , Linux Kbuild mailing list , "linux-kernel@vger.kernel.org" , linux-pci Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 9, 2020 at 5:25 PM 'Sami Tolvanen' via Clang Built Linux wrote: > > On Wed, Dec 9, 2020 at 4:36 AM Arnd Bergmann wrote: > > > > On Tue, Dec 8, 2020 at 1:15 PM Arnd Bergmann wrote: > > > > > > It seems to happen because of CONFIG_TRIM_UNUSED_KSYMS, > > which is a shame, since I think that is an option we'd always want to > > have enabled with LTO, to allow more dead code to be eliminated. > > Ah yes, this is a known issue. We use TRIM_UNUSED_KSYMS with LTO in > Android's Generic Kernel Image and the problem is that bitcode doesn't > yet contain calls to these functions, so autoksyms won't see them. The > solution is to use a symbol whitelist with LTO to prevent these from > being trimmed. I suspect we would need a default whitelist for LTO > builds. A built-in allowlist sounds good to me. FWIW, in the randconfigs so far, I only saw five symbols that would need to be on it: memcpy(), memmove(), memset(), __stack_chk_fail() and __stack_chk_guard Arnd