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=-3.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 D6D4EC5519F for ; Wed, 18 Nov 2020 23:06:52 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 523ED22255 for ; Wed, 18 Nov 2020 23:06:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mMtGdxQ5"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="qBtqEPVu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 523ED22255 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=VM6RoTemUb0dTMEVUAxw80S2QAvfgE3zTO+HUCie9+g=; b=mMtGdxQ5EvPlVKEHCfFfMIwpK GPU1DZZHQwLzUs899CAObjBF9WfuDEtoUONP+XuvF+dZ0Xv6BI5/hs0byhzL+mIgm8/IotrWkB3Cq GhicfVtHiuzz+9K2fsNvAt6KuvS17KdKf2dbugMJEVQRiv1mt2iB7nBXMIFnDn02IsB0V1uXt08kv UV7er0B7OkeQPOouRuzS3QpIbpnpnxfeLDlp84AIJroHOyJ6zF9VhCGw8ViHdmSEOPWgp/RWNZrzy A4PxvDqLM1O53if3veA0CCGXqMuUQHS92aYz0XxFhfKrk0HvbE6f9+8XmiwEbm99bwEd74zamTin+ AzY6bdpaA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfWWa-0006vO-JS; Wed, 18 Nov 2020 23:06:04 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kfWWX-0006u1-NF for linux-arm-kernel@lists.infradead.org; Wed, 18 Nov 2020 23:06:02 +0000 Received: by mail-pl1-x642.google.com with SMTP id j5so1856530plk.7 for ; Wed, 18 Nov 2020 15:05:59 -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=pK9Er3U8wzUpc5Ph5vwpd9eRfxvPgKOSxbNh1R/cIyQ=; b=qBtqEPVu57Elst2R12JNUW2yDdqme72UJq+j8B0KRMqaTWXE4Jb1RBA0uBEPC+4gUC cwNzl/PBwFYa9lfSCljv6SI+9YLvJMAcAKQcf6332IEIGFx1bEyB4t843r3loVTouYCp EBHO4763PSurh/yifzv5CkiyWsX0GIot99a3ebjYWhIaP+pJf9JTpCnZzl8MYI9WDwFG OMufIi9lNxEy0cLWZxlOh/WB5GlWXES1d7XwB75xaVa+bsosmHlEG6ddnN4dnjZLgt82 e1LLxc1B9mN0WtxIB00A8ae/+yjvn6BeKYjEAtIMCqcJ3G9dlk89fKRWfIG8JcYCVn8u 3k0g== 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=pK9Er3U8wzUpc5Ph5vwpd9eRfxvPgKOSxbNh1R/cIyQ=; b=TIlIMXa345zTehMrIBB30cDdzmMnVeMLoQURMoKBcZ7kWAnSxQctC6USdrz+9jTxA3 olDF0xEs9+JVnYmqPq+beukCR6jCAmS8UJ04ItUExzi/JFhoCMNtMST2rUXCDDpzDlnm KC4ydvBPWUPxLGSJBijOtsl5acvsBFXFxdR6rs+iaaaXUwDWZ0kju9z7UDL/zf56s58C gpU49evmE64j039CfFiw6ktdkr3L4ru2Ap7X0X2pNqQsklsUC77P94iPkrisPAgDtTyg PBcrA2k8Ug9fh2Pt6KRZlQn6ZG6ps2wdg5W7UQd7tUawKsSCnNYacy8vHa+aM5N1mXoB KVcw== X-Gm-Message-State: AOAM530NycyWxp37IQhMyOmR8smCFh1h6eUaKiZ2ISND80tpvAxyMI9I 42fsW0ttVw9U8DmhFNp3404zoCUJf6DG8m9ibO7cgQ== X-Google-Smtp-Source: ABdhPJx1KDsDxRgKYnaY8s7A1LaCEAgZ3k75SP2XAXWwuKK+TgoYSXGDwJEdbrp/TZpc04v4UBtcYvQauYdJ5LEX4To= X-Received: by 2002:a17:902:221:b029:d8:f938:b112 with SMTP id 30-20020a1709020221b02900d8f938b112mr6374426plc.10.1605740757172; Wed, 18 Nov 2020 15:05:57 -0800 (PST) MIME-Version: 1.0 References: <20201112183839.1009297-1-natechancellor@gmail.com> <20201113005347.GA3625030@ubuntu-m3-large-x86> In-Reply-To: From: Nick Desaulniers Date: Wed, 18 Nov 2020 15:05:45 -0800 Message-ID: Subject: Re: [PATCH] kbuild: Always link with '-z norelro' To: Nathan Chancellor X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201118_180601_954153_65CE8699 X-CRM114-Status: GOOD ( 21.65 ) 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: Dan Rue , Florian Fainelli , Fangrui Song , Arnd Bergmann , Linux Kbuild mailing list , Ard Biesheuvel , Catalin Marinas , Masahiro Yamada , Russell King , Jian Cai , Michal Marek , Mark Brown , Linux ARM , Abbott Liu , Andrey Ryabinin , Mike Rapoport , Will Deacon , Linus Walleij , LKML Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Nov 13, 2020 at 11:34 AM Nick Desaulniers wrote: > > On Thu, Nov 12, 2020 at 10:06 PM Ard Biesheuvel wrote: > > > > On Fri, 13 Nov 2020 at 01:53, Nathan Chancellor > > wrote: > > > > > > On Thu, Nov 12, 2020 at 04:44:46PM -0800, Nick Desaulniers wrote: > > > > On Thu, Nov 12, 2020 at 10:41 AM Nathan Chancellor > > > > wrote: > > > > > > > > > > Commit 3bbd3db86470 ("arm64: relocatable: fix inconsistencies in linker > > > > > script and options") added '-z norelro' to the arm64 Makefile when > > > > > CONFIG_RELOCATABLE was set to help support ld.lld because ld.lld > > > > > defaults to '-z relro' but the kernel does not use program headers or > > > > > adhere to the section layout that is required for RELRO to work. > > > > > > > > > > Commit 3b92fa7485eb ("arm64: link with -z norelro regardless of > > > > > CONFIG_RELOCATABLE") unconditionally added it to LDFLAGS_vmlinux because > > > > > an error occurs with CONFIG_KASAN set even when CONFIG_RELOCATABLE is > > > > > unset. > > > > > > > > > > As it turns out, ARM experiences the same error after CONFIG_KASAN was > > > > > implemented, meaning that '-z norelro' needs to be added to that > > > > > Makefile as well (multi_v7_defconfig + CONFIG_KASAN=y + LD=ld.lld): > > > > > > > > > > $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- LLVM=1 zImage > > > > > ld.lld: error: section: .exit.data is not contiguous with other relro sections > > > > > > > > > > To avoid playing whack-a-mole with different architectures over time, > > > > > hoist '-z norelro' into the main Makefile. This does not affect ld.bfd > > > > > because '-z norelro' is the default for it. Fangrui pointed out off list that this might need an ld-option wrapper for older versions of GNU binutils. Dan was showing me some build logs today, and I thought I spotted such warnings about `-z norelro will be ignored`. -- Thanks, ~Nick Desaulniers _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel