Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp901599pxb; Tue, 1 Feb 2022 12:47:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJxMmsh6OnwnC1fX9bKi/UzEM2pVFp13HU8rKhwm4zQKoZGIrvxfukR7aetDex7tLZNlJtqz X-Received: by 2002:a17:90a:16c8:: with SMTP id y8mr4292417pje.97.1643748461724; Tue, 01 Feb 2022 12:47:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643748461; cv=none; d=google.com; s=arc-20160816; b=XgjBgzVQzc/06/6+NYZvGwVvFNFncAD/kMUfQ7iD6R6bsP2mwa3cx3hIjHK/oy07g4 10cthiiffDeTl1kXZlKMUXc54WEnIHZJXbjhnV7beVYv9KgJCZvcdhMdp1s6nOk+/EAb 6wycqkuZPz2WzjgBVy15EG6gkk/cjgbWH2fp8gSrHoc79LRAwmgZQpQHrOhjhg5zX5V2 f+D18vj30XY0D6+xTz2JjSnpX+Rs16UmsnYDeLJPSmTJVm4SskezPAeYi4T1+4FwLSkS pLSQXZrd6P1TsUJMCLzYG6w9w90tEIe66vW/JUsAuPS/A5tbjDFtvjhHzWfcIaBrgUYg XWFw== 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 :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=cfu91ED7nMYsdGJsGmRKK0mjbCW2X1OHhuirg8wEvSo=; b=jzDa+wvWWxnSVcBZ3ctOrKYu5bHf5TLo05fySxWeaDOP5NTpwzmGmWsXuNTlMzZ122 KhVwzLdpW2RSRGsqbG33eOdmV1ku5rrl2ie4Rq+Rd91JwZocQPHrSarpN5zb3urvDpty iJp2mxeHLDFNAPu2NI6YVSlMq6p8gwcRmKSNHosUif2MZREV5cRGDRJcIUDz5VYzXu1o CUnNTxa4qXDWalCjMiA0yWZYwW2rSzJTdkqKdgusihyRnM8C8CqRb0s3vSDqAqN2VBF4 Ma7vXnsO78JP3O+FjYTrN7MYzc3CDKAUG7312M8Z959iAJnHBY+F8VoV0Ms1Q9NLHcx6 SoPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=pjRAWmYL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t70si17154421pgd.800.2022.02.01.12.47.30; Tue, 01 Feb 2022 12:47:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=pjRAWmYL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343517AbiAaSWR (ORCPT + 99 others); Mon, 31 Jan 2022 13:22:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239834AbiAaSWP (ORCPT ); Mon, 31 Jan 2022 13:22:15 -0500 Received: from mail-ot1-x332.google.com (mail-ot1-x332.google.com [IPv6:2607:f8b0:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04FEEC061714 for ; Mon, 31 Jan 2022 10:22:14 -0800 (PST) Received: by mail-ot1-x332.google.com with SMTP id s6-20020a0568301e0600b0059ea5472c98so13788225otr.11 for ; Mon, 31 Jan 2022 10:22:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=cfu91ED7nMYsdGJsGmRKK0mjbCW2X1OHhuirg8wEvSo=; b=pjRAWmYLG0dJkTiGdZm4iCOSEVzXjZRzPTkHcUf7n2L9hbs6S3Bqa3hrfRqFDVjTXP hm8qpwRgjGKK+Bq+BRfmqXoO94K9Bfm5Gs+ULcAhD08S+Uxxm3OGuGpRhpFkyvEd6SAW qfV209FbF3cjuW8j/Y8n8RxP0tZqxhLeDP7evBy70vY/ztM9Kd4uAZq2yx1/mCIR8OCO lCilLiig0dYg4X2JVCBFZAPjPcCes4NRm1o26lPNwRfNYT1p+cWmAw23oJJNJ07NxF4h Mcu8BnjFGP/jyyp1MBdGR6VrgzHBfg0cAQu7Zi1zU4lUgFgkZ87sV7f4NBG5A9KpgBZw PnEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=cfu91ED7nMYsdGJsGmRKK0mjbCW2X1OHhuirg8wEvSo=; b=rwYWblC0kh0mc5FQXGr5Yc/cbyccez5uON0f0mVNE9c+QRaTRn1v+EKwlUpKIKAqS3 WtOVH9v5ap9HmH3iFfTaddry7wTT/m52SIIaC7XJsWSJMbIYjQwflbEjelLYrspiBGrG 3HQVTSB9rqCG5IEOSPynLB2c3w5+CEudc+uE/GcObrvdSATPKczW14UxvGwVGW7sFL7O kCDPgdwAw1hI79vYpWGbMnb0thnPYtzBx8WJObqwrZkk8m5FX/sEOZArLtOdXDDJB6th Ow+7pAw+MNkkVWd8rMtKINK9WUqFab9X4bKuuwErcwCog1+ZgMk5Jc4yYZC7aUthBKgY 0ryg== X-Gm-Message-State: AOAM533uDisTvaqR1FD+xKGDzkQgXZ4g8H/uzFvawKOc7HZov4Oy4IVb n5ZilGi41rMNMKyx9KhZ7injEZbU8mc= X-Received: by 2002:a05:6830:40ab:: with SMTP id x43mr12207931ott.132.1643653334335; Mon, 31 Jan 2022 10:22:14 -0800 (PST) Received: from stitch.. (80.71.140.73.ipv4.parknet.dk. [80.71.140.73]) by smtp.gmail.com with ESMTPSA id t4sm12986340oie.14.2022.01.31.10.22.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jan 2022 10:22:13 -0800 (PST) Sender: Emil Renner Berthing From: Emil Renner Berthing To: linux-riscv@lists.infradead.org Cc: Emil Renner Berthing , Paul Walmsley , Palmer Dabbelt , Albert Ou , Peter Zijlstra , Josh Poimboeuf , Jason Baron , Steven Rostedt , Ard Biesheuvel , Alexandre Ghiti , Jisheng Zhang , linux-kernel@vger.kernel.org Subject: [PATCH v1 0/7] Module relocation fixes and asm/insn.h header Date: Mon, 31 Jan 2022 19:21:38 +0100 Message-Id: <20220131182145.236005-1-kernel@esmil.dk> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The first patch removes a bunch of code from the asm/module.h which is included in almost all drivers through linux/module.h. Next are two patches to fix unaligned access when doing module relocations and do proper range checks for auipc+jalr offsets. I'm a little less confident about the following patches, so consider this more of an RFC for those. The idea is to consolidate the RISC-V instruction generation and manipulation similar to arm64's asm/insn.h header. /Emil Emil Renner Berthing (7): riscv: Avoid unaligned access when relocating modules riscv: Fix auipc+jalr relocation range checks riscv: Add asm/insn.h header riscv: Use asm/insn.h for module relocations riscv: Use asm/insn.h to generate plt entries riscv: Use asm/insn.h for jump labels riscv: kernel/modules.c simplification arch/riscv/include/asm/insn.h | 121 +++++++++++ arch/riscv/kernel/jump_label.c | 12 +- arch/riscv/kernel/module-sections.c | 27 +-- arch/riscv/kernel/module.c | 326 +++++++++++++--------------- 4 files changed, 276 insertions(+), 210 deletions(-) create mode 100644 arch/riscv/include/asm/insn.h -- 2.35.1