Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2992195ybt; Mon, 29 Jun 2020 12:18:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqUByjmrat26ktLJQ6sYC58ZIOHNxBY6n7wACFGwNAeCJA/HYWmv0p74csCsr7ZZlI57vE X-Received: by 2002:a17:906:2681:: with SMTP id t1mr13964335ejc.350.1593458320412; Mon, 29 Jun 2020 12:18:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593458320; cv=none; d=google.com; s=arc-20160816; b=sldQjRq569+UKb+qPxYCFlGPiG1y1HoedCmrRz67n5Xswf3BImN243HDqzolVpUgRl p3fZqsWOZbwR2Vh1MGYcwANaOVHib+GFdkZ6czKRuAN4MFnW/9WHSPc8hR28rSHXFkDF OmJBWfNBGmHIe79LV99PgRIq9xNO/PMo5TfMzGEPH2xCYx30YcKhrBuLw7Op6/x1+g6d f81X1x8agwqs/Lm50lgj49+T/3cxc2RUeW0umCu2VSE8vB0y8tHZwSntO/Xvns76r02L 7XzAhe4e6S3AgFa40ZYr8WE9ovUWqoPcDJW1ZJIDZAdlxu4lxBxyaIuiaaV54EpQZ+Lz fBUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:date:from :dkim-signature; bh=zVHoQQL1LMsjUx4guRxFxG91mzY8eSh+1dSHVIjtlAw=; b=Su/C/YBjpKvVZLF5O7d7tG0I/86h6npOxqsb92liEUWBD5AJHOx/A0JpGVleRadP+7 uYcQx/zZh/gvdrNPcMMuSfwyzALkz/IfOTZXl/3q+uTYojqRmSgZUf61n7O28wSxC0ZE MAGf6w0yBKnb76LzQjZUcvX7eLKemc2oGDwYhR2i693qZFot3L9d131EaqHqmj6k40YQ mrUAFuoZPS1WKnefEZrH1RyzTYO8+kQNSn4943ZUdJ/zIjUlpfwhBlBXXHR0+zVoM4YQ HyimWw4EKR42VuLdeooq1x/J1PsHm56WmlATU+ohPNdiE8HJxo0ktr68ntApWUEKLIsz KlRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=AbHbF76T; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a19si263036edt.160.2020.06.29.12.18.16; Mon, 29 Jun 2020 12:18:40 -0700 (PDT) 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=fail header.i=@gmail.com header.s=20161025 header.b=AbHbF76T; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731994AbgF2TSF (ORCPT + 99 others); Mon, 29 Jun 2020 15:18:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731950AbgF2TRn (ORCPT ); Mon, 29 Jun 2020 15:17:43 -0400 Received: from mail-qt1-x844.google.com (mail-qt1-x844.google.com [IPv6:2607:f8b0:4864:20::844]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E3E7C030F32 for ; Mon, 29 Jun 2020 09:52:13 -0700 (PDT) Received: by mail-qt1-x844.google.com with SMTP id v19so13320259qtq.10 for ; Mon, 29 Jun 2020 09:52:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=zVHoQQL1LMsjUx4guRxFxG91mzY8eSh+1dSHVIjtlAw=; b=AbHbF76TqmAMD6PPzsJCCJLquGawD17crfO8756wqiYD2QTDJqwM1V4JoCk4fahs9P hmwMMQIXhWDBt9WTcm/8eBOhR2JJs+r4Nlb18DFOVbOhjKz4G/A221gd0mLpR2K/W6fN Y/8lxIgiV7xoK2zNetBqhe38al2oz7padgN2vH4YN6u97FI56v51Z/uxdOQOaM4ZzqF5 O5HCXyHcS949k0Oxm5RJNn1KN4iWUsha1uLN55/0mgOHiNZs+tSNa7MLR65Xa8cPCgVw HJNlWG4C1+cVOXqUHSDPkhd55CoJC3JLP0frt+de4d9SuyGKB4RLReP7fbTIE888tWuP XMjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:date:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=zVHoQQL1LMsjUx4guRxFxG91mzY8eSh+1dSHVIjtlAw=; b=C4lob7syRDRBqszsIdLv25W7b997AA07ski+ewCSI2OHV3y2mhJj84mqERYcCT5b1A wOrK1sfAUJOd93o29GzEeL7CqQU8gzB8MkQYwgEuksjbOb5a0FE0oJ88JaaUoopcRdeH NbBXwaLkzHZ5mpB5ftCm8/+Oyw4ur95zjBK93ScMTVo6+Xw5291ojrILHLk3Ygjw2Qhh XsiPBascE9Fqk3i5EImhvHgqN3G2MrgSOgdtjO1lmPmiTkw1kW/hKMqUelSxfaFj8xs6 k4Zq/HoixK6cFaoO6YzL+RRP28l6FD6Q5eVzaT+JIv2+UNBQ4gug85nevmgWC/8CDm+V /sfg== X-Gm-Message-State: AOAM531hywLebhYnpnW6NO4mDVC8W1xIX8mWWBr2BFpdI8mWY1pPTizK wrEdEKzp/0IiPq3XstJ2xpc= X-Received: by 2002:ac8:3496:: with SMTP id w22mr16740693qtb.147.1593449532575; Mon, 29 Jun 2020 09:52:12 -0700 (PDT) Received: from rani.riverdale.lan ([2001:470:1f07:5f3::b55f]) by smtp.gmail.com with ESMTPSA id g145sm398035qke.17.2020.06.29.09.52.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jun 2020 09:52:12 -0700 (PDT) From: Arvind Sankar X-Google-Original-From: Arvind Sankar Date: Mon, 29 Jun 2020 12:52:10 -0400 To: Kees Cook Cc: Arvind Sankar , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org, Nick Desaulniers , Fangrui Song , Dmitry Golovin , clang-built-linux@googlegroups.com, Ard Biesheuvel , Masahiro Yamada , Daniel Kiper , Sedat Dilek , Nathan Chancellor , Arnd Bergmann , "H . J . Lu" , linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 6/7] x86/boot: Remove runtime relocations from head_{32,64}.S Message-ID: <20200629165210.GC900899@rani.riverdale.lan> References: <20200629140928.858507-1-nivedita@alum.mit.edu> <20200629140928.858507-7-nivedita@alum.mit.edu> <202006290905.7531731A@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <202006290905.7531731A@keescook> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 29, 2020 at 09:06:07AM -0700, Kees Cook wrote: > On Mon, Jun 29, 2020 at 10:09:27AM -0400, Arvind Sankar wrote: > > The BFD linker generates runtime relocations for z_input_len and > > z_output_len, even though they are absolute symbols. > > > > This is fixed for binutils-2.35 [1]. Work around this for earlier > > versions by defining two variables input_len and output_len in addition > > to the symbols, and use them via position-independent references. > > > > This eliminates the last two runtime relocations in the head code and > > allows us to drop the -z noreloc-overflow flag to the linker. > > > > [1] https://sourceware.org/bugzilla/show_bug.cgi?id=25754 > > > > Signed-off-by: Arvind Sankar > > Reviewed-by: Ard Biesheuvel > > Reviewed-by: Fangrui Song > > --- > > arch/x86/boot/compressed/Makefile | 8 -------- > > arch/x86/boot/compressed/head_32.S | 17 ++++++++--------- > > arch/x86/boot/compressed/head_64.S | 4 ++-- > > arch/x86/boot/compressed/mkpiggy.c | 6 ++++++ > > 4 files changed, 16 insertions(+), 19 deletions(-) > > I continue to really enjoy the smaller code. Anything that makes > mkpiggy.c smaller is a win. :) > > Reviewed-by: Kees Cook > > -- > Kees Cook It doesn't actually reduce the size? mkpiggy.c _could_ I think be replaced with some carefully written shell code, but this doesn't do anything like that.