Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp15535pxb; Wed, 18 Nov 2020 15:10:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJxpu52zteFZtAlaql5qT14m7plKdlfjT9et8AKa44CNV3Cv5mDkXBNvfCD3Jigc7cIC2QJd X-Received: by 2002:a17:906:66c9:: with SMTP id k9mr27205221ejp.204.1605741058089; Wed, 18 Nov 2020 15:10:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605741058; cv=none; d=google.com; s=arc-20160816; b=koYbMTM202DhabNHVKT8pBJVmnVPKRPG5HU/fPy8oeOUcRQca0+pHtgrCIsLV94VT4 U55LQwJKQVCyosr8TMr+gnkoyztPwj4T/VIIc7slbsbTVwq9h40DUe1QjBepPB6llhn0 HTUMmOFbozU4HhRanJVMQ5tDOpoY9kXHqZ4NReWVYfGqh03zVM7ysru/jQZpVFYIGHHj CK4WMPl5zZk7qVTyR9Qjzv40pFdGxlElK5V+EMzRHZMgOWAaUKZSxKJvTkiw1KDf7CeX xlRyS5UIaHAkh3/7t7R9VKcQWQR2Zd4I083/9dYoD/gjty6di8pDvezSURp1dyPWle9H eYhQ== 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=eio5lJ/UXsiMvRBl7GfgM0LfD3g1ONOGKiU5uxvXEVE=; b=JFEq67JQlSDQI+32VFYqOrj+46ZetZI1MXupKKFMDbPjY+DcQIp1BrX8aAtv23Gd3c 4naIOo/Y4riFLekAsl3eQWEvPrYYSSElJCldmOdKP8i8ESvOkSs27O/3xO46jzYsChMj VZnpiD5NgQIyiEWN+mEBnpQRPVTy8mplc0w5EEzh+UAVdw4a6gHd2Fj4NO+/ik2flOEt Ijuhjzl3ONm3BgbPumFLqmr1blbsKzRposg0/YXSOMbGkTwYqncVbhykEmgrEqBqelXd +fDTqdDZ/CUmPqPmlQjlIc48PxrfqpyjaZ6szrZxr8QQr9oriLsVryy+vlSp/LLDKDn8 LxNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GyVmbiub; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r4si4508098edc.537.2020.11.18.15.10.34; Wed, 18 Nov 2020 15:10:58 -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=@kernel.org header.s=default header.b=GyVmbiub; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727078AbgKRXG4 (ORCPT + 99 others); Wed, 18 Nov 2020 18:06:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:60072 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726588AbgKRXG4 (ORCPT ); Wed, 18 Nov 2020 18:06:56 -0500 Received: from mail-oo1-f51.google.com (mail-oo1-f51.google.com [209.85.161.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A5511246F5; Wed, 18 Nov 2020 23:07:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605740832; bh=ozEp87BLC35xPyBVmDNmQ6DkEOrGPDG+EAMmXG54HQ4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=GyVmbiubYH+DB+w+71RKjxb6bgYshMPjCmqYnRga9x1cUqzxDer+7gQRWsW6gCe69 8mzHYvJ8kjyuf0y5YpTNGejuVc1JiflOf2lFlJXG0CqH8vLKCUbATja58auHlmBkas 4pPw3fiMcY8MbqZJo6iCOOW0bXOgGEyDtip+0hWs= Received: by mail-oo1-f51.google.com with SMTP id h10so872318ooi.10; Wed, 18 Nov 2020 15:07:12 -0800 (PST) X-Gm-Message-State: AOAM533jYvtGCfSEq5mbm87DhbZ4ZcQDDpMbsYGJq7XrNqjnTXI+CRwD zWC5jDyz8eXofgzTqCXzWKNWmO+wYcZ/LYZ9S1Y= X-Received: by 2002:a4a:844f:: with SMTP id m15mr8299508oog.41.1605740831825; Wed, 18 Nov 2020 15:07:11 -0800 (PST) MIME-Version: 1.0 References: <20201112183839.1009297-1-natechancellor@gmail.com> <20201113005347.GA3625030@ubuntu-m3-large-x86> In-Reply-To: From: Ard Biesheuvel Date: Thu, 19 Nov 2020 00:06:59 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] kbuild: Always link with '-z norelro' To: Nick Desaulniers Cc: Nathan Chancellor , Masahiro Yamada , Michal Marek , Catalin Marinas , Will Deacon , Russell King , Florian Fainelli , Arnd Bergmann , Abbott Liu , Linus Walleij , Jian Cai , Andrey Ryabinin , Mike Rapoport , Linux Kbuild mailing list , LKML , Linux ARM , Fangrui Song , Dan Rue , Mark Brown Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 19 Nov 2020 at 00:05, Nick Desaulniers wrote: > > 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`. Does ld-option catch options that cause warnings but no errors?