Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp24544pxb; Wed, 18 Nov 2020 15:27:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJx/yImmrwA2f9risx4Xg6i3orknlEJzsCo91/Pp35+sWC7E1UIK7rHIJ1mnxtym2vwH6OWJ X-Received: by 2002:a17:906:1e45:: with SMTP id i5mr25419918ejj.203.1605742031219; Wed, 18 Nov 2020 15:27:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605742031; cv=none; d=google.com; s=arc-20160816; b=aVb5zGIe721e567zXk6sWoNX0XZGcAA0GTCaosBspFmFtXU4JE6MsVHk4uk6AWhrvC CycfsacBW4CmSbfwrZTeTc63fR09NlT24lnBuCuG156ughOd61GSV2Uo/3PdcHtq0QfL qKQwKhay9AJFSllsB1m/O4qu4qhNp/3yR3xN402mGmkVVc/1v0vfTPZKbse8R8DC8y5I ru0vQSNtWbRta9fpQn9E9MIPwXxsUb9g9BReGhPzyQHnSr+ZeBQAWEkui8i4+Pzd20Pp lnftvRhCJbhO+iXSP3VoLGtoDOOjKqkNG/Fl9jFqEK6Pe3xo3tkxFn6GrjPRRn1KTy8i 7I+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=fZb71qCZpbdlpuwjdIAT2vB+YWJhGNyA/NN+MDd17nY=; b=xfZ7DuaA0UQNycenh2AA5UL7jKV0QyWDx6mxkoCMliZksSE2OXRC/EFCX+a0pfQFVq gh0OrWwivI47St551EH7/VOcs74Judyv82gswkV5dulwBEMszV47QGqU3xO5K/DpeLA4 ulctaDPOcxNXuLX6BbEf3w4I/SgxnfWCK8TkZdNiVSM5hFkN7YhTcozQ34borixkbLdA TbHlFxIeFqGOlw3qM7M09b3ttO9QfW8RsIJBQUXmZNhFHHpAjDBgVXVhx6pk89UmU8r5 +jYMnkiRC1fX/kFly5Rg8s+7LmLkHL9nbYXVHOFiufRscMmo/pFoxU4KZhUJJ0L24g7m tBUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=rKi7CCd0; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id oj19si3629001ejb.384.2020.11.18.15.26.44; Wed, 18 Nov 2020 15:27:11 -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=@google.com header.s=20161025 header.b=rKi7CCd0; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726739AbgKRXYS (ORCPT + 99 others); Wed, 18 Nov 2020 18:24:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725948AbgKRXYS (ORCPT ); Wed, 18 Nov 2020 18:24:18 -0500 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0270AC0613D6 for ; Wed, 18 Nov 2020 15:24:16 -0800 (PST) Received: by mail-pg1-x542.google.com with SMTP id 62so2425708pgg.12 for ; Wed, 18 Nov 2020 15:24:16 -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:content-transfer-encoding; bh=fZb71qCZpbdlpuwjdIAT2vB+YWJhGNyA/NN+MDd17nY=; b=rKi7CCd0zuW2lqT7kWv0CJPzNJwftE8rgm/Sy31Hcx2XVCDLRzDG7GOQ/lU9xu4JIz xdNKeYXFQ0y8vM7VRezlVL7MRQVZZvQVWDQnM7LUZH7qgXLUWp3j+a+4G3RzBJDZBWzN do8vnvNSvg0/WtsrTbuipHyyipbcu+XrIqyNy9+hfIr2RSscR3r3rcv4MG/h8aFRH71k 4vY6gOpaT+ZwBJtEBpdTmoz9r+bHsNcQRlpaaypb1ZvB+GvzJ5KqM/rwtls+eMAjVdYv GHJqrGTsfUgWZEr49PjNo9ayYe5xZye/n047PW/lsMwXI3orUyszOXBwoeUfnRHJOFBY 5ixg== 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:content-transfer-encoding; bh=fZb71qCZpbdlpuwjdIAT2vB+YWJhGNyA/NN+MDd17nY=; b=U/jyX0NhRJMkbUAW8NAqWuhmLC65Ri0FzxNLVlHewXMprtsVXVrWXfIdcydcc7OqHj w2Ykn/ll8Jr9Um/hMiFZ1Pi3hb9qICz+Kj5z4luf/BF51X9aNNhy4pHMa/5QqYz052ZH 4GsGyN7Rc+rYFKiT2o90STqJQCSUZMyc2lKrriYKxQ+61mo+C3SRtXHOU0azUIwnBImd 58Xy/wswdgkTLL7bGYYYLuYOivpn8FfIljR68g0zPumm+KIraPaSNmN3u730mrNDMOgX cXH+foV9nd28nj6t3r14RLUzHCZh+w/pdE9xw9EJ8UbyEwDUKUecO7EhAXIE2iRC11QP nUzA== X-Gm-Message-State: AOAM530AddceWJcNx+DDwdBtcqk0YHvHdurUpJHl37ww/4r//r1Dl6zI KDAgzEM7GMqPDg+cm9lZ6Ssm9KGCiq/okWvAelWH+Q== X-Received: by 2002:a17:90a:4881:: with SMTP id b1mr1364541pjh.32.1605741856285; Wed, 18 Nov 2020 15:24:16 -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: Wed, 18 Nov 2020 15:24:04 -0800 Message-ID: Subject: Re: [PATCH] kbuild: Always link with '-z norelro' To: Ard Biesheuvel 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 , Alan Modra Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 18, 2020 at 3:07 PM Ard Biesheuvel wrote: > > On Thu, 19 Nov 2020 at 00:05, Nick Desaulniers = wrote: > > > > > > > > > To avoid playing whack-a-mole with different architectures ov= er time, > > > > > > > hoist '-z norelro' into the main Makefile. This does not affe= ct 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? $ ld.bfd -z foo /dev/null ld.bfd: warning: -z foo ignored ld.bfd: warning: cannot find entry symbol _start; not setting start address =E2=9E=9C echo $? 0 Probably not. Can be a version check then (yuck); next is to find when ld.bfd supported `-z norelro`. commit 8c37241be3b1 in binutils looks like it. Date: Tue May 11 17:08:38 2004 +0000 which looks like either 2004-05-17 19:46:23 +0000 (tag: binutils-2_15) or 2005-05-02 22:04:18 +0000 (tag: binutils-2_16) So I think that would be fine then, since the kernel only supports 2.23+. Though maybe it's commit 5fd104addfddb68844fb8df67be832ee98ad9888 Emit a warning when -z relro is unsupported ld silently accepts -z relro and -z norelro for targets that lack the necessary GNU_RELRO support. This patch makes those targets emit a warning instead, and adds testsuite infrastructure to detect when relro is unsupported. So maybe then alpha and xtensa are getting new warnings (IIUC). If that's the case, then we might not be able to set `-z norelro` globally, and instead have to play whack a mole per architecture. --=20 Thanks, ~Nick Desaulniers