Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp2480687rdd; Fri, 12 Jan 2024 10:37:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IEsVHuaxUvEji9X9YmfOzRwFDfHP7Rs8ga+AX/1b5V6S6MtlkqKaysuGw0jrFcZ7o0tzAzZ X-Received: by 2002:a17:90b:11c5:b0:28b:d560:d44a with SMTP id gv5-20020a17090b11c500b0028bd560d44amr4060869pjb.44.1705084667389; Fri, 12 Jan 2024 10:37:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705084667; cv=pass; d=google.com; s=arc-20160816; b=Y+OVAVJ4lw1vDqpElaU2byMPLUTmduPvgf6EW2VjdWt4DOC4AsTvvh0CHwKJ3ofXny h32Omn4RCWTEjBvL/UYVnV9a5Ewk2gvlh8l00fDMi2SSN/SUBA634OanReeMw6yFRrDM Jpw48MMIdwr6D9k+BAnreHWT5X+PmHJQcxFdmSE+gyMX4Ft+ym03urow0zxseSl75gWx SPy3+hP5/7rAMQEI735C30sut5y+P4rpeCPPMYMmeYOtESVvY18ykVXtiYO+hltfeLNn cvD4OYARd3o5uLM5oevlMAiYJwQXscHGRpzcF9SNwbo//VdsgRl7gBz4H0l4ZddTSKXk o9AQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :content-transfer-encoding:cc:to:content-language:subject:from :user-agent:date:message-id:dkim-signature; bh=O/LENPqC9BmBNWPKYaIBYOfpLLIo80zXFYbB2OELyFQ=; fh=1FiVQ9eVZZOQZKx/h04/Nl33R+un24l6pAvOdvXuTsY=; b=MxAOMqoHgbBFHCixMFRqglc8olJXdMIqE9MtBHhH0nk2z31Rdhk7vEE03N9+8ARNEo jTCZmIefOKqiisHaWu6wCHgHkfUMQFbrAs5docl+LRaHAXPyqK5se5dCr/vHqcZeMBIL YWyP1r1YSSCZQks+gbUrbFQuKMhOhg5FSZECtzzPVBLNR6KFAM1yhfr/0uebkQKFxmxh mYwQGJZmrfaNauxhxFj2QNPejAszS4gVxu4hKvbNQgCzwLUXq9AFpLrAgSukbaMlQrB1 NXHri5BiXz7PJDKMvUpPajQVKDyhiim51Al9RQds4mY+e85s0sdS1UDc3Kr43LI9vdkD JY+w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=P1LMye9I; arc=pass (i=1 spf=pass spfdomain=siemens.com dkim=pass dkdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of linux-kernel+bounces-24977-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24977-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id lk4-20020a17090b33c400b0028c85b3eabesi4060774pjb.155.2024.01.12.10.37.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jan 2024 10:37:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-24977-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@siemens.com header.s=selector2 header.b=P1LMye9I; arc=pass (i=1 spf=pass spfdomain=siemens.com dkim=pass dkdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of linux-kernel+bounces-24977-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24977-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 10ED42848F0 for ; Fri, 12 Jan 2024 18:37:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 66C7E154B9; Fri, 12 Jan 2024 18:37:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=siemens.com header.i=@siemens.com header.b="P1LMye9I" Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2073.outbound.protection.outlook.com [40.107.22.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 076C014F6C; Fri, 12 Jan 2024 18:37:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=siemens.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=siemens.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VMhBC6C6RRlpknmfJW6kWKljxY1vgBjAh6jQCiDkx7fM/z98XiIHvnFOuehRoCZxx9vmlyUqfEwEl3NlgwTuT5I9QnJP1PUxHaGBa8HbSUmt9thlXW1kMUp09FPWwWT8G6ifty7CcgehuTHJ6iH9TPKh/6JjRED3YQmf+DxhLQa7Dr04n5iTwWiEsUW7K+f93Dv4/UQmGFidVDdziuxosi7IfGcz8SEY/YBEC+Y51pSkTIPf/BSmx8kyz6zzoDyaD/pJxrE4A2oOgaHjq5S1Wzjs5tvSeGI8+s7UYgU1DS/Mq6IBYs0YT8P6ZDNqdKFUDErowpD39EL0xJnuac5YAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=O/LENPqC9BmBNWPKYaIBYOfpLLIo80zXFYbB2OELyFQ=; b=PP4BOqp/NRnXKQJ8zFgzUXxEovnWdUDexzgCfhpsaFyA3qRDnb2MDRvnsVfkY0k+MHFjTpFWzqX8LJ+Ozd9nEYe4NAUtgioGHeokkLy0o7GeDkOdaPrU416Y3D4rTmyyIr3SpktGtARiGHRZk5Y0R+T1m0qH4ucwspLhG0fNq80+2AtZJu3Qpaox8j5M2n/MKtzUFBb6gnzDrZsG1lqHdgvOLrdJAkFKY2xghFFTkSe7nsFhXrCIMyUUDpCbW3fRN9U94g85n/BtTMHrgumO1nb6nP15KyXmtgfjG3tZyfNub6gBQPFkfdmEzNp5Tpl45UCFJyBnBGnhTIEWYHfADg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=siemens.com; dmarc=pass action=none header.from=siemens.com; dkim=pass header.d=siemens.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=siemens.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=O/LENPqC9BmBNWPKYaIBYOfpLLIo80zXFYbB2OELyFQ=; b=P1LMye9IMs24t1QtbdnMVHIAVrsXbG4n8dNifPGO3kc//tRHXrIiPuWeDdeg9Oo/r4ujO3fHOUymemhe05cvCe9gAtNjLfMCZyEdgcMU0BbXnsb5OpxxqXnjlijhlWgshGmUHvdT0peoPp9+oa8LUZir9M8pLJeJ7cchLCIvYrOAKS/ympy8UEEq+hsu7HHu9dxxk9v4lWWhe49BB7KaEQ4LWdZu2aeDoTIKqGy3SQVs0i8Z0Nku3FiPIHG2wNAN9R4EAsWM50Q7ezVjTf9WRnoaWwDK+eqJxE+Lu7XhjVZ7Bgs18tf5aiAM1GiIdNIZw3ohRZQvJFvs2e+IBYcq/Q== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=siemens.com; Received: from AS4PR10MB6181.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:588::19) by AS8PR10MB6890.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:5b4::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.21; Fri, 12 Jan 2024 18:37:35 +0000 Received: from AS4PR10MB6181.EURPRD10.PROD.OUTLOOK.COM ([fe80::8d16:7fbb:4964:94fe]) by AS4PR10MB6181.EURPRD10.PROD.OUTLOOK.COM ([fe80::8d16:7fbb:4964:94fe%3]) with mapi id 15.20.7181.018; Fri, 12 Jan 2024 18:37:33 +0000 Message-ID: <42c63cb9-87d0-49db-9af8-95771b186684@siemens.com> Date: Fri, 12 Jan 2024 19:37:29 +0100 User-Agent: Mozilla Thunderbird From: Jan Kiszka Subject: [PATCH] riscv/efistub: Ensure GP-relative addressing is not used Content-Language: en-US To: Ard Biesheuvel , Palmer Dabbelt Cc: linux-efi , Linux Kernel Mailing List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: FR4P281CA0259.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:e8::9) To AS4PR10MB6181.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:588::19) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS4PR10MB6181:EE_|AS8PR10MB6890:EE_ X-MS-Office365-Filtering-Correlation-Id: 4e87843f-fdae-4d8c-2374-08dc139d8a8f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YpsqL4gZ7SI6EkVdFflwHPooIXl6Eabe1bV6iLApzqB6gBuQuJEVzUtvJC7coPc7Ak/ycJN6gR+HOHksTh6gDr0OtyBCuoYBb8QwfGoKs5DC1ycmiUj4FaFJ7sCt8QBvnJqY058gbA1svBS/QWqSbHyqMC7wwdPF5unt28osHnW+m8HG5p1cemeaBdetJDTHaKypN+gDTX9rclZq0uVBrZBWq9BOo9zzb4BaCeOEbyD7YV3FdpjhHvbC9dcEQ36Oe5vj6qyFHdQDSsAKEsnclHG0No7LOwFaYlKSYJg/JrdKEVtLm1T9ndmSoVM+wtXPcEp8XqElcIH4EV+V5p7hcx/YwFMq1rWsowrZocyxokySOHM6JGoFoDjt6jBUr/ULWiqL+hUWlSMRBdVkoGWLBgXPuEH8yxD08VI9iTOc3o1pM/ljdbwFJS0Q7tqYj3/faFms3ksfXBJ4htnLeDjBipGtkEn2uAuwXogySciYzxAECvPVd6Jc5t9IaGL+1WkvhSzT3QREXrpwp1ShH9X+rd3RfClhsU7HbFXvL4CZqKUDtGbTL52eDkY3bIbrRwo7coOts/9gbudgIrjaNSk/KrCkw5aetKNsg/fYOWgS68Gx+D3ZTztudPU+wI4ZolQDb/Phr5kg+h9SF1SHbb4nDg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS4PR10MB6181.EURPRD10.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230031)(136003)(396003)(346002)(376002)(39860400002)(366004)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(44832011)(4326008)(8936002)(8676002)(2906002)(5660300002)(86362001)(82960400001)(31696002)(36756003)(2616005)(478600001)(83380400001)(26005)(6506007)(41300700001)(6512007)(38100700002)(54906003)(316002)(66476007)(66946007)(6666004)(66556008)(6486002)(110136005)(31686004)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?QU9zZTRscERuR05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FFKdHNkZTQ4MlRiQVJi?= =?utf-8?B?bW5oMERlS2tKRXBscEppZWZsdURDWHJ2T3ZtOXNmNXRGS2cxWEFnUG0wTDl3?= =?utf-8?B?SE12WWRvL29CL0RUeTJ2ZE53T1RuN3VUMmQ1SEpXYldoZnNsTVB3MzlKbXJy?= =?utf-8?B?ZHRjTW9JNzVreGhHS2ZTRlZKSDZzaDR1VG0wTFBIWHJ2UHpTRVFkOEpwSzRu?= =?utf-8?B?QkZ0QjU5MzEzTllHODYxeHNOaXU1dHRrWTVRRmRsREpnU1haejM2MGtBVHEy?= =?utf-8?B?cnIvL2FyMGJpREMzRkczbUdvbXV1cHhwR3FzeDF0WGc1ZkNFalNZM29RWjBi?= =?utf-8?Q?lOsAEuqF8gOOok4hxYw4dp6A5?= X-OriginatorOrg: siemens.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4e87843f-fdae-4d8c-2374-08dc139d8a8f X-MS-Exchange-CrossTenant-AuthSource: AS4PR10MB6181.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2024 18:37:33.6084 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 38ae3bcd-9579-4fd4-adda-b42e1495d55a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: lq62neP7DPeyr8A/pFG4K0mpD0EqPSd2gpk6aj6MHLOxooJ/gUhmv5XVWZ64b9aRU7iGZ82xDkvLBeS5o58wNg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR10MB6890 From: Jan Kiszka The cflags for the RISC-V efistub were missing -mno-relax, thus were under the risk that the compiler could use GP-relative addressing. That happened for _edata with binutils-2.41 and kernel 6.1, causing the relocation to fail due to an invalid kernel_size in handle_kernel_image. It was not yet observed with newer versions, but that may just be luck. Signed-off-by: Jan Kiszka --- Something like this should go to stable as well, but we will need rebased patches. 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 06964a3c130f..d561d7de46a9 100644 --- a/drivers/firmware/efi/libstub/Makefile +++ b/drivers/firmware/efi/libstub/Makefile @@ -28,7 +28,7 @@ cflags-$(CONFIG_ARM) += -DEFI_HAVE_STRLEN -DEFI_HAVE_STRNLEN \ -DEFI_HAVE_MEMCHR -DEFI_HAVE_STRRCHR \ -DEFI_HAVE_STRCMP -fno-builtin -fpic \ $(call cc-option,-mno-single-pic-base) -cflags-$(CONFIG_RISCV) += -fpic -DNO_ALTERNATIVE +cflags-$(CONFIG_RISCV) += -fpic -DNO_ALTERNATIVE -mno-relax cflags-$(CONFIG_LOONGARCH) += -fpie cflags-$(CONFIG_EFI_PARAMS_FROM_FDT) += -I$(srctree)/scripts/dtc/libfdt -- 2.35.3