linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrey Konovalov <andreyknvl@google.com>
To: Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Dmitry Vyukov <dvyukov@google.com>,
	Alexander Potapenko <glider@google.com>,
	Marco Elver <elver@google.com>
Subject: Are read-only static labels incompatible with kernel modules?
Date: Mon, 7 Dec 2020 21:37:54 +0100	[thread overview]
Message-ID: <CAAeHK+xB0cdJxTvLzRRQuKQkStF+1AN179_8RUvDrpjZy+Utyg@mail.gmail.com> (raw)

Hi,

I'm getting a crash when trying to load a module into a kernel that
uses __ro_after_init static labels, see the crash below. The label is
defined and initialized in the main kernel binary, and is used in the
module. Is this not supported?

Thanks!

====

[   15.088489] Unable to handle kernel write to read-only memory at
virtual address ffffc4faeaa81ac8
Mem abort info:
  ESR = 0x9600004f
  EC = 0x25: DABT (current EL), IL = 32 bits
  SET = 0, FnV = 0
  EA = 0, S1PTW = 0
Data abort info:
  ISV = 0, ISS = 0x0000004f
  CM = 0, WnR = 1
swapper pgtable: 4k pages, 48-bit VAs, pgdp=000000004174b000
[ffffc4faeaa81ac8] pgd=00000000bdfff003, p4d=00000000bdfff003,
pud=00000000bdffe003, pmd=00000000bdffb003, pte=0060000041681f83
Internal error: Oops: 9600004f [#1] PREEMPT SMP
Modules linked in: test_kasan_module(+)
CPU: 1 PID: 207 Comm: insmod Not tainted 5.10.0-rc4 #11
Hardware name: linux,dummy-virt (DT)
pstate: 40400005 (nZcv daif +PAN -UAO -TCO BTYPE=--)
pc : static_key_set_linked kernel/jump_label.c:368
pc : jump_label_add_module+0x1ec/0x2dc kernel/jump_label.c:658
lr : jump_label_add_module+0x1a8/0x2dc kernel/jump_label.c:653
sp : ffff800010283ba0
x29: ffff800010283ba0 x28: f8ff0000034baac0
x27: ffffc4faeaa81000 x26: ffffc4fa92d45008
x25: fdff000002c01e00 x24: f9ff000003788c80
x23: f8ff000003788e80 x22: ffffc4faeaa81ac0
x21: ffffc4fa92d45000 x20: ffffc4fa92d45020
x19: ffffc4fa92d46000 x18: dead000000000100
x17: 000000000000003f x16: ffffc4fa92d4c000
x15: 0000000000000000 x14: 0000000000000008
x13: fefefefefefefeff x12: 0000000057d3caa9
x11: 0000000000002000 x10: ff80c4fae9791a1c
x9 : ffffc4fa92d43000 x8 : f9ff000003788c82
x7 : 0000000000000000 x6 : 000000000000003f
x5 : 0000000000000040 x4 : 0000000000000001
x3 : 0000000000000dc0 x2 : 00000000000000fe
x1 : 0000000000000000 x0 : 0000000000000000
Call trace:
 static_key_set_linked kernel/jump_label.c:368
 jump_label_add_module+0x1ec/0x2dc kernel/jump_label.c:658
 jump_label_module_notify+0x40/0xa4 kernel/jump_label.c:736
 notifier_call_chain kernel/notifier.c:83
 notifier_call_chain_robust kernel/notifier.c:118
 blocking_notifier_call_chain_robust+0x5c/0xe8 kernel/notifier.c:302
 prepare_coming_module kernel/module.c:3854
 load_module+0x2170/0x2cb4 kernel/module.c:4005
 __do_sys_finit_module kernel/module.c:4128
 __se_sys_finit_module kernel/module.c:4105
 __arm64_sys_finit_module+0xb8/0xf4 kernel/module.c:4105
 __invoke_syscall arch/arm64/kernel/syscall.c:36
 invoke_syscall arch/arm64/kernel/syscall.c:48
 el0_svc_common+0xa0/0x178 arch/arm64/kernel/syscall.c:159
 do_el0_svc+0x24/0x80 arch/arm64/kernel/syscall.c:205
 el0_svc arch/arm64/kernel/entry-common.c:236
 el0_sync_handler+0x1f0/0x2ac arch/arm64/kernel/entry-common.c:254
 el0_sync+0x190/0x1c0 arch/arm64/kernel/entry.S:740
Code: f94006c8 92400108 aa180108 b27f0108 (f90006c8)
---[ end trace 6f43f632dca3b2e8 ]---

             reply	other threads:[~2020-12-07 20:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-07 20:37 Andrey Konovalov [this message]
2020-12-08 12:51 ` Are read-only static labels incompatible with kernel modules? Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAAeHK+xB0cdJxTvLzRRQuKQkStF+1AN179_8RUvDrpjZy+Utyg@mail.gmail.com \
    --to=andreyknvl@google.com \
    --cc=dvyukov@google.com \
    --cc=elver@google.com \
    --cc=glider@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rdunlap@infradead.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).