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=-11.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,MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=unavailable 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 A3A6DC56202 for ; Fri, 13 Nov 2020 19:35:05 +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 391BF22240 for ; Fri, 13 Nov 2020 19:35:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="KH6Ft2rG"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="P6HAc57q" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 391BF22240 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=8N4wwlTdcMiGU7bb8+5TiTO6G4knY6IYEgeQX9jj1To=; b=KH6Ft2rGWHbQFdCzGzMtY9GTk 96x8Ivb+1jE74SgwxZmjN+ytj4KptCkMXGG6LpUIgKLHJolDVL9ojNZHfnC1erlAj2zud+GOXElL/ vko1t7mtzdnijv8pUj7UdaGhY8K3JybQBWE2ieNWNeCbiI3stO2aX6kkE9prChqvjSQ3qgn8WSu0x 1qB3uhLB+qz7X0gzvKKlxG6qzCGuRkUBRCCXGCn7OXqbXv/EwDo8YN7YPVPCsg2dThp9bOEX7eay4 LlRBE+VLVbCDlX3UI/mGAH3ub2FRDuJAkrf8HeEV0DqDYcROmnwT564zdKdG4ktLN36g1Aam/p1jk Bs8yQbi0g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdeq4-00018W-AG; Fri, 13 Nov 2020 19:34:28 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdeq2-00017n-30 for linux-arm-kernel@lists.infradead.org; Fri, 13 Nov 2020 19:34:27 +0000 Received: by mail-pl1-x641.google.com with SMTP id d17so3504302plr.5 for ; Fri, 13 Nov 2020 11:34:25 -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=z8F0h3EiXSYH2EwQ00yhxQHEYYtz5zW5mBasLaONkpU=; b=P6HAc57qE2Y5UcbYBoRa5r/4fC17b0CPIYGfj09rjoC4y+H+fAssvRyYyO+LgbOh4k 0Avtb8vbC2gKyR8qI/tRiojazj31g/0UjY/wR/h1q1SRtRo5UfFWU8QNqjSzcDtOFMc1 YvgGbbQgMs/h1aqB09iLPlZAjftBRLiyiyivj8rN6vkaGIel6wcEPX0G7g2k5SA1Vqw1 8EQTImjwSSiZKrdYvcvFJ2sPkDrpRJd0ndDLysiqRYfSTDSbDBsm94dGVXlM/UDfdwaX GzV+fgDxCX3U+OubSQkCQ44eJr2p7G0vRobS9xQP47oG7PmbwY4Bo09RNStd63bzeZBt DBTw== 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=z8F0h3EiXSYH2EwQ00yhxQHEYYtz5zW5mBasLaONkpU=; b=GEzlkIH395/vXXo8drfYvaQvD3nZWOYgo6ap97kr8KJibMUoioRSwblhXPBKVH/LXP qkaa5tH8TFYxUQa69T/p1QT4n9JMA8xO6jTwN8fm3obZLdDUoIodyuHVGIrJm1qrJPXi FNL2lSZ8mlC5c5UxJhjhf4TYXZb09qaQ73w0zHrEFuhJHAedqpHkQKVoDIhMPawxuzSJ gUWewV5Kky9mWZn5wGWzxOmxYobGv4dPJSoF3+b2aJjaKw+gkqv1ACPCnbvVk3zugQm9 wdRg2bbZ3jC7+PxKLp7UhWKt5wbvCbPkfj3xWHat8/A65v43GGvXiPQx5O0YBRL2cDxj YTpg== X-Gm-Message-State: AOAM53247DmkW/31/eKqjjZMUWGlnxHoX0J85nlHTmxSO/Z1N/gf9vnR cLFR9wxKEKx1TD5SD82KEaSxSjKmg5nISb5B5hpe2g== X-Google-Smtp-Source: ABdhPJyhopxb7RfHnNVf8DNmtk8myF/2H+M5fzPOJVrVSM9HWXnDlBhQ6V385hHHAXP1h8pNPPVnryqLNySs22r4GZE= X-Received: by 2002:a17:902:760c:b029:d6:efa5:4cdd with SMTP id k12-20020a170902760cb02900d6efa54cddmr3344130pll.56.1605296063135; Fri, 13 Nov 2020 11:34:23 -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: Fri, 13 Nov 2020 11:34:11 -0800 Message-ID: Subject: Re: [PATCH] kbuild: Always link with '-z norelro' To: Ard Biesheuvel X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201113_143426_212980_75ACD593 X-CRM114-Status: GOOD ( 25.86 ) 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: Michal Marek , Arnd Bergmann , Linux Kbuild mailing list , Catalin Marinas , Masahiro Yamada , Russell King , Jian Cai , Florian Fainelli , Linux ARM , Abbott Liu , Andrey Ryabinin , Nathan Chancellor , 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 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. > > > > > > > > Link: https://github.com/ClangBuiltLinux/linux/issues/1189 > > > > Suggested-by: Nick Desaulniers > > > > Signed-off-by: Nathan Chancellor > > > > > > Why not add it additionally to KBUILD_LDFLAGS_MODULE a la > > > `--build-id=sha1` a few lines above? (or `LDFLAGS_MODULE`, but that > > > looks unused?) We probably don't want this for modules either. In > > > that case, you could add -z norelo to the two existing lines with > > > `--build-id=sha1` above? > > > > Yes, I can do that. I will send a v2 along tomorrow morning to let > > others comment. > > > > Modules are partially linked objects, so there is no point in passing > -z options for them. Ok then. Reviewed-by: Nick Desaulniers Tested-by: Nick Desaulniers More work to be done to boot this config, but at least we can link without error. -- Thanks, ~Nick Desaulniers _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel