Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3501449rdb; Wed, 13 Sep 2023 14:09:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHcPyUFja9sQurrw/33Dbn/zeNy9dP8lw35O8EmmFCXXJce1at6sxkbhqF/XzPctJmWiPXX X-Received: by 2002:a05:6a00:1884:b0:68f:ce6a:8685 with SMTP id x4-20020a056a00188400b0068fce6a8685mr5635153pfh.14.1694639369373; Wed, 13 Sep 2023 14:09:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694639369; cv=none; d=google.com; s=arc-20160816; b=HrGLBf7GNKz3nLkiOcX9Kv5AJSTMefZNlDV+1OJWT/ajT3T633Wwtgn16XX9yW0qlS Mtcp+V2Qp82uHZ9rXuvoy8vPtKwJ/M076aUFmdhvRnLXi4GPjd4cFWXXTMgnrV/4zvQs PY1K7CSrJzl0GWP/PBfT9qisPn8tVhKJiaSTKfnw9/MGDK7gOewbbs92e6c1Ik1WjMPT IRF6JrXOWjyMyE4ITJQOAtopN9uEZnJ+Wv+a/A4xwt5fCW0cH7pNXruevD3w+VnDRCHL V7ApoltlHmeNrRrMHJ0nTH2OzVXVZHO3bX2GV4L2geatLDgUyq6NRQjRQ5csDz6uzlzU fylw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:content-transfer-encoding:mime-version :message-id:date:subject:from:dkim-signature; bh=IrM1G1X1joN9C/3rPYTl47RElW8sRiJaPs6T25r1A0k=; fh=KZqRT9ufKlz9AAx/9RG99hMgOts4DBuJCtI1Ondw5wc=; b=WcWGSV9Ym8n/ttFeHFT7CXgPHCWWDPmFAJO7C24BWrAQdSFXiyjRAlNOuoD14i0l3J XrHdRYMLw7hGS2+UWftUOzQTMqdApuXNzCluICVjX8j0lx4x3uPB7MMAO71FzvVTQOEj l316yTo+Ad2zlBCNL31e5HfCm9Bl15KGw/zfs3egu+hjQ1aTTcjfKPUhANrGSx5cn2Vf 5QemIdX+CBx7XH5DrQ3H+6lHcqyxWE9YFHvFWHdKR8w+JMNctpun0kfcou5kehGY9cIM WxVlGekgwUeKV/1LIMrT0anwmHnpzUIxx0CWTrBb8Cw04CT2O/qcDhZibZxDQRUkp7D1 mUrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=NgBTjcdt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id y15-20020a056a00180f00b0068a65b26fc6si75681pfa.43.2023.09.13.14.09.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 14:09:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=NgBTjcdt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 3AEFE801E680; Wed, 13 Sep 2023 14:05:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231724AbjIMVFq (ORCPT + 99 others); Wed, 13 Sep 2023 17:05:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232746AbjIMVFo (ORCPT ); Wed, 13 Sep 2023 17:05:44 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8D851BCA for ; Wed, 13 Sep 2023 14:05:40 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1bf1935f6c2so2281165ad.1 for ; Wed, 13 Sep 2023 14:05:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1694639140; x=1695243940; darn=vger.kernel.org; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:from:to:cc:subject:date:message-id:reply-to; bh=IrM1G1X1joN9C/3rPYTl47RElW8sRiJaPs6T25r1A0k=; b=NgBTjcdtOrsiRkm0kEhYSpOj6GqY+fj3G0PJIPBra+G5WbtT3XMrxx7TNq/hTrrnDb 6+8Bfxcox1wsPpeiFdYrFOEb7ZZraT69fQ+LGzvGqrhBjV5gvkEICpLb1aO0zdzURgCe f0/oPWrxcIl9j9HJ9GNEbB1yy9fF6zIM/NU7nJTJjkvNmrq1SFprPpy/njtR2F7cVyld VZQEo9zbGpPMjR+gnodfJcm02HxbUzxP8mzhJaLnah6rPQpddCCdCO1tVKW1pbLj33HQ flBd+RMOdX28SYw3aVLs7IyNZxiNDLTdYPjZ28GqX2ozoGUsQnl/DR+5+MQnlz1rPY4V rGnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694639140; x=1695243940; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=IrM1G1X1joN9C/3rPYTl47RElW8sRiJaPs6T25r1A0k=; b=qk2ocfwNKG0nUknFpF5Irn9IR1YknvNmR3WVRkF9R3LZZGvtx2l+pj+Tlc0D/semrl Z5vpSOGu5vNyL91JWI6ArgLCV+/Iu4feiraAvHUEe4xWxcSGwls68FqkE6YJZduCTGlb Wagnkqd+GzRljHGQ8z8qBYFEvx718xc7A4bBsY6CwOLJD2nteLet3nbDBytpu2ZzHdlp BrTWMEMOHb7+1nbVPPUHBd0U8CqSsftmNVUQXqDmNoHV/k/hNXIH8HyAy4Ry9DC7UDnk 3nvz1nj2xo5YMrlVZqhY9diE6CkkK64p8uGm8mWKVslmvyVYEfkNPYI6/TgvrkhsfPaY MQsg== X-Gm-Message-State: AOJu0Yw9yf8zgwvNzw25aVd5/3JgVWWc3C/y62+aR18czpztgZaxI0jw rgP5TKamUfhzbayYgbhmxBy/zg== X-Received: by 2002:a17:902:d487:b0:1c3:e3b1:98f9 with SMTP id c7-20020a170902d48700b001c3e3b198f9mr5880198plg.24.1694639140186; Wed, 13 Sep 2023 14:05:40 -0700 (PDT) Received: from charlie.ba.rivosinc.com ([66.220.2.162]) by smtp.gmail.com with ESMTPSA id z16-20020a170903019000b001ab2b4105ddsm66323plg.60.2023.09.13.14.05.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 14:05:39 -0700 (PDT) From: Charlie Jenkins Subject: [PATCH 0/2] riscv: Add remaining module relocations and tests Date: Wed, 13 Sep 2023 14:04:48 -0700 Message-Id: <20230913-module_relocations-v1-0-bb3d8467e793@rivosinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAPAjAmUC/x2MWwqAIBAAryL7nWBKz6tERLlbLVSGVgTR3ZM+B 2bmgUCeKUAtHvB0cWC3RUgTAXbut4kkY2TQShtVqVKuDs+FOk+Ls/0R7SDH3FjCPEsHLCCGu6e R73/atO/7AV7LNqRkAAAA To: linux-riscv@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Eric Biederman , Kees Cook , Paul Walmsley , Palmer Dabbelt , Albert Ou , Charlie Jenkins X-Mailer: b4 0.12.3 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 13 Sep 2023 14:05:53 -0700 (PDT) X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email A handful of module relocations were missing, this patch includes the remaining ones. I also wrote some test cases to ensure that module loading works properly. Some relocations cannot be supported in the kernel, these include the ones that rely on thread local storage and dynamic linking. The ULEB128 relocations also seem to be stripped out of kernel module binaries. This can be tested by enabling KUNIT, RUNTIME_KERNEL_TESTING_MENU, and RISCV_MODULE_LINKING_KUNIT. Signed-off-by: Charlie Jenkins --- Charlie Jenkins (2): riscv: Add remaining module relocations riscv: Add tests for riscv module loading arch/riscv/Kconfig.debug | 1 + arch/riscv/include/uapi/asm/elf.h | 6 +- arch/riscv/kernel/Makefile | 1 + arch/riscv/kernel/module.c | 191 ++++++++++++++++++--- arch/riscv/kernel/tests/Kconfig.debug | 32 ++++ arch/riscv/kernel/tests/Makefile | 1 + arch/riscv/kernel/tests/module_test/Makefile | 11 ++ .../tests/module_test/test_module_linking_main.c | 64 +++++++ arch/riscv/kernel/tests/module_test/test_set16.S | 23 +++ arch/riscv/kernel/tests/module_test/test_set32.S | 20 +++ arch/riscv/kernel/tests/module_test/test_set6.S | 23 +++ arch/riscv/kernel/tests/module_test/test_set8.S | 23 +++ arch/riscv/kernel/tests/module_test/test_sub16.S | 22 +++ arch/riscv/kernel/tests/module_test/test_sub32.S | 22 +++ arch/riscv/kernel/tests/module_test/test_sub6.S | 22 +++ arch/riscv/kernel/tests/module_test/test_sub64.S | 27 +++ arch/riscv/kernel/tests/module_test/test_sub8.S | 22 +++ 17 files changed, 485 insertions(+), 26 deletions(-) --- base-commit: a48fa7efaf1161c1c898931fe4c7f0070964233a change-id: 20230908-module_relocations-f63ced651bd7 -- - Charlie