From patchwork Fri Jun 24 04:48:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 12893799 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1630C433EF for ; Fri, 24 Jun 2022 04:50:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231774AbiFXEtz (ORCPT ); Fri, 24 Jun 2022 00:49:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231861AbiFXEs2 (ORCPT ); Fri, 24 Jun 2022 00:48:28 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CFDB68096 for ; Thu, 23 Jun 2022 21:48:26 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id h9-20020a17090a648900b001ecb8596e43so1685951pjj.5 for ; Thu, 23 Jun 2022 21:48:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; h=subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding:cc:from:to; bh=vBU/QhGWkV1K4rpRU6iuVI+/0UvyZtTiMv0XrxYPMnY=; b=KBTXLVQ9Myy+5fRcw18yS0lVJWlJWOdd7MztywK2mmLs41m1QyL9u71UUmRkZsVufO WBGDCzLQmzxvYVvsyvL43mR/VUG7XnIdk39+oF8XwhmacjrZkaSZcXbdPN9I5HafTNer xr82vLEO3N2V2NbYCHw86NmaenfnQTgypXQywZ3rOFxQ8Ry2BA3Q6/1czAnoeM+amgXI PXNiI40EmhGP/RqKwo10U5bHYT3e2eMwbnXUA42H/MeYjCJBsRUSv0ePUpNifVLgVv1h EOnTPql0DKaJ4Wn1LDQyp0D911OQtivur+xe4+XmZBEwj8WkviY0CU/CFaC8mcdEguoD tZuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:cc:from:to; bh=vBU/QhGWkV1K4rpRU6iuVI+/0UvyZtTiMv0XrxYPMnY=; b=kTEHpW4vLegNd0S8rYvv8GemGIuU5QJdEE3uZqavaNMhtXBs5fRt69UxUmtrtrRvo/ jImushUb9GcG2yavHT/b3lFE3sTRLCVqrNaEcCT+v5ypBkFxIP4tLHeXuLMUD3s2+Fpi F3V6jzfFxuIaopqmTIU8MqJ7tmvPOC0Ilqsyg42H69fJqxdzQkrXkO3vCdnomZRan/Ba WvIFSZemreHfhaorEgNXlrGBkCKmA9OxW2HaJcb5v7YbYUrRijNcsiBDWPCT681krUFT UV9NbmRmAvQlCguUAxUzWYopvnr1NldxBIHMDAglXTvvRRxWrUlLnD+D1tZFpuMN96n4 go/w== X-Gm-Message-State: AJIora92unKEsWTUkKjFc+6eQ2bAkkL89lAe/bd53iraQjQWiGA4vynl e1uxMbT0g4Ca/Eq7+EJ7nbuIAKuyD5nzrA== X-Google-Smtp-Source: AGRyM1voXMrdQb1DI39mijMlt8wYaDCo2EZoNrpq8QsrSaFoZs/0+hNfar1BHQvqZ1cGC/I8u7r8Ug== X-Received: by 2002:a17:902:7202:b0:167:6548:3f3e with SMTP id ba2-20020a170902720200b0016765483f3emr41641064plb.98.1656046105816; Thu, 23 Jun 2022 21:48:25 -0700 (PDT) Received: from localhost ([12.3.194.138]) by smtp.gmail.com with ESMTPSA id x13-20020a056a000bcd00b005206d4fd636sm559062pfu.2.2022.06.23.21.48.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 21:48:24 -0700 (PDT) Subject: [PATCH v2 1/5] drivers: of: kexec ima: Support 32-bit platforms Date: Thu, 23 Jun 2022 21:48:07 -0700 Message-Id: <20220624044811.9682-2-palmer@rivosinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220624044811.9682-1-palmer@rivosinc.com> References: <20220624044811.9682-1-palmer@rivosinc.com> MIME-Version: 1.0 Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, Palmer Dabbelt , Rob Herring From: Palmer Dabbelt To: zohar@linux.ibm.com, dmitry.kasatkin@gmail.com, linux-integrity@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org RISC-V recently added kexec_file() support, which uses enables kexec IMA. We're the first 32-bit platform to support this, so we found a build bug. Acked-by: Rob Herring Signed-off-by: Palmer Dabbelt Reviewed-by: Mimi Zohar Reviewed-by: Mimi Zohar --- drivers/of/kexec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/of/kexec.c b/drivers/of/kexec.c index b9bd1cff1793..ed3451ec2b24 100644 --- a/drivers/of/kexec.c +++ b/drivers/of/kexec.c @@ -236,8 +236,8 @@ static int setup_ima_buffer(const struct kimage *image, void *fdt, if (ret) return -EINVAL; - pr_debug("IMA buffer at 0x%llx, size = 0x%zx\n", - image->ima_buffer_addr, image->ima_buffer_size); + pr_debug("IMA buffer at 0x%pa, size = 0x%zx\n", + &image->ima_buffer_addr, image->ima_buffer_size); return 0; } From patchwork Fri Jun 24 04:48:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 12893801 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31D90C433EF for ; Fri, 24 Jun 2022 04:50:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232048AbiFXEu0 (ORCPT ); Fri, 24 Jun 2022 00:50:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231877AbiFXEs3 (ORCPT ); Fri, 24 Jun 2022 00:48:29 -0400 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64DFA69272 for ; Thu, 23 Jun 2022 21:48:27 -0700 (PDT) Received: by mail-pg1-x533.google.com with SMTP id 184so1324823pga.12 for ; Thu, 23 Jun 2022 21:48:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; h=subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding:cc:from:to; bh=YbFhCGzhKhLbr2G2ThS1s0sN7jwXYQ4vWhYkrXF5osc=; b=kkxvDxX6n5CO12HAysNPgLTCaKTovZj6n1W4WM6NrdWPKdt8jHf/gjXiqu7I26pISm ua6NuOBU0e747Hkio56Q5FXCk7rSyhq3Y6Zq55CZ25pU97Fj2MfR7zJOcZ41hi7FIff1 UZdKWwl3KHRXa7tdvTwjrgx6d6+yqM9BG8AZIhTjl1u7f/aVNNosUAXA5LKe9/MYnIvG LlPZDl/L+rPWYZtuuiuwai4BFZqZ2PEnrQKWLvGk7JAWOVawnMXlmZxb2Q+2Kgculowg wQXZjqI2+6jVMZLja/f8RD2VIlQY6lApwCHArAD4TdMuo1d9XJYF0lETVOugyAaATC3x mPRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:cc:from:to; bh=YbFhCGzhKhLbr2G2ThS1s0sN7jwXYQ4vWhYkrXF5osc=; b=MGf9KMQZcfqZx0AbvxiVTOayXGZyAbBKmsvgiDCucpKBigHk4L7TBdNYFiaWL/Ubm6 SWSNBhM73TZtE/w9bQV5Z7gnQfrlQg89EfnD3bYgTtTkHjjIBxYBRti2boKTYeeiH3lV YGSQhEiZ5MOuXAjYmspUIFvttpL3tKoXYNZ98issSfIOVKSjFIF8lnlcfb0V1X3oRHPe eWXwsa0/TlLMtDsN1l/Wub/RaioS9UK4mcUyOJVNo7VxFtTYwCmfzWS8F2qc1rFf6QDf 1m0T3gqxIepjvcQP/JenqCu7ybNJEcGJga6x/a9nds9u8BJ7oq5mM8bH4BGAaaVmkAGR zb7A== X-Gm-Message-State: AJIora8Qnz6SvUaTzasWf9tGgduDIs5IMbspLjZvJ//jmz2Kh/8Uotuo MlOjn2EXmRd+KSXFD+8ievLK0w== X-Google-Smtp-Source: AGRyM1vJW29/sVxuMxr0tG1PDaIe69h+YLS81Q9kQN6GZXjLMUjcoObBkYAeIvvbIZG+ephEELUDwg== X-Received: by 2002:aa7:9470:0:b0:525:4214:bd9e with SMTP id t16-20020aa79470000000b005254214bd9emr13914582pfq.11.1656046106909; Thu, 23 Jun 2022 21:48:26 -0700 (PDT) Received: from localhost ([12.3.194.138]) by smtp.gmail.com with ESMTPSA id j5-20020a63ec05000000b0040d2f92d30fsm503488pgh.88.2022.06.23.21.48.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 21:48:26 -0700 (PDT) Subject: [PATCH v2 2/5] ima: Fix a build issue on 32-bit platforms Date: Thu, 23 Jun 2022 21:48:08 -0700 Message-Id: <20220624044811.9682-3-palmer@rivosinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220624044811.9682-1-palmer@rivosinc.com> References: <20220624044811.9682-1-palmer@rivosinc.com> MIME-Version: 1.0 Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, Palmer Dabbelt From: Palmer Dabbelt To: zohar@linux.ibm.com, dmitry.kasatkin@gmail.com, linux-integrity@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org ima_dump_measurement_list() took an "unsigned long *", but was passed a size_t. This triggers build warnings on 32-bit RISC-V. Signed-off-by: Palmer Dabbelt Acked-by: Mimi Zohar --- security/integrity/ima/ima_kexec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/integrity/ima/ima_kexec.c b/security/integrity/ima/ima_kexec.c index 13753136f03f..f2a94ec3002a 100644 --- a/security/integrity/ima/ima_kexec.c +++ b/security/integrity/ima/ima_kexec.c @@ -15,7 +15,7 @@ #include "ima.h" #ifdef CONFIG_IMA_KEXEC -static int ima_dump_measurement_list(unsigned long *buffer_size, void **buffer, +static int ima_dump_measurement_list(size_t *buffer_size, void **buffer, unsigned long segment_size) { struct ima_queue_entry *qe; From patchwork Fri Jun 24 04:48:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 12893802 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8779FC43334 for ; Fri, 24 Jun 2022 04:50:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231877AbiFXEu3 (ORCPT ); Fri, 24 Jun 2022 00:50:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231892AbiFXEs3 (ORCPT ); Fri, 24 Jun 2022 00:48:29 -0400 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94E7B6927B for ; Thu, 23 Jun 2022 21:48:28 -0700 (PDT) Received: by mail-pf1-x429.google.com with SMTP id c205so1541440pfc.7 for ; Thu, 23 Jun 2022 21:48:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; h=subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding:cc:from:to; bh=jMCGTpB4qORgO/HAj9/J+wYW1m5dKZO1Y3zKxKtdM4E=; b=vKrF/uHWOix1+6Rl9MXcsk8W+kFQn6mM1CVaeA0uQogMNrgp1k5wMZQey+aLu9X84R BHXhsOPoUF5SO8RkvrBFWIykapEklgV+UwvVqywVNBz3I1je7hl1nHH5FqCv2/bTn5gE b6zmsjYCTjMu2DCbRqxal23S6foeAxjvZ0I9Vb5h7bTIL5rTPNVCdmhSv3BwnpnzJ8+h sFU3SoJoaQ9pnSxUOSPWi0V0Q5O82fR6fWL+FaNZd8GLx4embxn/u/LXoRJYHDE0pb8r gD6DJ+Rd7qA2JTDGwJ+L08FUMO2kUJU+iPqZ6+nAFU93FeYZs3QiOusK8ZsB5m3Zx5Bw TQ3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:cc:from:to; bh=jMCGTpB4qORgO/HAj9/J+wYW1m5dKZO1Y3zKxKtdM4E=; b=PNySNbkrvcVz+7IiNmdDQ4nYPSqA2PHCpa4WplBLq1zI4kBdGHPJe+lDcZycRfKDOJ r+FNulx63EAcKvLkGzhws21C2f3oICErlEBbEQUspqSamL4NwUI/XugApfum7uyOtfBU gyObiFt0KfVS6x9yjL2EQejGejNIi5YBGTmQI7gaMqYYFbOf+D2x6biBK9Lvj5OKII6k prd3LsE5NkyAa30csnymbxwBGmJcax7rPiztyq4EWTk8mGfAuo19U8X/91WLZzKLTFnq Si6P2FAdn00Kj9gqnTGfbd4t5U9SGBTi3qpI/E93T6+VAxMZPLRw5dwOpGj4faVR1J73 DFag== X-Gm-Message-State: AJIora+Qaq8mXqMED6Pr++DFW1351sZi66dzOlR8TL3ua07W2rk7shl5 GFlBZtPghM3BX2kLzrD/2NWP7A== X-Google-Smtp-Source: AGRyM1uXZHQEpXqpNCieCPKUs298Zc7ZlsXzMC3KKqzIqfHMvB+F20JyDbM4hFNh9MRoTPgZTKoG4A== X-Received: by 2002:a63:fa41:0:b0:408:9d1b:2e57 with SMTP id g1-20020a63fa41000000b004089d1b2e57mr10364962pgk.102.1656046108122; Thu, 23 Jun 2022 21:48:28 -0700 (PDT) Received: from localhost ([12.3.194.138]) by smtp.gmail.com with ESMTPSA id 64-20020a621743000000b0051e7b6e8b12sm579926pfx.11.2022.06.23.21.48.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 21:48:27 -0700 (PDT) Subject: [PATCH v2 3/5] RISC-V: kexec: Use Elf64 on 64-bit targets Date: Thu, 23 Jun 2022 21:48:09 -0700 Message-Id: <20220624044811.9682-4-palmer@rivosinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220624044811.9682-1-palmer@rivosinc.com> References: <20220624044811.9682-1-palmer@rivosinc.com> MIME-Version: 1.0 Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, Palmer Dabbelt From: Palmer Dabbelt To: zohar@linux.ibm.com, dmitry.kasatkin@gmail.com, linux-integrity@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org Most of the Elf macros automatically select the correct Elf type, this converts the one explicit Elf64 usage to depend on XLEN. Signed-off-by: Palmer Dabbelt --- arch/riscv/kernel/elf_kexec.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/riscv/kernel/elf_kexec.c b/arch/riscv/kernel/elf_kexec.c index 9cb85095fd45..4532e3cf17a5 100644 --- a/arch/riscv/kernel/elf_kexec.c +++ b/arch/riscv/kernel/elf_kexec.c @@ -342,6 +342,12 @@ static void *elf_kexec_load(struct kimage *image, char *kernel_buf, #define CLEAN_IMM(type, x) \ ((~ENCODE_##type##_IMM((uint64_t)(-1))) & (x)) +#if __riscv_xlen == 32 +#define ELFN(T) ELF32 ## T +#else +#define ELFN(T) ELF64 ## T +#endif + int arch_kexec_apply_relocations_add(struct purgatory_info *pi, Elf_Shdr *section, const Elf_Shdr *relsec, @@ -367,7 +373,7 @@ int arch_kexec_apply_relocations_add(struct purgatory_info *pi, void *loc; /* tmp location to modify */ sym = (void *)pi->ehdr + symtab->sh_offset; - sym += ELF64_R_SYM(relas[i].r_info); + sym += ELFN(_R_SYM)(relas[i].r_info); if (sym->st_name) name = strtab + sym->st_name; From patchwork Fri Jun 24 04:48:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 12893803 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 091A1CCA473 for ; Fri, 24 Jun 2022 04:50:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231892AbiFXEua (ORCPT ); Fri, 24 Jun 2022 00:50:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231852AbiFXEsc (ORCPT ); Fri, 24 Jun 2022 00:48:32 -0400 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C598769980 for ; Thu, 23 Jun 2022 21:48:29 -0700 (PDT) Received: by mail-pl1-x630.google.com with SMTP id jb13so1088058plb.9 for ; Thu, 23 Jun 2022 21:48:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; h=subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding:cc:from:to; bh=wG/cL1k0Db5CVASFDb2IJyBBfutIm8qgplfgRR5fvCw=; b=w8F/BHDTxvIXVC6FheFa0ViKJnTjyUoyIMvRk0YYdJtATT1LrUdw4skWF37W1cigG1 8x26sID7xOkrcZRAchZerfjH7lOACfj2tmNIrBZ1/r2GPmzAKWlx6frKuZjlCffBR3dT cILziiDXGtRMOmeDIPoYZvVFfjJHND4L3eYFVKazXRkfaPzs5IxUG8YfnCnNLEcIIGiZ ucX6bRmC3mnNG88dA73+TR1MtLtUG2atpNDco24+MUvNN7l5Tt8gB3lTehD+HUIQi1N8 eABa8iunfXAEsLk03BnTZMhn+68TeYVz2heeoCqjLyH8V0dLx6q5hl8IYX/wXoFj5UTt CYsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:cc:from:to; bh=wG/cL1k0Db5CVASFDb2IJyBBfutIm8qgplfgRR5fvCw=; b=JkSAwCgqNbvqBaWsWZ0Kvgfq/Xya8hYJ9L/+2qubrQBraN3xN9cga8UuLxqkEeT8+K KSxmqWHJdQrJ94sVNSRjULhq51PZ/vHQvo7RL8oerEplRs62dYrTUaP2yQSTdeDngSg+ 0nLbDyVrQ3ygNw9xle5wtrPBd77hoaxRG2eTeF5Hl1liIKs77Cx/YqoLNyC7MTEBf2Ay WyxOEf/1gKT+eqz2YjFxG4QdAq2UJMKkW7fAU+vOAkRg2Eg6UpMfN75mTYoVUnnrUysJ ICUhZGvuoWquv4Yczh9NdQq0/1GTePPbSO2/YbDCNRUTWvtV5EhyR05oydrzpWBw3lI8 k6sA== X-Gm-Message-State: AJIora97Rg1CpsJa84r1OsPJnI6PZrXJoMASB7e6DZalBTkOO4JR85Bf Liwn7MdRtOoUAlScRgXsaP7deQ== X-Google-Smtp-Source: AGRyM1tDIqY+T0/4qiFzu9A4UssddVx4//CxdxfSa1dBpSxtstyE6Y1jCr4wGD+7ippEZV5Y3XJaZw== X-Received: by 2002:a17:902:b681:b0:16a:f81:6b02 with SMTP id c1-20020a170902b68100b0016a0f816b02mr31620723pls.28.1656046109159; Thu, 23 Jun 2022 21:48:29 -0700 (PDT) Received: from localhost ([12.3.194.138]) by smtp.gmail.com with ESMTPSA id ik14-20020a170902ab0e00b0015e8d4eb2e3sm651922plb.301.2022.06.23.21.48.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 21:48:28 -0700 (PDT) Subject: [PATCH v2 4/5] RISC-V: purgatory: Use XLEN-length loads to support rv32 Date: Thu, 23 Jun 2022 21:48:10 -0700 Message-Id: <20220624044811.9682-5-palmer@rivosinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220624044811.9682-1-palmer@rivosinc.com> References: <20220624044811.9682-1-palmer@rivosinc.com> MIME-Version: 1.0 Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, Palmer Dabbelt From: Palmer Dabbelt To: zohar@linux.ibm.com, dmitry.kasatkin@gmail.com, linux-integrity@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org This uses an explicit "ld" to load up target address, which dosn't work on rv32. Convert it to a REG_L macro, like everywhere else. Signed-off-by: Palmer Dabbelt --- arch/riscv/purgatory/entry.S | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/riscv/purgatory/entry.S b/arch/riscv/purgatory/entry.S index 0194f4554130..71c50fef051c 100644 --- a/arch/riscv/purgatory/entry.S +++ b/arch/riscv/purgatory/entry.S @@ -8,6 +8,8 @@ * */ +#include + .macro size, sym:req .size \sym, . - \sym .endm @@ -26,7 +28,7 @@ purgatory_start: /* Start new image. */ mv a0, s0 mv a1, s1 - ld a2, riscv_kernel_entry + REG_L a2, riscv_kernel_entry jr a2 size purgatory_start @@ -41,7 +43,7 @@ size purgatory_start .globl riscv_kernel_entry riscv_kernel_entry: - .quad 0 + REG_ASM 0 size riscv_kernel_entry .end From patchwork Fri Jun 24 04:48:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 12893804 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEF42CCA473 for ; Fri, 24 Jun 2022 04:50:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232066AbiFXEuf (ORCPT ); Fri, 24 Jun 2022 00:50:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231881AbiFXEsc (ORCPT ); Fri, 24 Jun 2022 00:48:32 -0400 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE14469985 for ; Thu, 23 Jun 2022 21:48:30 -0700 (PDT) Received: by mail-pg1-x52f.google.com with SMTP id 23so1348000pgc.8 for ; Thu, 23 Jun 2022 21:48:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; h=subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding:cc:from:to; bh=4THMhvS8M5ZnFTHvTFejhkWhYsuAvg/ZgzsYmQOutl8=; b=jZ+UoLM3M7Aw8FzFUs4vfV0xGVF+Z1rgG06Q0g6ddvpteFSUct4m0aAnWG/UHlIHcy xDIWATlB0GGjs/hfRkxe6UQ1V4kDs2Fm3V/6fxpXi023MU/ojZBBXm7JW8wCFWafwRbY ZPHpdFFCz4HQaws9xVkBWt/pnD6GgEBKfUCt/XZPKwwH8Eji0UWJl8bjjLOYO2Km/VcU riLaGCyFAc2cIrl3N/VncOYPKf8urgmhHUYRlJWR81bCqV+fn5a5+P3hY9dVVfzj35qZ 3V3zmkqcGPJtvORY1fF7FSMecx1wrSvXDD/7UYn08WWFqdnoryi8KMch/00RWyQK0gLR DpLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:cc:from:to; bh=4THMhvS8M5ZnFTHvTFejhkWhYsuAvg/ZgzsYmQOutl8=; b=i4ultIkyqY6hknvl9Pxw3IUr5MmCRRFf9aTGP9DGz1xNFgGrlYReeU4e/TJaEOXLbO M4XlY469Lj626vLz0MT53LbEtbgbV0/CItElqVTdqB5epvXykoX5aAXWN/OsJDR/3mMD ShTrLskLAW+m6fi0SXdD1f72n/hvLoDN0qwLdwdH87jdZeS6xdyvuvFoWX6v5OxzfY0h Q02DYr3N/u8U947Tsk8p3Qod2FqBl+F6WYBI6tU32IgqKntlSgDYTSTA8PVD8OuRnXQX WdGne7VDdMnU5hO3ZFCpjGGREjhiYBMHRuMCRUztn71ZwSbh/aRBj+EUMfxd4xbINlP5 JWQQ== X-Gm-Message-State: AJIora+VRLLC0CGMhjQ+dgvMo4AkMN4hmhnVHIuVJZI2SShHH1O8Nt3n 8ZBNmfj3ycjiVlFpRKQpsEm9/g== X-Google-Smtp-Source: AGRyM1tjG9XTGQzrvxKP1b0oJm9GIdXwYRdfAbtw1YGd6ry6SLMEHPonI2hZnL7q9k/q2Z13VDkRjA== X-Received: by 2002:aa7:9206:0:b0:525:1068:c026 with SMTP id 6-20020aa79206000000b005251068c026mr31366064pfo.52.1656046110313; Thu, 23 Jun 2022 21:48:30 -0700 (PDT) Received: from localhost ([12.3.194.138]) by smtp.gmail.com with ESMTPSA id k26-20020aa7821a000000b0052517150777sm555865pfi.41.2022.06.23.21.48.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 21:48:29 -0700 (PDT) Subject: [PATCH v2 5/5] RISC-V: Allow kexec_file() on 32-bit platforms Date: Thu, 23 Jun 2022 21:48:11 -0700 Message-Id: <20220624044811.9682-6-palmer@rivosinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220624044811.9682-1-palmer@rivosinc.com> References: <20220624044811.9682-1-palmer@rivosinc.com> MIME-Version: 1.0 Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, Palmer Dabbelt From: Palmer Dabbelt To: zohar@linux.ibm.com, dmitry.kasatkin@gmail.com, linux-integrity@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org With the build issues now sorted out we can enable kexec_file() on 32-bit platforms as well. Signed-off-by: Palmer Dabbelt --- arch/riscv/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 898052ff743e..a246f2fe60c2 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -388,7 +388,6 @@ config KEXEC_FILE select KEXEC_CORE select KEXEC_ELF select HAVE_IMA_KEXEC if IMA - depends on 64BIT help This is new version of kexec system call. This system call is file based and takes file descriptors as system call argument