Re: [PATCH v4 15/16] module: Move where we mark modules RO,X

From: Steven Rostedt
Date: Mon Oct 21 2019 - 22:21:17 EST


On Fri, 18 Oct 2019 09:35:40 +0200
Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:

> Now that set_all_modules_text_*() is gone, nothing depends on the
> relation between ->state = COMING and the protection state anymore.
> This enables moving the protection changes later, such that the COMING
> notifier callbacks can more easily modify the text.
>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
> Cc: Jessica Yu <jeyu@xxxxxxxxxx>
> ---

This triggered the following bug:

BUG: unable to handle page fault for address: ffffffffa01501f1
#PF: supervisor instruction fetch in kernel mode
#PF: error_code(0x0011) - permissions violation
PGD 2a16067 P4D 2a16067 PUD 2a17063 PMD c230c067 PTE 80000000c4d74063
Oops: 0011 [#1] PREEMPT SMP KASAN PTI
CPU: 2 PID: 638 Comm: systemd-udevd Not tainted 5.4.0-rc3-test+ #98
ACPI: If an ACPI driver is available for this device, you should use it instead of the native driver
ACPI Warning: SystemIO range 0x0000000000000530-0x000000000000053F conflicts with OpRegion 0x0000000000000500-0x0000000000000563 (\GPIO) (20190816/utaddress-213)
ACPI: If an ACPI driver is available for this device, you should use it instead of the native driver
ACPI Warning: SystemIO range 0x0000000000000500-0x000000000000052F conflicts with OpRegion 0x0000000000000500-0x0000000000000563 (\GPIO) (20190816/utaddress-213)
ACPI: If an ACPI driver is available for this device, you should use it instead of the native driver
lpc_ich: Resource conflict(s) found affecting gpio_ich
Hardware name: Hewlett-Packard HP Compaq Pro 6300 SFF/339A, BIOS K01 v03.03 07/14/2016
RIP: 0010:trace_event_define_fields_i2c_result+0x0/0x86 [i2c_core]
Code: 27 6a 00 48 c7 c2 60 34 13 a0 45 31 c9 48 89 df 41 b8 02 00 00 00 b9 12 00 00 00 48 c7 c6 a0 33 13 a0 e8 02 ec 14 e1 5a 5b c3 <53> 48 c7 c6 20 33 13 a0 b9 08 00 00 00 41
0 6a 00 41
RSP: 0018:ffff8880cba07950 EFLAGS: 00010246
RAX: ffffffffa01501f1 RBX: ffffffffa013da40 RCX: ffffffff812a147c
RDX: dffffc0000000000 RSI: 0000000000000008 RDI: ffffffffa013da40
RBP: ffffffffa0142be0 R08: ffffed1017fde1ab R09: ffffed1017fde1ab
R10: ffffed1017fde1aa R11: ffff8880bfef0d57 R12: ffff8880cc22a000
R13: ffffffffa013da50 R14: ffffffffa0137aa8 R15: ffff8880cd372c60
FS: 00007f062a48f940(0000) GS:ffff8880d4680000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffffa01501f1 CR3: 00000000cb632003 CR4: 00000000001606e0
Call Trace:
event_create_dir+0x358/0x7b0
trace_module_notify+0x20b/0x240
notifier_call_chain+0x6d/0xa0
blocking_notifier_call_chain+0x5e/0x80
load_module+0x39a5/0x3d80
? module_frob_arch_sections+0x20/0x20
? vfs_read+0xcc/0x1b0
? kernel_read+0x95/0xb0
? kernel_read_file+0x187/0x310
? find_held_lock+0xac/0xd0
? syscall_trace_enter+0x369/0x590
? __do_sys_finit_module+0x11a/0x1b0
__do_sys_finit_module+0x11a/0x1b0
? __ia32_sys_init_module+0x40/0x40
? trace_hardirqs_on+0x2e/0x120
? ktime_get_coarse_real_ts64+0x6c/0xf0
? syscall_trace_enter+0x233/0x590
? do_syscall_64+0x14/0x1a0
do_syscall_64+0x68/0x1a0
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Attached config, but it seems to be triggered with modules that have
trace events defined in them.

The trace_event_define_fields_<event>() is defined in
include/trace/trace_events.h and is an init function called by the
trace_events event_create_dir() via the module notifier:
MODULE_STATE_COMING

-- Steve

Attachment: config.gz
Description: application/gzip