Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1987449imm; Thu, 7 Jun 2018 03:42:02 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLokM+re9GAI2aMfCwZOfwuMfj4tHnUTxp2sEReZkLcZB1K5MmikaFkfjRm4XBjsZZGPpSK X-Received: by 2002:a17:902:683:: with SMTP id 3-v6mr1455808plh.291.1528368122462; Thu, 07 Jun 2018 03:42:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528368122; cv=none; d=google.com; s=arc-20160816; b=mEg7SyYRbG26/kPFx8Nq3hGcmavBTZrX2DtgKL8rPfNP8ERz3BtCrvLh/oJYuvT0ZG pmTE+nXXGdMn4i/Y7LdMauvT1AaCcipB5IJI71zDaz5ZA+ZpBMi3kICHi/IJhwU3a/Vd wuHPZ4pcfjebX3FqTaA8Vt+oFJU9hnAppvUyykYbfpyFrbucrbQluA6AVDuNGzPCV7cj l8Yv8hx0nlTEVh1vfhoITh9dEL2czS2WW+AJ03rJtOnOwPQtJea4iHCBDeK5WAv0H6nL XYJQKPnSVnEza4djY4jn3bnrKxag4UKCuecPTmLDPr4mqnZKTpofH18iEJGCcitQIPMX oG9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id:date :cc:subject:to:from:arc-authentication-results; bh=PK1Jfvy7LlobLbxAUCLgV/FXwfFCTEjEe7ECKNIgghg=; b=t7eV1SCi9FLd1i9tJipoONgad6yY93WJz5AVBA5zVtNY1WwNhf7louEgcfNhrZ735L brvWZ9WlXWRS5hZ2Bav+fXROFY4hoNGCrv/+18BPRKMgcPiKkxjpEHKbiiAwCaC3h9z4 Dpos+bgTu5Q95AdeO16qpEi0gQf5JptmVGNoXdgS/jvaEPGiH1HzhhRx2IskgvYzkU90 Nxh4bIChw0uSvLW/4nZ8Gbur0W+i8xj3a12TpFsz65SNJs71te4AwYBgM+nbU714G2+w hLPhk+WYbPtw+opxXmQuZZdV2jEbbDcqtmHRQu/Ni0WtioqlgdHFqtZn/mGKyaF/Cvfx sLOQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y20-v6si6541643pfm.186.2018.06.07.03.41.47; Thu, 07 Jun 2018 03:42:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932667AbeFGK1b (ORCPT + 99 others); Thu, 7 Jun 2018 06:27:31 -0400 Received: from mx2.suse.de ([195.135.220.15]:60296 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932118AbeFGK13 (ORCPT ); Thu, 7 Jun 2018 06:27:29 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id F36F5ADF5; Thu, 7 Jun 2018 10:27:27 +0000 (UTC) From: Andreas Schwab To: linux-riscv@lists.infradead.org Subject: [PATCH] RISC-V: Handle R_RISCV_32 in modules CC: linux-kernel@vger.kernel.org X-Yow: There's a little picture of ED MCMAHON doing BAD THINGS to JOAN RIVERS in a $200,000 MALIBU BEACH HOUSE!! Date: Thu, 07 Jun 2018 12:27:27 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With CONFIG_MODVERSIONS=y the R_RISCV_32 relocation is used by the __kcrctab section. Signed-off-by: Andreas Schwab --- arch/riscv/kernel/module.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/riscv/kernel/module.c b/arch/riscv/kernel/module.c index 5dddba301d..1d5e9b934b 100644 --- a/arch/riscv/kernel/module.c +++ b/arch/riscv/kernel/module.c @@ -17,6 +17,17 @@ #include #include +static int apply_r_riscv_32_rela(struct module *me, u32 *location, Elf_Addr v) +{ + if (v != (u32)v) { + pr_err("%s: value %016llx out of range for 32-bit field\n", + me->name, v); + return -EINVAL; + } + *location = v; + return 0; +} + static int apply_r_riscv_64_rela(struct module *me, u32 *location, Elf_Addr v) { *(u64 *)location = v; @@ -265,6 +276,7 @@ static int apply_r_riscv_sub32_rela(struct module *me, u32 *location, static int (*reloc_handlers_rela[]) (struct module *me, u32 *location, Elf_Addr v) = { + [R_RISCV_32] = apply_r_riscv_32_rela, [R_RISCV_64] = apply_r_riscv_64_rela, [R_RISCV_BRANCH] = apply_r_riscv_branch_rela, [R_RISCV_JAL] = apply_r_riscv_jal_rela, -- 2.17.1 -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."