Kernel panics in __ptep_modify_prot_start() function in presence of ktap module

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux (RHEL) 8
    • typically, 4.18.0-425.10.1.el8_7 and newer kernel is involved
  • ktap_* kernel module (the issue is observed with: 112810, 113457, 113573)

Issue

The kernel experiences panic in the __ptep_modify_prot_start() routine while having the ktap_* kernel module loaded.

Resolution

Please consider engaging the ktap_* kernel module vendor. This module is a 3rd-party one, hence it is not supported by Red Hat directly.

A possible temporary workaround is to blocklist the module.

Root Cause

It might be the case that the ktap_* kernel module faces troubles due to RHEL kernel ABI changes introduced by the following downstream commits:

  • x86/paravirt: Add a dummy __x86_paravirt_patch_template() function
  • x86/paravirt: Fix kABI breakage in struct pv_mmu_ops

Diagnostic Steps

The following call trace of the panic task applies:

crash> bt
PID: 1724     TASK: ffff95510dc30000  CPU: 3    COMMAND: "guard_stap"
…
 #4 [ffffb1a2c548bcc0] general_protection at ffffffffb280111e
    [exception RIP: __ptep_modify_prot_start+0x2]
    RIP: ffffffffb1e70c52  RSP: ffffb1a2c548bd70  RFLAGS: 00010246
    RAX: 0000000000000000  RBX: ffff95512783e1c0  RCX: 0000000000000027
    RDX: 000ffffffffff000  RSI: 80000003e9e000e3  RDI: ffff9553ea814cb0
    RBP: ffff95512783ee38   R8: ffffb1a2c548bd30   R9: ffff9551839f4208
    R10: 0000000000000000  R11: ffffffffb365ba50  R12: ffff95512783ee98
    R13: ffffffffb2d04000  R14: ffff9553ea814cb0  R15: 80000003e9e000e1
    ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018
 #5 [ffffb1a2c548bd70] linux_ktap_set_pmd at ffffffffc0a01fad [ktap_113573]
 #6 [ffffb1a2c548bd78] my_make_kern_page_writable at ffffffffc09aaee1 [ktap_113573]
 #7 [ffffb1a2c548bdc0] my_make_writable at ffffffffc09abd3c [ktap_113573]
 #8 [ffffb1a2c548bde8] hook_ipv6_socks at ffffffffc09bce6e [ktap_113573]
 #9 [ffffb1a2c548be00] hook_user_sock at ffffffffc09bd09f [ktap_113573]
#10 [ffffb1a2c548be38] ktap_ioctl at ffffffffc09feb5b [ktap_113573]
#11 [ffffb1a2c548be60] ktap_unlocked_ioctl at ffffffffc0a004bd [ktap_113573]
#12 [ffffb1a2c548be80] do_vfs_ioctl at ffffffffb2172364
#13 [ffffb1a2c548bef8] ksys_ioctl at ffffffffb21729b4
#14 [ffffb1a2c548bf30] __x64_sys_ioctl at ffffffffb2172a06
#15 [ffffb1a2c548bf38] do_syscall_64 at ffffffffb1e043ab
…

The kernel module involved is a 3rd-party one:

crash> mod -t
NAME         TAINTS
ktap_113573  FOE

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments