Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3048310pxb; Mon, 16 Nov 2020 04:34:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJxpjkE6FeM3H8GFwA6Lj/8hiO+uF5KTFpjqN23XL8+sRBOmDNImvx/BVziexvkaSLm35dFm X-Received: by 2002:a17:906:7d16:: with SMTP id u22mr13861292ejo.169.1605530072497; Mon, 16 Nov 2020 04:34:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605530072; cv=none; d=google.com; s=arc-20160816; b=SMiRexJxL2BZyubFCVuiCZhYt855RyWbQBePZ+iYh19VV0fbm1lgwwlOascEkOAb8b mZsuCFL5ftSPG7tnDE43gRHvzCc4BT9YRoX7M1IcC1NU+VUZmAE8v0FZVvDJJOpAORca OqleKNXAMV4shP14uCd4r2PdBN+vq8FDpR1S5rLVAsdT3g7JsSBJI3AmAnuDz7jMJ3W5 lWLNrhsMNNzU15CR6gNs7zb9d7U8n9yMFrkj9ERJA/HatFf2EM/C+ty/rnfE6EFhEjGE cFlYC7hbdbaSchDkON5sKBtffvUzdbx+cyhd1iCs0lZSG9082iuOcmALKoaaIOhzTktG 9UFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=0DZgAYUcqDXQ56V0d7GSuhlb+ZDYeAr5/72BaTpqa2Y=; b=HY1NVVlvtPmELUHIa1TI+vZDr88EdZIH3DW+981iZvsIWV7ZbIgRyIqYOSYDOguZkd GMI+IVkHJQXhzU/SGYwEW6LvrxXuT7DzVr8n7rRqjX0dxj24w+5f2E3C0UFZwpZYd4XW NdUgHAp3H8S9PbEZRwx6sTnLkOjmP1QoU6pAYl18xzixQD+kHU03kyobUmTxjYqOW0wP 4U6sE6QuqcvdkGc+TnnaFvarVu7geYN/U6GJkiElE0I+10zRLIFItpLVvxUxkLIZnvl0 o4NeXyW9bMlMpE/+uhch8vcTQWWCV8YMpeq1fbkbo/agEkKL+n9NcvjBXQU6TIxdJMA+ 36aQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u19si11525111ejc.310.2020.11.16.04.34.09; Mon, 16 Nov 2020 04:34:32 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729951AbgKPMcE (ORCPT + 99 others); Mon, 16 Nov 2020 07:32:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:47496 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728329AbgKPMcE (ORCPT ); Mon, 16 Nov 2020 07:32:04 -0500 Received: from trantor (unknown [2.26.170.190]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 990C1206D8; Mon, 16 Nov 2020 12:32:00 +0000 (UTC) Date: Mon, 16 Nov 2020 12:31:58 +0000 From: Catalin Marinas To: Nathan Chancellor Cc: Masahiro Yamada , Michal Marek , Will Deacon , Russell King , Florian Fainelli , Arnd Bergmann , Abbott Liu , Linus Walleij , Jian Cai , Andrey Ryabinin , Mike Rapoport , Ard Biesheuvel , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Nick Desaulniers Subject: Re: [PATCH] kbuild: Always link with '-z norelro' Message-ID: References: <20201112183839.1009297-1-natechancellor@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201112183839.1009297-1-natechancellor@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 12, 2020 at 11:38:40AM -0700, 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 > --- > > Hi all, > > This should probably go into Russell's tree with acks from the arm64 and > kbuild maintainers. So that's a fix for arch/arm going in the top Makefile. For the arm64 part: Acked-by: Catalin Marinas