Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp4174466pxb; Tue, 17 Nov 2020 13:22:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJzLb4/6gGdEeMB6i1+VWqQSVXsmTJ9OvXysCLgh5oWph2Ly0jVyibFHykUe08edI0I1ecLy X-Received: by 2002:a17:906:4a98:: with SMTP id x24mr20821717eju.304.1605648141129; Tue, 17 Nov 2020 13:22:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605648141; cv=none; d=google.com; s=arc-20160816; b=NTRMtEkHV/MdB0jsNv3XH0z553lw/mqGb/X/RTVeYDIvsPyCqkzPwzSDzVQ+HZ+Kzo kWXWNLXoud6nFGrlEqDso4bsBmtY7wVZ/41dgeVCbVa4ehYRpkGW3vgxc6oNJK/Ouk9+ NCgwCHjcLzjhPMpW+xY6pWf62MrPUla1Mw3XRiynMkXPV6tQQVhUI5KA3kxq8YdUr3cC ULqG9Oj0Z0AkeF8hnZfHqLmtaldJ5VvmZhsev2H4ktSH82VMwwZmHBPhstgugIugmlb1 yBC9NFXq8adUjFGcUtyXqq7PgKbVhqmr8FArKT2f9r+UAnlYyrMbX1XTaGTEeP6xxuqG +GvQ== 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=I/hHF4xlcau8abUMMWWu9ZOPfLuX56SHUOKI4p/GLog=; b=mQHrIUwx5ulhAG/lbb7F/bUVdCzw7gT9Liz0TWz9hK0qZg7xcf6rxQ4F3zQmS/55Gt 81XRiktWP4y2TCrgOrgY1cpmM8guXEOutFfOsdILCqs3Alk2spGjiDfZOEGP1nmlHxdu ykLMvp+2fm0wn5jPjY16h84omx+3/zbUaNihl1hiVKdbWH7YiAWxa+HkCeAQa5iMcxgM Noim8hPrFAdsiu8WDoNwB8NtowTO/YUw89TxpFrjHhWnkYk1IviCz/2UuIOZvZkwLX2F I6qsKO4SOj3q9U+xmwCV2MWOUZEo7U8zJTdLAugZyL0dVdqy6RC/sVnwL2QId8yM3DRv zwxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FPqXJr9i; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i7si19705815ejo.726.2020.11.17.13.21.58; Tue, 17 Nov 2020 13:22:21 -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=@linaro.org header.s=google header.b=FPqXJr9i; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726536AbgKQVRc (ORCPT + 99 others); Tue, 17 Nov 2020 16:17:32 -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-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