Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp4283331rwo; Tue, 25 Jul 2023 03:52:02 -0700 (PDT) X-Google-Smtp-Source: APBJJlFXhHTqFQD8pmKlAZXfqXXY9TVZ6btM2Mv/0oINj/iZeejhgP1dMur2gj1VzeDrdc/lY2W0 X-Received: by 2002:a05:6a00:1902:b0:682:3186:55e0 with SMTP id y2-20020a056a00190200b00682318655e0mr8857676pfi.12.1690282321773; Tue, 25 Jul 2023 03:52:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690282321; cv=none; d=google.com; s=arc-20160816; b=r/xI1zhnHdu10ApebpQ0tgTdBy1tX9ErIR85n2iaS4BWXCTJQ4Z1G5qxWYBKzaX31l 2quVPY7lxzr6xXzYhEmj8WAzCkmq+aXUQMJmjlJ669KcuHasOFsa7RYV72jRXcWFfjDS txPMcdSpfMvCDTtITSVH98I9hpCE7SxGrVN4rCuCDj6eRjdhHcTv0dATlwQvGGP92E8J VQHdCtel9Qti43YI4gbUbYAPQ+xtIznXwwTsf7YQC5yRojshll86IQLPBNEfkgNhOP1a PtEFNKCtz9OAYaipjiLB+Cp599cuynvB4xcFS4+cql1qvkHzfI8m+svf7D6LRZETUAiX G6EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=d3UjQ73S3BxL3LS2+8AAwuT67e6Zj/U4XgOGhWdzNcI=; fh=/nInPytdKF4ye7oSvNrJgqmCCnHZnI9mT8NAp54QFkE=; b=oFQXt5MmIgAiTdragu22fGUd6r/t8pqHddGpcdsG+YqoDbps3JSOe63NICVV4tZB+a kKZpsWmKCVTT2JtG8GIv9SrMawslOf4jzVpKJfCiYuTt6+Zi59Wr9YOi68PvlR6hz9NY XfsdOt/zvvsJYlgH31A+biGxuMEThXqRMftw2BlToubG6JbVsCsztxwAVskF5JYgQzxh QG/u7TsBA4N3+53nnkBxPVqUX7pbklFw+fqT/wQQTnqERTuhiRnPQuexqrI6Z6nycxAH edSOpdnRhor4vZjLhJEzK6o+28vtokZ4vvFSPZr84HCtHjXEq8VzF/YQgop5aC98a3sO Tbcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tesarici.cz header.s=mail header.b=p6x10Yht; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tesarici.cz Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b9-20020a63d809000000b00563571a8d0esi11572077pgh.858.2023.07.25.03.51.49; Tue, 25 Jul 2023 03:52:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@tesarici.cz header.s=mail header.b=p6x10Yht; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tesarici.cz Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232815AbjGYKP5 (ORCPT + 99 others); Tue, 25 Jul 2023 06:15:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232654AbjGYKPz (ORCPT ); Tue, 25 Jul 2023 06:15:55 -0400 Received: from bee.tesarici.cz (bee.tesarici.cz [IPv6:2a03:3b40:fe:2d4::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D0B11728 for ; Tue, 25 Jul 2023 03:15:42 -0700 (PDT) Received: from meshulam.tesarici.cz (dynamic-2a00-1028-83b8-1e7a-4427-cc85-6706-c595.ipv6.o2.cz [IPv6:2a00:1028:83b8:1e7a:4427:cc85:6706:c595]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bee.tesarici.cz (Postfix) with ESMTPSA id 6E99616E7EB; Tue, 25 Jul 2023 12:15:39 +0200 (CEST) Authentication-Results: mail.tesarici.cz; dmarc=fail (p=none dis=none) header.from=tesarici.cz DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tesarici.cz; s=mail; t=1690280139; bh=VkSwamAp/4PDPv7DdYCrtZQ5vmXGPZLbqsG5fwWzuZo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=p6x10Yht8ow48zlrALbeY2e4IicnzbpwZLWp9qIt+gAjalRXgUE2EMKYQe93s+Wty OLQJ4s9WLrmhjHqzKlJ7BdXR8lmGJakv1WIWZnAdt1QImnmnur6uRrtJgOsCEG5Ixv 67kEzE64ng+hilOryKzXuKOYKRIbGyu1DL460HDayizReh1NBVmXoLBjniDiVU4q06 viKPt1HvhkjWx5A4k4rrkHEHVZ/ZdSlqSr+uxtHIAugwjbfRiDl1/50VIcpf2q5O7D O214xNUZNaHf2zYwx9C0Z+UUERZLxpGkZmMy5l/nFQSJ1qxuK2oPOpB976q6Jvhg1p 05ofrg+vXWnXA== Date: Tue, 25 Jul 2023 12:15:38 +0200 From: Petr =?UTF-8?B?VGVzYcWZw61r?= To: Petr Tesarik Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Li Huafei , Liao Chang , Masahiro Yamada , Alyssa Ross , Nick Desaulniers , Ricardo Ribalda , Kees Cook , Heiko Stuebner , Li Zhengyu , linux-riscv@lists.infradead.org (open list:RISC-V ARCHITECTURE), linux-kernel@vger.kernel.org (open list), Roberto Sassu , Torsten Duwe , Torsten Duwe Subject: Re: [PATCH v1 1/3] riscv/kexec: handle R_RISCV_CALL_PLT relocation type Message-ID: <20230725121538.2bb4b64f@meshulam.tesarici.cz> In-Reply-To: <652f652d571458522a615040f68a885f10b45ca7.1690274483.git.petr.tesarik.ext@huawei.com> References: <652f652d571458522a615040f68a885f10b45ca7.1690274483.git.petr.tesarik.ext@huawei.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org +Cc Torsten (somehow missed from the original Cc list). Petr T On Tue, 25 Jul 2023 10:44:25 +0200 Petr Tesarik wrote: > From: Torsten Duwe > > R_RISCV_CALL has been deprecated and replaced by R_RISCV_CALL_PLT. See Enum > 18-19 in Table 3. Relocation types here: > > https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc > > It was deprecated in ("Deprecated R_RISCV_CALL, prefer R_RISCV_CALL_PLT"): > > https://github.com/riscv-non-isa/riscv-elf-psabi-doc/commit/a0dced85018d7a0ec17023c9389cbd70b1dbc1b0 > > Recent tools (at least GNU binutils-2.40) already use R_RISCV_CALL_PLT. > Kernels built with such binutils fail kexec_load_file(2) with: > > kexec_image: Unknown rela relocation: 19 > kexec_image: Error loading purgatory ret=-8 > > The binary code at the call site remains the same, so tell > arch_kexec_apply_relocations_add() to handle _PLT alike. > > Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file") > Signed-off-by: Torsten Duwe > Signed-off-by: Petr Tesarik > Cc: Li Zhengyu > Cc: stable@vger.kernel.org > --- > arch/riscv/kernel/elf_kexec.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/riscv/kernel/elf_kexec.c b/arch/riscv/kernel/elf_kexec.c > index 5372b708fae2..38390d3bdcac 100644 > --- a/arch/riscv/kernel/elf_kexec.c > +++ b/arch/riscv/kernel/elf_kexec.c > @@ -425,6 +425,7 @@ int arch_kexec_apply_relocations_add(struct purgatory_info *pi, > * sym, instead of searching the whole relsec. > */ > case R_RISCV_PCREL_HI20: > + case R_RISCV_CALL_PLT: > case R_RISCV_CALL: > *(u64 *)loc = CLEAN_IMM(UITYPE, *(u64 *)loc) | > ENCODE_UJTYPE_IMM(val - addr);