From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC054C4332B for ; Wed, 20 Jan 2021 18:52:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 82A4A22473 for ; Wed, 20 Jan 2021 18:52:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387525AbhATSvY (ORCPT ); Wed, 20 Jan 2021 13:51:24 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:47530 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390047AbhATRkO (ORCPT ); Wed, 20 Jan 2021 12:40:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611164316; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oGGCmA0OrDAFQ859/Q0LnejciDnPGfHlYFyTyvifQtk=; b=eGmZcYGE0h/Y8fXx0KRtSR1jxg/4LWz6TO2YYAQ3TTNz5kpCOZ17z1q63cidN3Rq5qC9C4 hw53UE7bh/8mzzECZcRarlmJJYtczN1jXOxCb830ORfq7Q2RSSrftTTEIOYAmyAEXgeuK7 TcZonuhbDNcvm12WmniHPHsBxaWgEYQ= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-52-Sj4SLjamOEOopUpfjY_jig-1; Wed, 20 Jan 2021 12:38:33 -0500 X-MC-Unique: Sj4SLjamOEOopUpfjY_jig-1 Received: by mail-wm1-f70.google.com with SMTP id u67so1305827wmg.9 for ; Wed, 20 Jan 2021 09:38:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oGGCmA0OrDAFQ859/Q0LnejciDnPGfHlYFyTyvifQtk=; b=RmxOt2vIBhJV19V5wyBTDX9guO2lSqAKJeSkxBrdGSSW7WYGlzFMx/aTBeWR9cyGB7 Q7cS8MZilLDr2SR7RS+HxNHlnfeaqK2okIN92r2eH9pvkPUbwJm6TqpvEcodqrlqVhF2 HYO1sdgX9RDWEoMQkpa0K7pdZUdDjNSOjsOdO0fXpSIHNkk93gzvUNeu+eHlttpqyxME wErqT/geio70lv5iGhQ/gnmUiLXakduvQgJlpaPKNenpbfU17ySp6zkCEUbGhKdL9gw/ kYgut+HBs9hxSalwr3vaRqmBeWWeXnyEyAsNNZwChc5CYTVC69ANrDCAeyN/mdShjddZ 1EqA== X-Gm-Message-State: AOAM533EFKLeMTwqRqfIcxhC11HPEpp3+hNk4hfZEyQ/ZHJqokJQRZ5G lJ8xEA0jmfJSptT+ddH5/Qbqsl8mIQflniyFcu7DPhWQesCewnWYCuf3udK0OHYeJmEcEEgxUi/ 3UQYprzK/jJ8n9U+9oxg5hVfjG33rPRWE2CUV1uklmk+b2LecD6u8WyvdRLlciCFNpOEqicd2QC 4h X-Received: by 2002:a5d:4a09:: with SMTP id m9mr10650937wrq.359.1611164311930; Wed, 20 Jan 2021 09:38:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJykIx+mFRDz39bWZUr6EuNu+ftrUmcrlFbF3bvA/9HzFKbHf9ER+LSC2Ppw5dI+TMNMsSLSCQ== X-Received: by 2002:a5d:4a09:: with SMTP id m9mr10650911wrq.359.1611164311737; Wed, 20 Jan 2021 09:38:31 -0800 (PST) Received: from redfedo.redhat.com ([2a01:cb14:499:3d00:cd47:f651:9d80:157a]) by smtp.gmail.com with ESMTPSA id x11sm4948325wmi.4.2021.01.20.09.38.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jan 2021 09:38:31 -0800 (PST) From: Julien Thierry To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: catalin.marinas@arm.com, will@kernel.org, ardb@kernel.org, masahiroy@kernel.org, keescook@chromium.org, michal.lkml@markovi.net, jpoimboe@redhat.com, peterz@infradead.org, mark.rutland@arm.com, broonie@kernel.org, linux-efi@vger.kernel.org, linux-hardening@vger.kernel.org, Julien Thierry Subject: [RFC PATCH 11/17] efi: libstub: Ignore relocations for .discard sections Date: Wed, 20 Jan 2021 18:37:54 +0100 Message-Id: <20210120173800.1660730-12-jthierry@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20210120173800.1660730-1-jthierry@redhat.com> References: <20210120173800.1660730-1-jthierry@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org EFI stub cannot have absolute relocations in sections affecting the execution flow. However, for sections that get discarded at link time, it doesn't really matter if they have absolute relocations. Ignore the relocation associated with such sections. Signed-off-by: Julien Thierry --- drivers/firmware/efi/libstub/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile index 8a94388e38b3..70e9c7f45d30 100644 --- a/drivers/firmware/efi/libstub/Makefile +++ b/drivers/firmware/efi/libstub/Makefile @@ -133,7 +133,7 @@ $(obj)/%.stub.o: $(obj)/%.o FORCE # quiet_cmd_stubcopy = STUBCPY $@ cmd_stubcopy = \ - $(STRIP) --strip-debug -o $@ $<; \ + $(STRIP) --strip-debug --remove-relocations=".discard.*" -o $@ $<; \ if $(OBJDUMP) -r $@ | grep $(STUBCOPY_RELOC-y); then \ echo "$@: absolute symbol references not allowed in the EFI stub" >&2; \ /bin/false; \ -- 2.25.4 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86B92C433DB for ; Wed, 20 Jan 2021 17:49:30 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F169922287 for ; Wed, 20 Jan 2021 17:49:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F169922287 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Y6bLscH7kHjiGnZJuxeJ9TrNhDpWHIXl/kNaXkr2PPQ=; b=ZVseyngY3477g0utCIOEYfZrM APkEmw7mEzQrym7XnJ4IWx4j0suWDb7E8pVGUTD8J3HxvE+DU0Kb58/pv+0tktHQ3QwnQ540liTxI 9zebZ2MK2JRxIUUMk7bAgU5sj6BiPaIeFQ/DFwFJ4vVckznwLet3pOz0WEV9P3sloJzsjNzHLxZVL nr8lJS+uyIOJHqzu0GSM6Q4JP3SaB39dPgc08RvurmYmFPkUG3/hxGZpVASoEOK+2Sz4aNR40Y77o VTr1g5x43KLbLHDp1DH7WaIT2ffk3WltR+8qon10BP4hwQJz0CpDvp7nP/oRbTIPjpjRidLEJI41v Cc8FkDnWA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2HZk-0007fK-2L; Wed, 20 Jan 2021 17:47:24 +0000 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2HSd-0003aB-UR for linux-arm-kernel@lists.infradead.org; Wed, 20 Jan 2021 17:40:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611164401; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oGGCmA0OrDAFQ859/Q0LnejciDnPGfHlYFyTyvifQtk=; b=OIm7p54B5g+OBVrWBN05UKRPqioPFbwOlCmOeCAR822ETqlnyOqBgzvx/hrqIMMtZg4VLY ZF7ckzU9j+QzUZllMgVPSufnmkQWVwz36lcEc1fm3QAXqA77QM/3iAyu4CGOac9olbLelF FotjrsWmlnFWyH16d1KGGQSdbQ7TRNs= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-499-qeieMv08OmezKfEOPD8OMw-1; Wed, 20 Jan 2021 12:38:33 -0500 X-MC-Unique: qeieMv08OmezKfEOPD8OMw-1 Received: by mail-wr1-f71.google.com with SMTP id v5so11967128wrr.0 for ; Wed, 20 Jan 2021 09:38:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oGGCmA0OrDAFQ859/Q0LnejciDnPGfHlYFyTyvifQtk=; b=fKkqS+h4VAWQYSxlmVlYubJ5XA3bs6Auu5qacnVyfFvU8T4q+sP9XMr5PxWU5u2Mki wIMEzUVICRXzMZd+s7aPHMQ0Ra1p90Ga/uWtY269op7XMbxLSvee96ZYtrXvSdzb3RxL IxjqWu6q2vHVrvUndRC6fj6p/nW2qd3ceA9fYkKnLCXvp+fmePOUi9fMyyRrNn96vdxl qPjEmdzfSPMd5Ki9CWwMNk4X4n/Q1pOIkfIHD5LnxUZYFPbP3bOOksaY5K8CIZRIkDwu H030uUtyzzWyGfyMXy1gBiAcJtC9b2VhmR5bUvgQz94giUDfOtUTU1YZybdQPnKmn7Hv TdlA== X-Gm-Message-State: AOAM532ZusaRiBRhAmjyFurRttCDZMjgL16C/1YHfouNR2IM6c22CwC4 tPFycNz3SHEZMVrOVt/McpQNSHvQ4VeKqCZoXyF9KCMfbOWf59Gf3Y4mIcZnG5zljYoG9Lq3bhe KyirhYP3Sul2ZV+S5aL2A770ED7XEof3u2gk= X-Received: by 2002:a5d:4a09:: with SMTP id m9mr10650930wrq.359.1611164311855; Wed, 20 Jan 2021 09:38:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJykIx+mFRDz39bWZUr6EuNu+ftrUmcrlFbF3bvA/9HzFKbHf9ER+LSC2Ppw5dI+TMNMsSLSCQ== X-Received: by 2002:a5d:4a09:: with SMTP id m9mr10650911wrq.359.1611164311737; Wed, 20 Jan 2021 09:38:31 -0800 (PST) Received: from redfedo.redhat.com ([2a01:cb14:499:3d00:cd47:f651:9d80:157a]) by smtp.gmail.com with ESMTPSA id x11sm4948325wmi.4.2021.01.20.09.38.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jan 2021 09:38:31 -0800 (PST) From: Julien Thierry To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 11/17] efi: libstub: Ignore relocations for .discard sections Date: Wed, 20 Jan 2021 18:37:54 +0100 Message-Id: <20210120173800.1660730-12-jthierry@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20210120173800.1660730-1-jthierry@redhat.com> References: <20210120173800.1660730-1-jthierry@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jthierry@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210120_124004_119178_B6363E68 X-CRM114-Status: GOOD ( 13.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, linux-efi@vger.kernel.org, michal.lkml@markovi.net, keescook@chromium.org, peterz@infradead.org, catalin.marinas@arm.com, masahiroy@kernel.org, broonie@kernel.org, linux-hardening@vger.kernel.org, jpoimboe@redhat.com, will@kernel.org, ardb@kernel.org, Julien Thierry Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org EFI stub cannot have absolute relocations in sections affecting the execution flow. However, for sections that get discarded at link time, it doesn't really matter if they have absolute relocations. Ignore the relocation associated with such sections. Signed-off-by: Julien Thierry --- drivers/firmware/efi/libstub/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile index 8a94388e38b3..70e9c7f45d30 100644 --- a/drivers/firmware/efi/libstub/Makefile +++ b/drivers/firmware/efi/libstub/Makefile @@ -133,7 +133,7 @@ $(obj)/%.stub.o: $(obj)/%.o FORCE # quiet_cmd_stubcopy = STUBCPY $@ cmd_stubcopy = \ - $(STRIP) --strip-debug -o $@ $<; \ + $(STRIP) --strip-debug --remove-relocations=".discard.*" -o $@ $<; \ if $(OBJDUMP) -r $@ | grep $(STUBCOPY_RELOC-y); then \ echo "$@: absolute symbol references not allowed in the EFI stub" >&2; \ /bin/false; \ -- 2.25.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel