Message ID | 20231006-module_relocations-v2-0-47566453fedc@rivosinc.com (mailing list archive) |
---|---|
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47855E9413C for <linux-mm@archiver.kernel.org>; Sat, 7 Oct 2023 00:41:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 754D480015; Fri, 6 Oct 2023 20:41:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 704BC80008; Fri, 6 Oct 2023 20:41:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5A59780015; Fri, 6 Oct 2023 20:41:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 4BC0380008 for <linux-mm@kvack.org>; Fri, 6 Oct 2023 20:41:22 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id C7E1A160260 for <linux-mm@kvack.org>; Sat, 7 Oct 2023 00:41:21 +0000 (UTC) X-FDA: 81316811562.26.D3EC969 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by imf17.hostedemail.com (Postfix) with ESMTP id DB4C940006 for <linux-mm@kvack.org>; Sat, 7 Oct 2023 00:41:19 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=NytO6aff; spf=pass (imf17.hostedemail.com: domain of charlie@rivosinc.com designates 209.85.214.182 as permitted sender) smtp.mailfrom=charlie@rivosinc.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1696639280; a=rsa-sha256; cv=none; b=GgXrCrWjETWEiGWHef1Dt4CnxnsvG8nP0ZV/mFQdbs0vrjHhj/jpPQe6LHZkZ0o9rmV9at RokTc6f4sMjq5RHApWvHwNuDXepeQgLCRyeI/BxCXXtU7eiwyas56MkLtqILI5WVm9pJPU p5KcTzg1ZtXtzp53ldjrQ1jgWt65ZPw= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=NytO6aff; spf=pass (imf17.hostedemail.com: domain of charlie@rivosinc.com designates 209.85.214.182 as permitted sender) smtp.mailfrom=charlie@rivosinc.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1696639280; h=from:from:sender: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: references:dkim-signature; bh=0Hp0ECJm0gFf8INn0HiZKpVqg/IUsayxsh+1diajkmI=; b=YqM4ESWEVXd4W7PwfqcYbl/HlBzBQZfssrCnq8yfwSNFaNeYhKm7fF8rWQxc3370wW+LVc iT9kBv5/AMFeHlsAus+9cKpAU0xWVj6c+6v8gdDaMBpNeA39FwativUf82cG3KPajCzU7y Mb7lsVkDF2mzTEFkh7seX6zMmmheZDY= Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1c723f1c80fso20754045ad.1 for <linux-mm@kvack.org>; Fri, 06 Oct 2023 17:41:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1696639278; x=1697244078; darn=kvack.org; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:from:to:cc:subject:date:message-id:reply-to; bh=0Hp0ECJm0gFf8INn0HiZKpVqg/IUsayxsh+1diajkmI=; b=NytO6affToqLyQ8B0iDpbHyCdiaiI5RP8RM5eQGLI+mf108DZqLFJcPUrKsAeRSw1u AMMAf45Mie5J0Wxf4P2WHE7Z6hk9qP+Qzk9wI7r+xfI+juPcQAiNnV2qJEv9nqARFxe9 eWp68+B7sqR8XKpk3LDkSoNc3apZc8uv/uDAZi+o8qZVvnw7hQQdWnZjbVOQzcHU+7Wp E20VD960lft1SuycAdMufM1O4PUibXojUmIt183oA/KxYoEDnN4X/XpgRlLCc5VbAeoc hSVAlqF/m7bkNKlZ7LmloezfLlKMnchoFRnb6reEz7No8vjKc0Fu/1H9M+pLGUOFl/bX WJcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696639278; x=1697244078; 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=0Hp0ECJm0gFf8INn0HiZKpVqg/IUsayxsh+1diajkmI=; b=vzaqfh/qtgHJBjAufUu+n8aoN1+a1DrCEQiFoH6BDzD1kMj2Ocgf4peatZzGtDUJIv UKFgcOv80bRokiIMWfczq46hkTP2P+J8RVpOGUTMIOEXT9vivJ/PQe3eFN89SE4GDo6o i2/NxikuF+MzhJ3XlCLMsHLlIdNUEzVZeKtdbV/jgaQgJc4qvQHhavA6eXb2ONiqq7CL d8SLGkUH2Bd3ANSILYbuYdvXzTuDpmIU3MmEYH5OmJfoIGh7MmpFw6wqYqnhfVCD9OKo Wds3zrV6Ra7fr7CKl4QmcJCJGf3o7Pd020S9hBW80nvH7AbOvVeZikddtAIXfz1m76jr kuxw== X-Gm-Message-State: AOJu0YxJHSJhsDoin2KfZLHLKY80m9JVrPLCd3LQjz4sLuubllz9lity cyKrndff1hXfnhxYWM1RLeUYmbOkEGFEYkq0CS0= X-Google-Smtp-Source: AGHT+IH9WxpF3kdiS9QaTEtUj5obvaHiYFW9XD6AGPsPbfksFSz9GOfBX62HTFtC8jFHFpfd0gjD2A== X-Received: by 2002:a17:902:c112:b0:1c0:93b6:2e4b with SMTP id 18-20020a170902c11200b001c093b62e4bmr9338829pli.33.1696639278389; Fri, 06 Oct 2023 17:41:18 -0700 (PDT) Received: from charlie.ba.rivosinc.com ([66.220.2.162]) by smtp.gmail.com with ESMTPSA id x16-20020a170902ec9000b001c582de968dsm4534540plg.72.2023.10.06.17.41.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 17:41:17 -0700 (PDT) From: Charlie Jenkins <charlie@rivosinc.com> Subject: [PATCH v2 0/2] riscv: Add remaining module relocations and tests Date: Fri, 06 Oct 2023 17:41:05 -0700 Message-Id: <20231006-module_relocations-v2-0-47566453fedc@rivosinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIACGpIGUC/22Nyw7CIBREf6W5azFQlD5W/odpTAu39iYtGKhE0 /DvYuPS5ZnMnNkgoCcM0BYbeIwUyNkM5aEAPfX2joxMZih5KXnDa7Y485zx5nF2ul9zO7BRSY1 GncVgKsjDh8eRXrv02mWeKKzOv/ePKL7pTyfkP10UjLNhkKY+qQqrRl48RRfI6qN2C3QppQ8nx buxtwAAAA== To: linux-riscv@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Eric Biederman <ebiederm@xmission.com>, Kees Cook <keescook@chromium.org>, Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu>, Charlie Jenkins <charlie@rivosinc.com> X-Mailer: b4 0.12.3 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: DB4C940006 X-Stat-Signature: yk8b35gpskei88a9q37h55ba8sbqostm X-Rspam-User: X-HE-Tag: 1696639279-906066 X-HE-Meta: U2FsdGVkX19pp3cNzQSogt8PIGsF6AGu0QJWG7/BLlIryRxtnA1dUHddzmTss0p9onrHvN+ItTp8HE0Fs9mybphmCNl3aQL46V0VP3/fpgH8DR4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mMzY4LCWDJqr0AUahM9NyNT2+e53T6l3tZdzf480izPEtmFxIpoycQ4nR1AaPOXh9GpZotrmqRrrqAnCSeuGkhHGeBh5+y86jy//YYcyQMAE3PjVkkcbUPRHL0W6iDyUXXl7Ts79QcAhGcBMXxgANyYjGr+nNVW+h67D0hblOZqKlyQrlHZ47oRbMN4wSlnnzvffzpVVTueg0uqkGgY1zEa92TjhhG5DYgdTa3BehPE4s0yU9ISlTgYrlRSa+vIxXXFuqI8i4FHB1zB1qcep1+Fx7xwDfyjveZ/Vnxi76yxs9PogNEXRgnfXUeZfWe0TApUm4HlyeTvuRis= X-Bogosity: Ham, tests=bogofilter, spamicity=0.163109, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> |
Series |
riscv: Add remaining module relocations and tests
|
expand
|
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. ULEB128 handling is a bit special because SET and SUB relocations must happen together, and SET must happen before SUB. The module linking ignores a SET unless it is followed by a SUB. In order to find the corresponding SET, module linking starts at the relocation above the SUB and iterates up until it hits the SET. If a SET is not found, module linking fails. This can be tested by enabling KUNIT, RUNTIME_KERNEL_TESTING_MENU, and RISCV_MODULE_LINKING_KUNIT. Signed-off-by: Charlie Jenkins <charlie@rivosinc.com> --- Changes in v2: - Added ULEB128 relocations - Link to v1: https://lore.kernel.org/r/20230913-module_relocations-v1-0-bb3d8467e793@rivosinc.com --- 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 | 247 ++++++++++++++++++--- arch/riscv/kernel/tests/Kconfig.debug | 32 +++ arch/riscv/kernel/tests/Makefile | 1 + arch/riscv/kernel/tests/module_test/Makefile | 15 ++ .../tests/module_test/test_module_linking_main.c | 73 ++++++ 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 ++ arch/riscv/kernel/tests/module_test/test_uleb128.S | 20 ++ 18 files changed, 574 insertions(+), 26 deletions(-) --- base-commit: 82714078aee4ccbd6ee7579d5a21f8a72155d0fb change-id: 20230908-module_relocations-f63ced651bd7