Received: by 2002:a25:2c96:0:0:0:0:0 with SMTP id s144csp648577ybs; Sun, 24 May 2020 17:00:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmgLzvYho94+6jqGGrzqj2Izauh+qGbM6v+dIAxmVfVYR/37voIo3JXos2Wk3ZRiviJxim X-Received: by 2002:a17:906:3cd:: with SMTP id c13mr17139284eja.164.1590364844226; Sun, 24 May 2020 17:00:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590364844; cv=none; d=google.com; s=arc-20160816; b=qWtFl50lER4sQLnseyN2SU1xGMz2vbS6dHsE6aEyzXJMP77yBloFCeY1t7L/l9IVhz nmAU8nUKPJljWCeLSFc8ZQdP9iOPGW2uF9wrl9esIROE59yIg73VL1ssE9QdLwerA0z3 5nedWblxsMDOAObB4ceAj3W6roI6ob3Xq8xH5wLzkp2AMiZ9fyGaIRFJX//2uWo5PBTz ZFaDJBzJ2/6XVxjE8UfJ6dSzxiVZOYHP8IDGVSG1F59o9ogE+WNSSg4VIvR340LyrHee r6Bk2jy71cgMc8/tKfYdb6RM5fT4B5uDfG+Z/7uxn+ah6qLi11OQPxbVKZhfdnj/HkmK anYw== 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=KnCrzlEjsfoAQJ2vuCQBZGIyVUirCRVTyeXStV4i7EM=; b=JNBWC18R7uqTg2y1FbogUee+7/7zbLGSFOoVflvnDdeVkcvjHsKaSsITZlvkDOk3dA BQbF3wGuAabpmzO3wXMa69d1HubquuT1IWPyWbSZAtr8lptZ38uRw8X7M/zuz769h23H zxuNmFSPkKeMZUeHC0d2K9bzto6Iy+mPcaF5n3QWnGQDiUvdx5aEomoURi+Mr6YeICdw dd/rH5kY1paTb7akUNoQZ6axmu1ntMLNU8f6PsdzvmyzLZT9lCcB3dUdkNZkZRvxz39r h428oXElesqtmGqrFpNz8vfCArWYBha5aGDJkFqko331Mz3ojyGWlShOpCBfIuokt/Ly HWag== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=F6VsXuGE; 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 lz8si9029360ejb.721.2020.05.24.17.00.21; Sun, 24 May 2020 17:00:44 -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=F6VsXuGE; 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 S2388578AbgEXX5x (ORCPT + 99 others); Sun, 24 May 2020 19:57:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388124AbgEXX5x (ORCPT ); Sun, 24 May 2020 19:57:53 -0400 Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C930CC061A0E for ; Sun, 24 May 2020 16:57:51 -0700 (PDT) Received: by mail-qk1-x743.google.com with SMTP id n11so10731358qkn.8 for ; Sun, 24 May 2020 16:57:51 -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=KnCrzlEjsfoAQJ2vuCQBZGIyVUirCRVTyeXStV4i7EM=; b=F6VsXuGETgOOczOvg8Bquay04RDy5umxA029YtYcNF8N1gsu2sYTb+vXBZBSjcLqxK nbl/VKMNWQiRLWmtkUcY0KW4Ak+gVsQaFIqvvdrwIytV8lNHpfF5IXfj7hIwvEwdd+s6 NzmN5eFFOD8iyN3Jwsdgst77v7KTXXZsCIpJiK9lhXql3Hm9F/B+pL3NkMr73bC3eKM2 +rF5D0jHIGjq0KsTO/abWrF4n1mXupO349H2NZfCqk4/IY9wdrH8JrlHyz6VZYAxzQlK hhMLhQi0/KThSgJ/Xh/aMxK6PV1klX7uqIM6UmIAVzn6kC1YqXdnpZuhfBoTsvcQJiH3 IUag== 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=KnCrzlEjsfoAQJ2vuCQBZGIyVUirCRVTyeXStV4i7EM=; b=R/6TDE5sCLqZJD9Q1J3tE23Qd63Abz1avZtkp0+hICgldMwA4qG0E4rkvBLIGgYrAT V1ZIMb0zQFgROsVY4JpAWA/jV3iVdvXBDhJvLyPiBa6X/QGmclo0tWX3tMzHEHwuvbRv h+hNYYT5vdxBjzKst5WiIRdjUnDZIKzSMcSzrQ83Rwb/39WM6GpjFU88NR6gzaUK+/Lc JDx5D+d2zY2m49SLk9PbcStGuRuRXf+8KdJrNhRJQK7ICBbgWg4D2yvpxcptMSz378Qr kGtfBM6sVXKEjPGed55iavLu51lHl5xCjIkrrC7/63dwW7/+YbrbcabHp8LASwZvqrbd MEAw== X-Gm-Message-State: AOAM530VVFVEKFezV52DSG95qOYXc2KIMN5jJtN4O2b2x4b+TgbNg47R Xs2Mvd4OcgMGCjAdQJfBLlukmqhS X-Received: by 2002:a37:84c5:: with SMTP id g188mr23223696qkd.344.1590364671056; Sun, 24 May 2020 16:57:51 -0700 (PDT) Received: from rani.riverdale.lan ([2001:470:1f07:5f3::b55f]) by smtp.gmail.com with ESMTPSA id f33sm15093959qta.44.2020.05.24.16.57.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 May 2020 16:57:50 -0700 (PDT) From: Arvind Sankar X-Google-Original-From: Arvind Sankar Date: Sun, 24 May 2020 19:57:48 -0400 To: Fangrui Song Cc: Arvind Sankar , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org, Nick Desaulniers , Dmitry Golovin , clang-built-linux@googlegroups.com, Ard Biesheuvel , Masahiro Yamada , Daniel Kiper , Kees Cook , linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/4] x86/boot: Check that there are no runtime relocations Message-ID: <20200524235748.GC280334@rani.riverdale.lan> References: <20200524212816.243139-5-nivedita@alum.mit.edu> <20200524233607.cihnsmxuaqoy7xi4@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200524233607.cihnsmxuaqoy7xi4@google.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, May 24, 2020 at 04:36:07PM -0700, Fangrui Song wrote: > > `grep -qF .rel.local` from 98f78525371b55ccd1c480207ce10296c72fa340 > may be incorrect.. None of these synthesized dynamic relocation sections is > called *.rel.local* ... > (it probably wanted to name .rel.data.rel.ro or .rel.data) > > > Reviewed-by: Fangrui Song At least from gcc you get .data.rel.local sections if you have, for eg: struct { void *p; } foo = { .p = &bar }; where bar is defined in the same file. These aren't relocation sections, foo is actually placed in the .data.rel.local section instead of .data. But yeah, it's incomplete, you wouldn't catch it if bar was external (foo goes in .data.rel) or foo was const (foo goes in .data.rel.ro*).