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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,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 0C888C63777 for ; Tue, 17 Nov 2020 21:17:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9F3C02463B for ; Tue, 17 Nov 2020 21:17:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="FPqXJr9i" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727022AbgKQVRd (ORCPT ); Tue, 17 Nov 2020 16:17:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726211AbgKQVRc (ORCPT ); Tue, 17 Nov 2020 16:17:32 -0500 Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E522FC0617A6 for ; Tue, 17 Nov 2020 13:17:31 -0800 (PST) Received: by mail-lj1-x241.google.com with SMTP id 142so12320281ljj.10 for ; Tue, 17 Nov 2020 13:17:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=I/hHF4xlcau8abUMMWWu9ZOPfLuX56SHUOKI4p/GLog=; b=FPqXJr9icDh9L7sI6ggEaWimg9DuZcX++8IlgUQAq4mXREd7/XhwpmygB9qKmqGvqN SgbZqbV8tybddAgk78HR7TYSHbwylUQzGkMaoaX8Un84MYCZ5QF3DXxAmnEV6pZf/g60 tNyL40rr2dqucYJetfJpcOCm9LHFMSF1y9AnHiL/5Po5NzezA3haTP/heFqC2oAsbS3j D9vdsy5PKYnI45n5K1+qUG97MU0q4SQnq1oZnXo6MIQihRQn0QRF3t3+EtlG1QduJniW +cRsHvzXQ8D3t2PmcksPlXKrcPcLwOBxN/Hd8u2jOyRMLnLNeJ78n8ZtuqKZDUofrVoN dZ3w== 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=I/hHF4xlcau8abUMMWWu9ZOPfLuX56SHUOKI4p/GLog=; b=pEYpfmGbuYfTj/YDAX/s70nTJvHp8gLdYufATWAv/SZiPH316qsxsecsYNsWDc/rTE 5WwRXssVSKzS/lCgPSZ4xFAUiLqfspxQzyGgUW45MzHyu0L9ZgVUpncOUKQQDLcpUuwc tHY+kkMxwEw4kLmH3wq/RtjAYVwU4x00wDZS4DXri6PtON59YyRHgwzZvZaM2UaJ1A/L UkcMvtVQjTxHYa+SbrRmi3RPKdgd1p/b9dOPpF0hHaG06LKsxardH6/sPAQBtuwZ++oJ ILO5ZUPeS+1bX8JA6z7/8hlDFipmYijDvbYwu/qV+M7SAb/FZxQqiTEEXqwTxC1zOuY1 kiuQ== X-Gm-Message-State: AOAM53276cvjfyrFx8sRuY7uHFhB4sSJZVKAUnLyews4mNp60z/ZOmON du+ck7CrJqJexB9a8fZ4sHhgbaA579At+34KQ+ynTQ== X-Google-Smtp-Source: ABdhPJwwYzjaEnUocguKy9WJ8dtjA20kmRVQYAgUyPCCmjjYxTPilv86jTYXLmDvrReOEOTbXTIGkyUopqHL2PSdFCc= X-Received: by 2002:a2e:95d2:: with SMTP id y18mr2899299ljh.286.1605647850397; Tue, 17 Nov 2020 13:17:30 -0800 (PST) MIME-Version: 1.0 References: <20201112183839.1009297-1-natechancellor@gmail.com> In-Reply-To: <20201112183839.1009297-1-natechancellor@gmail.com> From: Linus Walleij Date: Tue, 17 Nov 2020 22:17:19 +0100 Message-ID: Subject: Re: [PATCH] kbuild: Always link with '-z norelro' To: Nathan Chancellor Cc: Masahiro Yamada , Michal Marek , Catalin Marinas , Will Deacon , Russell King , Florian Fainelli , Arnd Bergmann , Abbott Liu , Jian Cai , Andrey Ryabinin , Mike Rapoport , Ard Biesheuvel , linux-kbuild , "linux-kernel@vger.kernel.org" , Linux ARM , Nick Desaulniers Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 12, 2020 at 7:41 PM 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 OK makes sense, FWIW: Reviewed-by: Linus Walleij Yours, Linus Walleij