[ 91.923385] test_klp_shadow_vars: klp_shadow_get(obj=PTR9, id=0x1235) = PTR11 [ 91.923387] test_klp_shadow_vars: got expected PTR11 -> PTR10 result [ 91.923388] test_klp_shadow_vars: klp_shadow_get(obj=PTR14, id=0x1235) = PTR16 [ 91.923389] test_klp_shadow_vars: got expected PTR16 -> PTR15 result [ 91.923403] test_klp_shadow_vars: klp_shadow_free_all(id=0x1235, dtor=PTR0) [ 91.923404] test_klp_shadow_vars: klp_shadow_get(obj=PTR1, id=0x1235) = PTR0 [ 91.923405] test_klp_shadow_vars: got expected NULL result [ 91.923406] test_klp_shadow_vars: klp_shadow_get(obj=PTR9, id=0x1235) = PTR0 [ 91.923408] test_klp_shadow_vars: got expected NULL result [ 91.923408] test_klp_shadow_vars: klp_shadow_get(obj=PTR14, id=0x1235) = PTR0 [ 91.923410] test_klp_shadow_vars: got expected NULL result [ 91.924707] % rmmod test_klp_shadow_vars [ 92.043422] livepatch: kernel.ftrace_enabled = 1 [ 92.049886] ===== TEST: system state modification ===== [ 92.053102] % modprobe test_klp_state [ 92.054575] livepatch: enabling patch 'test_klp_state' [ 92.054577] livepatch: 'test_klp_state': initializing patching transition [ 92.054599] test_klp_state: pre_patch_callback: vmlinux [ 92.054600] test_klp_state: allocate_loglevel_state: allocating space to store console_loglevel [ 92.054601] livepatch: 'test_klp_state': starting patching transition [ 92.911051] livepatch: 'test_klp_state': completing patching transition [ 92.911154] test_klp_state: post_patch_callback: vmlinux [ 92.911156] test_klp_state: fix_console_loglevel: fixing console_loglevel [ 92.911157] livepatch: 'test_klp_state': patching complete [ 92.971706] % echo 0 > /sys/kernel/livepatch/test_klp_state/enabled [ 92.971726] livepatch: 'test_klp_state': initializing unpatching transition [ 92.971748] test_klp_state: pre_unpatch_callback: vmlinux [ 92.971749] test_klp_state: restore_console_loglevel: restoring console_loglevel [ 92.971750] livepatch: 'test_klp_state': starting unpatching transition [ 94.751032] livepatch: 'test_klp_state': completing unpatching transition [ 94.751134] test_klp_state: post_unpatch_callback: vmlinux [ 94.751136] test_klp_state: free_loglevel_state: freeing space for the stored console_loglevel [ 94.751137] livepatch: 'test_klp_state': unpatching complete [ 94.788056] % rmmod test_klp_state [ 94.845476] ===== TEST: taking over system state modification ===== [ 94.848473] % modprobe test_klp_state [ 94.849942] livepatch: enabling patch 'test_klp_state' [ 94.849944] livepatch: 'test_klp_state': initializing patching transition [ 94.849964] test_klp_state: pre_patch_callback: vmlinux [ 94.849965] test_klp_state: allocate_loglevel_state: allocating space to store console_loglevel [ 94.849966] livepatch: 'test_klp_state': starting patching transition [ 95.711025] livepatch: 'test_klp_state': completing patching transition [ 95.711177] test_klp_state: post_patch_callback: vmlinux [ 95.711179] test_klp_state: fix_console_loglevel: fixing console_loglevel [ 95.711180] livepatch: 'test_klp_state': patching complete [ 95.770236] % modprobe test_klp_state2 [ 95.771616] livepatch: enabling patch 'test_klp_state2' [ 95.771618] livepatch: 'test_klp_state2': initializing patching transition [ 95.771638] test_klp_state2: pre_patch_callback: vmlinux [ 95.771639] test_klp_state2: allocate_loglevel_state: space to store console_loglevel already allocated [ 95.771641] livepatch: 'test_klp_state2': starting patching transition [ 97.081037] livepatch: 'test_klp_state2': completing patching transition [ 97.081197] test_klp_state2: post_patch_callback: vmlinux [ 97.081198] test_klp_state2: fix_console_loglevel: taking over the console_loglevel change [ 97.081199] livepatch: 'test_klp_state2': patching complete [ 97.096083] % rmmod test_klp_state [ 97.140728] % echo 0 > /sys/kernel/livepatch/test_klp_state2/enabled [ 97.140747] livepatch: 'test_klp_state2': initializing unpatching transition [ 97.140768] test_klp_state2: pre_unpatch_callback: vmlinux [ 97.140769] test_klp_state2: restore_console_loglevel: restoring console_loglevel [ 97.140770] livepatch: 'test_klp_state2': starting unpatching transition [ 98.671037] livepatch: 'test_klp_state2': completing unpatching transition [ 98.671175] test_klp_state2: post_unpatch_callback: vmlinux [ 98.671177] test_klp_state2: free_loglevel_state: freeing space for the stored console_loglevel [ 98.671179] livepatch: 'test_klp_state2': unpatching complete [ 98.755809] % rmmod test_klp_state2 [ 98.815472] ===== TEST: compatible cumulative livepatches ===== [ 98.818642] % modprobe test_klp_state2 [ 98.820299] livepatch: enabling patch 'test_klp_state2' [ 98.820301] livepatch: 'test_klp_state2': initializing patching transition [ 98.820328] test_klp_state2: pre_patch_callback: vmlinux [ 98.820330] test_klp_state2: allocate_loglevel_state: allocating space to store console_loglevel [ 98.820331] livepatch: 'test_klp_state2': starting patching transition [ 100.031067] livepatch: 'test_klp_state2': completing patching transition [ 100.031184] test_klp_state2: post_patch_callback: vmlinux [ 100.031185] test_klp_state2: fix_console_loglevel: fixing console_loglevel [ 100.031187] livepatch: 'test_klp_state2': patching complete [ 100.045573] % modprobe test_klp_state3 [ 100.047069] livepatch: enabling patch 'test_klp_state3' [ 100.047072] livepatch: 'test_klp_state3': initializing patching transition [ 100.047093] test_klp_state3: pre_patch_callback: vmlinux [ 100.047094] test_klp_state3: allocate_loglevel_state: space to store console_loglevel already allocated [ 100.047095] livepatch: 'test_klp_state3': starting patching transition [ 101.711037] livepatch: 'test_klp_state3': completing patching transition [ 101.711204] test_klp_state3: post_patch_callback: vmlinux [ 101.711206] test_klp_state3: fix_console_loglevel: taking over the console_loglevel change [ 101.711207] livepatch: 'test_klp_state3': patching complete [ 101.778205] % rmmod test_klp_state2 [ 101.853923] % modprobe test_klp_state2 [ 101.855447] livepatch: enabling patch 'test_klp_state2' [ 101.855449] livepatch: 'test_klp_state2': initializing patching transition [ 101.855470] test_klp_state2: pre_patch_callback: vmlinux [ 101.855472] test_klp_state2: allocate_loglevel_state: space to store console_loglevel already allocated [ 101.855473] livepatch: 'test_klp_state2': starting patching transition [ 103.630965] livepatch: 'test_klp_state2': completing patching transition [ 103.631070] test_klp_state2: post_patch_callback: vmlinux [ 103.631071] test_klp_state2: fix_console_loglevel: taking over the console_loglevel change [ 103.631073] livepatch: 'test_klp_state2': patching complete [ 103.686892] % echo 0 > /sys/kernel/livepatch/test_klp_state2/enabled [ 103.686911] livepatch: 'test_klp_state2': initializing unpatching transition [ 103.686932] test_klp_state2: pre_unpatch_callback: vmlinux [ 103.686933] test_klp_state2: restore_console_loglevel: restoring console_loglevel [ 103.686935] livepatch: 'test_klp_state2': starting unpatching transition [ 105.150996] livepatch: 'test_klp_state2': completing unpatching transition [ 105.151097] test_klp_state2: post_unpatch_callback: vmlinux [ 105.151099] test_klp_state2: free_loglevel_state: freeing space for the stored console_loglevel [ 105.151100] livepatch: 'test_klp_state2': unpatching complete [ 105.199966] % rmmod test_klp_state2 [ 105.281410] % rmmod test_klp_state3 [ 105.355459] ===== TEST: incompatible cumulative livepatches ===== [ 105.358650] % modprobe test_klp_state2 [ 105.360034] livepatch: enabling patch 'test_klp_state2' [ 105.360035] livepatch: 'test_klp_state2': initializing patching transition [ 105.360056] test_klp_state2: pre_patch_callback: vmlinux [ 105.360057] test_klp_state2: allocate_loglevel_state: allocating space to store console_loglevel [ 105.360058] livepatch: 'test_klp_state2': starting patching transition [ 107.071045] livepatch: 'test_klp_state2': completing patching transition [ 107.071145] test_klp_state2: post_patch_callback: vmlinux [ 107.071147] test_klp_state2: fix_console_loglevel: fixing console_loglevel [ 107.071148] livepatch: 'test_klp_state2': patching complete [ 107.087110] % modprobe test_klp_state [ 107.088695] livepatch: Livepatch patch (test_klp_state) is not compatible with the already installed livepatches. [ 107.190677] modprobe: ERROR: could not insert 'test_klp_state': Invalid argument [ 107.190716] % echo 0 > /sys/kernel/livepatch/test_klp_state2/enabled [ 107.190734] livepatch: 'test_klp_state2': initializing unpatching transition [ 107.190753] test_klp_state2: pre_unpatch_callback: vmlinux [ 107.190754] test_klp_state2: restore_console_loglevel: restoring console_loglevel [ 107.190755] livepatch: 'test_klp_state2': starting unpatching transition [ 108.111015] livepatch: 'test_klp_state2': completing unpatching transition [ 108.111118] test_klp_state2: post_unpatch_callback: vmlinux [ 108.111120] test_klp_state2: free_loglevel_state: freeing space for the stored console_loglevel [ 108.111121] livepatch: 'test_klp_state2': unpatching complete [ 108.200035] % rmmod test_klp_state2 [ 108.301787] livepatch: kernel.ftrace_enabled = 1 [ 108.308056] ===== TEST: livepatch interaction with ftrace_enabled sysctl ===== [ 108.309828] livepatch: kernel.ftrace_enabled = 0 [ 108.309890] % modprobe test_klp_livepatch [ 108.311242] livepatch: enabling patch 'test_klp_livepatch' [ 108.311244] livepatch: 'test_klp_livepatch': initializing patching transition [ 108.311267] livepatch: failed to register ftrace handler for function 'cmdline_proc_show' (-16) [ 108.311270] livepatch: failed to patch object 'vmlinux' [ 108.311271] livepatch: failed to enable patch 'test_klp_livepatch' [ 108.311272] livepatch: 'test_klp_livepatch': canceling patching transition, going to unpatch [ 108.311273] livepatch: 'test_klp_livepatch': completing unpatching transition [ 108.311382] livepatch: 'test_klp_livepatch': unpatching complete [ 108.500681] modprobe: ERROR: could not insert 'test_klp_livepatch': Device or resource busy [ 108.502529] livepatch: kernel.ftrace_enabled = 1 [ 108.505528] % modprobe test_klp_livepatch [ 108.506881] livepatch: enabling patch 'test_klp_livepatch' [ 108.506882] livepatch: 'test_klp_livepatch': initializing patching transition [ 108.508030] livepatch: 'test_klp_livepatch': starting patching transition [ 109.790992] livepatch: 'test_klp_livepatch': completing patching transition [ 109.791146] livepatch: 'test_klp_livepatch': patching complete [ 109.834645] livepatch: sysctl: setting key "kernel.ftrace_enabled": Device or resource busy [ 109.835658] % echo 0 > /sys/kernel/livepatch/test_klp_livepatch/enabled [ 109.835676] livepatch: 'test_klp_livepatch': initializing unpatching transition [ 109.835692] livepatch: 'test_klp_livepatch': starting unpatching transition [ 110.831016] livepatch: 'test_klp_livepatch': completing unpatching transition [ 110.832521] livepatch: 'test_klp_livepatch': unpatching complete [ 110.845082] % rmmod test_klp_livepatch [ 110.962324] livepatch: kernel.ftrace_enabled = 1 [ 110.969070] ===== TEST: sysfs test ===== [ 110.972147] % modprobe test_klp_livepatch [ 110.973575] livepatch: enabling patch 'test_klp_livepatch' [ 110.973578] livepatch: 'test_klp_livepatch': initializing patching transition [ 110.974676] livepatch: 'test_klp_livepatch': starting patching transition [ 112.671034] livepatch: 'test_klp_livepatch': completing patching transition [ 112.671137] livepatch: 'test_klp_livepatch': patching complete [ 112.711815] % echo 0 > /sys/kernel/livepatch/test_klp_livepatch/enabled [ 112.711832] livepatch: 'test_klp_livepatch': initializing unpatching transition [ 112.711853] livepatch: 'test_klp_livepatch': starting unpatching transition [ 113.711046] livepatch: 'test_klp_livepatch': completing unpatching transition [ 113.712556] livepatch: 'test_klp_livepatch': unpatching complete [ 113.721666] % rmmod test_klp_livepatch [ 113.786348] ===== TEST: sysfs test object/patched ===== [ 113.789508] % modprobe test_klp_callbacks_demo [ 113.791059] livepatch: enabling patch 'test_klp_callbacks_demo' [ 113.791061] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 113.791082] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 113.791083] livepatch: 'test_klp_callbacks_demo': starting patching transition [ 114.831046] livepatch: 'test_klp_callbacks_demo': completing patching transition [ 114.831155] test_klp_callbacks_demo: post_patch_callback: vmlinux [ 114.831157] livepatch: 'test_klp_callbacks_demo': patching complete [ 114.915700] % modprobe test_klp_callbacks_mod [ 114.917199] livepatch: applying patch 'test_klp_callbacks_demo' to loading module 'test_klp_callbacks_mod' [ 114.917201] test_klp_callbacks_demo: pre_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_COMING] Full formed, running module_init [ 114.917203] test_klp_callbacks_demo: post_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_COMING] Full formed, running module_init [ 114.917220] test_klp_callbacks_mod: test_klp_callbacks_mod_init [ 114.919407] % rmmod test_klp_callbacks_mod [ 114.920563] test_klp_callbacks_mod: test_klp_callbacks_mod_exit [ 114.920578] test_klp_callbacks_demo: pre_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_GOING] Going away [ 114.920580] livepatch: reverting patch 'test_klp_callbacks_demo' on unloading module 'test_klp_callbacks_mod' [ 114.920582] test_klp_callbacks_demo: post_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_GOING] Going away [ 114.991648] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled [ 114.991667] livepatch: 'test_klp_callbacks_demo': initializing unpatching transition [ 114.991690] test_klp_callbacks_demo: pre_unpatch_callback: vmlinux [ 114.991692] livepatch: 'test_klp_callbacks_demo': starting unpatching transition [ 116.671055] livepatch: 'test_klp_callbacks_demo': completing unpatching transition [ 116.671159] test_klp_callbacks_demo: post_unpatch_callback: vmlinux [ 116.671177] livepatch: 'test_klp_callbacks_demo': unpatching complete [ 116.706610] % rmmod test_klp_callbacks_demo [ 116.853345] livepatch: kernel.ftrace_enabled = 1 [ 116.860222] ===== TEST: basic function patching ===== [ 116.863329] % modprobe test_klp_livepatch [ 116.864936] livepatch: enabling patch 'test_klp_livepatch' [ 116.864938] livepatch: 'test_klp_livepatch': initializing patching transition [ 116.866224] livepatch: 'test_klp_livepatch': starting patching transition [ 117.791071] livepatch: 'test_klp_livepatch': completing patching transition [ 117.791193] livepatch: 'test_klp_livepatch': patching complete [ 117.885360] % echo 0 > /sys/kernel/livepatch/test_klp_livepatch/enabled [ 117.885397] livepatch: 'test_klp_livepatch': initializing unpatching transition [ 117.885424] livepatch: 'test_klp_livepatch': starting unpatching transition [ 118.750980] livepatch: 'test_klp_livepatch': completing unpatching transition [ 118.752543] livepatch: 'test_klp_livepatch': unpatching complete [ 118.794530] % rmmod test_klp_livepatch [ 118.897157] ===== TEST: multiple livepatches ===== [ 118.900009] % modprobe test_klp_livepatch [ 118.901338] livepatch: enabling patch 'test_klp_livepatch' [ 118.901341] livepatch: 'test_klp_livepatch': initializing patching transition [ 118.902413] livepatch: 'test_klp_livepatch': starting patching transition [ 119.711012] livepatch: 'test_klp_livepatch': completing patching transition [ 119.711114] livepatch: 'test_klp_livepatch': patching complete [ 119.718796] test_klp_livepatch: this has been live patched [ 119.723001] % modprobe test_klp_atomic_replace replace=0 [ 119.724612] livepatch: enabling patch 'test_klp_atomic_replace' [ 119.724614] livepatch: 'test_klp_atomic_replace': initializing patching transition [ 119.725833] livepatch: 'test_klp_atomic_replace': starting patching transition [ 120.751022] livepatch: 'test_klp_atomic_replace': completing patching transition [ 120.751130] livepatch: 'test_klp_atomic_replace': patching complete [ 120.847005] test_klp_livepatch: this has been live patched [ 120.847986] test_klp_atomic_replace: this has been live patched [ 120.848118] % echo 0 > /sys/kernel/livepatch/test_klp_atomic_replace/enabled [ 120.848138] livepatch: 'test_klp_atomic_replace': initializing unpatching transition [ 120.848158] livepatch: 'test_klp_atomic_replace': starting unpatching transition [ 121.710988] livepatch: 'test_klp_atomic_replace': completing unpatching transition [ 121.712378] livepatch: 'test_klp_atomic_replace': unpatching complete [ 121.757104] % rmmod test_klp_atomic_replace [ 121.801514] test_klp_livepatch: this has been live patched [ 121.802520] % echo 0 > /sys/kernel/livepatch/test_klp_livepatch/enabled [ 121.802538] livepatch: 'test_klp_livepatch': initializing unpatching transition [ 121.802554] livepatch: 'test_klp_livepatch': starting unpatching transition [ 122.761006] livepatch: 'test_klp_livepatch': completing unpatching transition [ 122.762405] livepatch: 'test_klp_livepatch': unpatching complete [ 122.812386] % rmmod test_klp_livepatch [ 122.888229] ===== TEST: atomic replace livepatch ===== [ 122.891365] % modprobe test_klp_livepatch [ 122.892757] livepatch: enabling patch 'test_klp_livepatch' [ 122.892759] livepatch: 'test_klp_livepatch': initializing patching transition [ 122.893900] livepatch: 'test_klp_livepatch': starting patching transition [ 123.871073] livepatch: 'test_klp_livepatch': completing patching transition [ 123.871179] livepatch: 'test_klp_livepatch': patching complete [ 123.913201] test_klp_livepatch: this has been live patched [ 123.917508] % modprobe test_klp_atomic_replace replace=1 [ 123.918994] livepatch: enabling patch 'test_klp_atomic_replace' [ 123.918996] livepatch: 'test_klp_atomic_replace': initializing patching transition [ 123.920106] livepatch: 'test_klp_atomic_replace': starting patching transition [ 124.751016] livepatch: 'test_klp_atomic_replace': completing patching transition [ 124.752390] livepatch: 'test_klp_atomic_replace': patching complete [ 124.838483] test_klp_atomic_replace: this has been live patched [ 124.839576] % rmmod test_klp_livepatch [ 124.892319] test_klp_atomic_replace: this has been live patched [ 124.892494] % echo 0 > /sys/kernel/livepatch/test_klp_atomic_replace/enabled [ 124.892513] livepatch: 'test_klp_atomic_replace': initializing unpatching transition [ 124.892529] livepatch: 'test_klp_atomic_replace': starting unpatching transition [ 125.711010] livepatch: 'test_klp_atomic_replace': completing unpatching transition [ 125.712510] livepatch: 'test_klp_atomic_replace': unpatching complete [ 125.801651] % rmmod test_klp_atomic_replace [ 125.905407] livepatch: kernel.ftrace_enabled = 1 [ 125.912644] ===== TEST: target module before livepatch ===== [ 125.915835] % modprobe test_klp_callbacks_mod [ 125.917236] test_klp_callbacks_mod: test_klp_callbacks_mod_init [ 125.920790] % modprobe test_klp_callbacks_demo [ 125.922345] livepatch: enabling patch 'test_klp_callbacks_demo' [ 125.922347] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 125.922366] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 125.922367] test_klp_callbacks_demo: pre_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state [ 125.922369] livepatch: 'test_klp_callbacks_demo': starting patching transition [ 127.711053] livepatch: 'test_klp_callbacks_demo': completing patching transition [ 127.711189] test_klp_callbacks_demo: post_patch_callback: vmlinux [ 127.711191] test_klp_callbacks_demo: post_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state [ 127.711193] livepatch: 'test_klp_callbacks_demo': patching complete [ 127.755072] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled [ 127.755091] livepatch: 'test_klp_callbacks_demo': initializing unpatching transition [ 127.755106] test_klp_callbacks_demo: pre_unpatch_callback: vmlinux [ 127.755107] test_klp_callbacks_demo: pre_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state [ 127.755109] livepatch: 'test_klp_callbacks_demo': starting unpatching transition [ 128.671068] livepatch: 'test_klp_callbacks_demo': completing unpatching transition [ 128.671171] test_klp_callbacks_demo: post_unpatch_callback: vmlinux [ 128.671172] test_klp_callbacks_demo: post_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state [ 128.671174] livepatch: 'test_klp_callbacks_demo': unpatching complete [ 128.765224] % rmmod test_klp_callbacks_demo [ 128.811614] % rmmod test_klp_callbacks_mod [ 128.812787] test_klp_callbacks_mod: test_klp_callbacks_mod_exit [ 128.887174] ===== TEST: module_coming notifier ===== [ 128.890422] % modprobe test_klp_callbacks_demo [ 128.892042] livepatch: enabling patch 'test_klp_callbacks_demo' [ 128.892045] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 128.892067] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 128.892068] livepatch: 'test_klp_callbacks_demo': starting patching transition [ 129.791064] livepatch: 'test_klp_callbacks_demo': completing patching transition [ 129.791173] test_klp_callbacks_demo: post_patch_callback: vmlinux [ 129.791175] livepatch: 'test_klp_callbacks_demo': patching complete [ 129.812482] % modprobe test_klp_callbacks_mod [ 129.813968] livepatch: applying patch 'test_klp_callbacks_demo' to loading module 'test_klp_callbacks_mod' [ 129.813971] test_klp_callbacks_demo: pre_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_COMING] Full formed, running module_init [ 129.813973] test_klp_callbacks_demo: post_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_COMING] Full formed, running module_init [ 129.813990] test_klp_callbacks_mod: test_klp_callbacks_mod_init [ 129.814364] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled [ 129.814383] livepatch: 'test_klp_callbacks_demo': initializing unpatching transition [ 129.814404] test_klp_callbacks_demo: pre_unpatch_callback: vmlinux [ 129.814405] test_klp_callbacks_demo: pre_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state [ 129.814407] livepatch: 'test_klp_callbacks_demo': starting unpatching transition [ 130.671041] livepatch: 'test_klp_callbacks_demo': completing unpatching transition [ 130.671174] test_klp_callbacks_demo: post_unpatch_callback: vmlinux [ 130.671176] test_klp_callbacks_demo: post_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state [ 130.671178] livepatch: 'test_klp_callbacks_demo': unpatching complete [ 130.723905] % rmmod test_klp_callbacks_demo [ 130.771625] % rmmod test_klp_callbacks_mod [ 130.772641] test_klp_callbacks_mod: test_klp_callbacks_mod_exit [ 130.826909] ===== TEST: module_going notifier ===== [ 130.830202] % modprobe test_klp_callbacks_mod [ 130.831538] test_klp_callbacks_mod: test_klp_callbacks_mod_init [ 130.834984] % modprobe test_klp_callbacks_demo [ 130.836549] livepatch: enabling patch 'test_klp_callbacks_demo' [ 130.836552] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 130.836573] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 130.836574] test_klp_callbacks_demo: pre_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state [ 130.836576] livepatch: 'test_klp_callbacks_demo': starting patching transition [ 131.710974] livepatch: 'test_klp_callbacks_demo': completing patching transition [ 131.711075] test_klp_callbacks_demo: post_patch_callback: vmlinux [ 131.711077] test_klp_callbacks_demo: post_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state [ 131.711079] livepatch: 'test_klp_callbacks_demo': patching complete [ 131.754244] % rmmod test_klp_callbacks_mod [ 131.755454] test_klp_callbacks_mod: test_klp_callbacks_mod_exit [ 131.755471] test_klp_callbacks_demo: pre_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_GOING] Going away [ 131.755473] livepatch: reverting patch 'test_klp_callbacks_demo' on unloading module 'test_klp_callbacks_mod' [ 131.755475] test_klp_callbacks_demo: post_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_GOING] Going away [ 131.800736] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled [ 131.800754] livepatch: 'test_klp_callbacks_demo': initializing unpatching transition [ 131.800775] test_klp_callbacks_demo: pre_unpatch_callback: vmlinux [ 131.800776] livepatch: 'test_klp_callbacks_demo': starting unpatching transition [ 133.071027] livepatch: 'test_klp_callbacks_demo': completing unpatching transition [ 133.071132] test_klp_callbacks_demo: post_unpatch_callback: vmlinux [ 133.071134] livepatch: 'test_klp_callbacks_demo': unpatching complete [ 133.113297] % rmmod test_klp_callbacks_demo [ 133.177434] ===== TEST: module_coming and module_going notifiers ===== [ 133.180622] % modprobe test_klp_callbacks_demo [ 133.182228] livepatch: enabling patch 'test_klp_callbacks_demo' [ 133.182231] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 133.182251] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 133.182252] livepatch: 'test_klp_callbacks_demo': starting patching transition [ 134.751073] livepatch: 'test_klp_callbacks_demo': completing patching transition [ 134.751184] test_klp_callbacks_demo: post_patch_callback: vmlinux [ 134.751187] livepatch: 'test_klp_callbacks_demo': patching complete [ 134.813811] % modprobe test_klp_callbacks_mod [ 134.815280] livepatch: applying patch 'test_klp_callbacks_demo' to loading module 'test_klp_callbacks_mod' [ 134.815282] test_klp_callbacks_demo: pre_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_COMING] Full formed, running module_init [ 134.815284] test_klp_callbacks_demo: post_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_COMING] Full formed, running module_init [ 134.815302] test_klp_callbacks_mod: test_klp_callbacks_mod_init [ 134.816526] % rmmod test_klp_callbacks_mod [ 134.817758] test_klp_callbacks_mod: test_klp_callbacks_mod_exit [ 134.817773] test_klp_callbacks_demo: pre_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_GOING] Going away [ 134.817775] livepatch: reverting patch 'test_klp_callbacks_demo' on unloading module 'test_klp_callbacks_mod' [ 134.817776] test_klp_callbacks_demo: post_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_GOING] Going away [ 134.940787] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled [ 134.940806] livepatch: 'test_klp_callbacks_demo': initializing unpatching transition [ 134.940828] test_klp_callbacks_demo: pre_unpatch_callback: vmlinux [ 134.940829] livepatch: 'test_klp_callbacks_demo': starting unpatching transition [ 135.950967] livepatch: 'test_klp_callbacks_demo': completing unpatching transition [ 135.951069] test_klp_callbacks_demo: post_unpatch_callback: vmlinux [ 135.951071] livepatch: 'test_klp_callbacks_demo': unpatching complete [ 136.051536] % rmmod test_klp_callbacks_demo [ 136.117597] ===== TEST: target module not present ===== [ 136.120836] % modprobe test_klp_callbacks_demo [ 136.122441] livepatch: enabling patch 'test_klp_callbacks_demo' [ 136.122444] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 136.122476] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 136.122477] livepatch: 'test_klp_callbacks_demo': starting patching transition [ 137.871054] livepatch: 'test_klp_callbacks_demo': completing patching transition [ 137.871179] test_klp_callbacks_demo: post_patch_callback: vmlinux [ 137.871181] livepatch: 'test_klp_callbacks_demo': patching complete [ 137.952610] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled [ 137.952631] livepatch: 'test_klp_callbacks_demo': initializing unpatching transition [ 137.952666] test_klp_callbacks_demo: pre_unpatch_callback: vmlinux [ 137.952668] livepatch: 'test_klp_callbacks_demo': starting unpatching transition [ 139.071051] livepatch: 'test_klp_callbacks_demo': completing unpatching transition [ 139.071152] test_klp_callbacks_demo: post_unpatch_callback: vmlinux [ 139.071154] livepatch: 'test_klp_callbacks_demo': unpatching complete [ 139.164250] % rmmod test_klp_callbacks_demo [ 139.257782] ===== TEST: pre-patch callback -ENODEV ===== [ 139.260610] % modprobe test_klp_callbacks_mod [ 139.261932] test_klp_callbacks_mod: test_klp_callbacks_mod_init [ 139.262266] % modprobe test_klp_callbacks_demo pre_patch_ret=-19 [ 139.263690] livepatch: enabling patch 'test_klp_callbacks_demo' [ 139.263692] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 139.263711] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 139.263712] livepatch: pre-patch callback failed for object 'vmlinux' [ 139.263713] livepatch: failed to enable patch 'test_klp_callbacks_demo' [ 139.263714] livepatch: 'test_klp_callbacks_demo': canceling patching transition, going to unpatch [ 139.263715] livepatch: 'test_klp_callbacks_demo': completing unpatching transition [ 139.263820] livepatch: 'test_klp_callbacks_demo': unpatching complete [ 139.410666] modprobe: ERROR: could not insert 'test_klp_callbacks_demo': No such device [ 139.411683] % rmmod test_klp_callbacks_mod [ 139.412838] test_klp_callbacks_mod: test_klp_callbacks_mod_exit [ 139.477858] ===== TEST: module_coming + pre-patch callback -ENODEV ===== [ 139.480794] % modprobe test_klp_callbacks_demo [ 139.482279] livepatch: enabling patch 'test_klp_callbacks_demo' [ 139.482282] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 139.482303] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 139.482304] livepatch: 'test_klp_callbacks_demo': starting patching transition [ 140.831122] livepatch: 'test_klp_callbacks_demo': completing patching transition [ 140.831279] test_klp_callbacks_demo: post_patch_callback: vmlinux [ 140.831281] livepatch: 'test_klp_callbacks_demo': patching complete [ 140.908032] % echo -19 > /sys/module/test_klp_callbacks_demo/parameters/pre_patch_ret [ 140.908963] % modprobe test_klp_callbacks_mod [ 140.910243] livepatch: applying patch 'test_klp_callbacks_demo' to loading module 'test_klp_callbacks_mod' [ 140.910246] test_klp_callbacks_demo: pre_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_COMING] Full formed, running module_init [ 140.910248] livepatch: pre-patch callback failed for object 'test_klp_callbacks_mod' [ 140.910249] livepatch: patch 'test_klp_callbacks_demo' failed for module 'test_klp_callbacks_mod', refusing to load module 'test_klp_callbacks_mod' [ 141.030671] modprobe: ERROR: could not insert 'test_klp_callbacks_mod': No such device [ 141.030722] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled [ 141.030738] livepatch: 'test_klp_callbacks_demo': initializing unpatching transition [ 141.030776] test_klp_callbacks_demo: pre_unpatch_callback: vmlinux [ 141.030777] livepatch: 'test_klp_callbacks_demo': starting unpatching transition [ 141.789613] crw_info : CRW reports slct=0, oflw=0, chn=0, rsc=B, anc=0, erc=0, rsid=0 [ 142.031077] livepatch: 'test_klp_callbacks_demo': completing unpatching transition [ 142.031196] test_klp_callbacks_demo: post_unpatch_callback: vmlinux [ 142.031198] livepatch: 'test_klp_callbacks_demo': unpatching complete [ 142.041387] % rmmod test_klp_callbacks_demo [ 142.108391] ===== TEST: multiple target modules ===== [ 142.111495] % modprobe test_klp_callbacks_busy block_transition=N [ 142.112950] test_klp_callbacks_busy: test_klp_callbacks_busy_init [ 142.112954] test_klp_callbacks_busy: busymod_work_func enter [ 142.112956] test_klp_callbacks_busy: busymod_work_func exit [ 142.116379] % modprobe test_klp_callbacks_demo [ 142.117801] livepatch: enabling patch 'test_klp_callbacks_demo' [ 142.117802] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 142.117840] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 142.117841] test_klp_callbacks_demo: pre_patch_callback: test_klp_callbacks_busy -> [MODULE_STATE_LIVE] Normal state [ 142.119215] livepatch: 'test_klp_callbacks_demo': starting patching transition [ 143.070935] livepatch: 'test_klp_callbacks_demo': completing patching transition [ 143.071035] test_klp_callbacks_demo: post_patch_callback: vmlinux [ 143.071037] test_klp_callbacks_demo: post_patch_callback: test_klp_callbacks_busy -> [MODULE_STATE_LIVE] Normal state [ 143.071039] livepatch: 'test_klp_callbacks_demo': patching complete [ 143.141657] % modprobe test_klp_callbacks_mod [ 143.143195] livepatch: applying patch 'test_klp_callbacks_demo' to loading module 'test_klp_callbacks_mod' [ 143.143198] test_klp_callbacks_demo: pre_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_COMING] Full formed, running module_init [ 143.143200] test_klp_callbacks_demo: post_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_COMING] Full formed, running module_init [ 143.143236] test_klp_callbacks_mod: test_klp_callbacks_mod_init [ 143.144563] % rmmod test_klp_callbacks_mod [ 143.145857] test_klp_callbacks_mod: test_klp_callbacks_mod_exit [ 143.145873] test_klp_callbacks_demo: pre_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_GOING] Going away [ 143.145875] livepatch: reverting patch 'test_klp_callbacks_demo' on unloading module 'test_klp_callbacks_mod' [ 143.145876] test_klp_callbacks_demo: post_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_GOING] Going away [ 143.220815] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled [ 143.220851] livepatch: 'test_klp_callbacks_demo': initializing unpatching transition [ 143.220872] test_klp_callbacks_demo: pre_unpatch_callback: vmlinux [ 143.220873] test_klp_callbacks_demo: pre_unpatch_callback: test_klp_callbacks_busy -> [MODULE_STATE_LIVE] Normal state [ 143.220875] livepatch: 'test_klp_callbacks_demo': starting unpatching transition [ 144.031007] livepatch: 'test_klp_callbacks_demo': completing unpatching transition [ 144.032819] test_klp_callbacks_demo: post_unpatch_callback: vmlinux [ 144.032821] test_klp_callbacks_demo: post_unpatch_callback: test_klp_callbacks_busy -> [MODULE_STATE_LIVE] Normal state [ 144.032822] livepatch: 'test_klp_callbacks_demo': unpatching complete [ 144.130433] % rmmod test_klp_callbacks_demo [ 144.211697] % rmmod test_klp_callbacks_busy [ 144.213003] test_klp_callbacks_busy: test_klp_callbacks_busy_exit [ 144.308603] ===== TEST: busy target module ===== [ 144.311786] % modprobe test_klp_callbacks_busy block_transition=Y [ 144.313186] test_klp_callbacks_busy: test_klp_callbacks_busy_init [ 144.313190] test_klp_callbacks_busy: busymod_work_func enter [ 144.316644] % modprobe test_klp_callbacks_demo [ 144.318094] livepatch: enabling patch 'test_klp_callbacks_demo' [ 144.318095] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 144.318115] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 144.318116] test_klp_callbacks_demo: pre_patch_callback: test_klp_callbacks_busy -> [MODULE_STATE_LIVE] Normal state [ 144.319516] livepatch: 'test_klp_callbacks_demo': starting patching transition [ 144.324787] % modprobe test_klp_callbacks_mod [ 144.326157] livepatch: applying patch 'test_klp_callbacks_demo' to loading module 'test_klp_callbacks_mod' [ 144.326159] test_klp_callbacks_demo: pre_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_COMING] Full formed, running module_init [ 144.326174] test_klp_callbacks_mod: test_klp_callbacks_mod_init [ 144.327454] % rmmod test_klp_callbacks_mod [ 144.328546] test_klp_callbacks_mod: test_klp_callbacks_mod_exit [ 144.328561] livepatch: reverting patch 'test_klp_callbacks_demo' on unloading module 'test_klp_callbacks_mod' [ 144.328563] test_klp_callbacks_demo: post_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_GOING] Going away [ 144.410842] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled [ 144.410861] livepatch: 'test_klp_callbacks_demo': reversing transition from patching to unpatching [ 144.410966] livepatch: 'test_klp_callbacks_demo': starting unpatching transition [ 146.990932] livepatch: 'test_klp_callbacks_demo': completing unpatching transition [ 146.992683] test_klp_callbacks_demo: post_unpatch_callback: vmlinux [ 146.992685] test_klp_callbacks_demo: post_unpatch_callback: test_klp_callbacks_busy -> [MODULE_STATE_LIVE] Normal state [ 146.992687] livepatch: 'test_klp_callbacks_demo': unpatching complete [ 147.033638] % rmmod test_klp_callbacks_demo [ 147.121645] % rmmod test_klp_callbacks_busy [ 147.130314] test_klp_callbacks_busy: busymod_work_func exit [ 147.130323] test_klp_callbacks_busy: test_klp_callbacks_busy_exit [ 147.208177] ===== TEST: multiple livepatches ===== [ 147.211079] % modprobe test_klp_callbacks_demo [ 147.212707] livepatch: enabling patch 'test_klp_callbacks_demo' [ 147.212710] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 147.212730] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 147.212731] livepatch: 'test_klp_callbacks_demo': starting patching transition [ 148.031059] livepatch: 'test_klp_callbacks_demo': completing patching transition [ 148.031160] test_klp_callbacks_demo: post_patch_callback: vmlinux [ 148.031162] livepatch: 'test_klp_callbacks_demo': patching complete [ 148.132098] % modprobe test_klp_callbacks_demo2 [ 148.133641] livepatch: enabling patch 'test_klp_callbacks_demo2' [ 148.133644] livepatch: 'test_klp_callbacks_demo2': initializing patching transition [ 148.133664] test_klp_callbacks_demo2: pre_patch_callback: vmlinux [ 148.133666] livepatch: 'test_klp_callbacks_demo2': starting patching transition [ 149.151067] livepatch: 'test_klp_callbacks_demo2': completing patching transition [ 149.151184] test_klp_callbacks_demo2: post_patch_callback: vmlinux [ 149.151186] livepatch: 'test_klp_callbacks_demo2': patching complete [ 149.152975] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo2/enabled [ 149.152995] livepatch: 'test_klp_callbacks_demo2': initializing unpatching transition [ 149.153015] test_klp_callbacks_demo2: pre_unpatch_callback: vmlinux [ 149.153016] livepatch: 'test_klp_callbacks_demo2': starting unpatching transition [ 149.951022] livepatch: 'test_klp_callbacks_demo2': completing unpatching transition [ 149.951125] test_klp_callbacks_demo2: post_unpatch_callback: vmlinux [ 149.951127] livepatch: 'test_klp_callbacks_demo2': unpatching complete [ 149.960854] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled [ 149.960873] livepatch: 'test_klp_callbacks_demo': initializing unpatching transition [ 149.960888] test_klp_callbacks_demo: pre_unpatch_callback: vmlinux [ 149.960890] livepatch: 'test_klp_callbacks_demo': starting unpatching transition [ 150.991050] livepatch: 'test_klp_callbacks_demo': completing unpatching transition [ 150.991152] test_klp_callbacks_demo: post_unpatch_callback: vmlinux [ 150.991154] livepatch: 'test_klp_callbacks_demo': unpatching complete [ 151.071631] % rmmod test_klp_callbacks_demo2 [ 151.131726] % rmmod test_klp_callbacks_demo [ 151.229250] ===== TEST: atomic replace ===== [ 151.232455] % modprobe test_klp_callbacks_demo [ 151.234085] livepatch: enabling patch 'test_klp_callbacks_demo' [ 151.234087] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 151.234107] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 151.234108] livepatch: 'test_klp_callbacks_demo': starting patching transition [ 152.031077] livepatch: 'test_klp_callbacks_demo': completing patching transition [ 152.031231] test_klp_callbacks_demo: post_patch_callback: vmlinux [ 152.031233] livepatch: 'test_klp_callbacks_demo': patching complete [ 152.052914] % modprobe test_klp_callbacks_demo2 replace=1 [ 152.054593] livepatch: enabling patch 'test_klp_callbacks_demo2' [ 152.054595] livepatch: 'test_klp_callbacks_demo2': initializing patching transition [ 152.054616] test_klp_callbacks_demo2: pre_patch_callback: vmlinux [ 152.054618] livepatch: 'test_klp_callbacks_demo2': starting patching transition [ 153.071103] livepatch: 'test_klp_callbacks_demo2': completing patching transition [ 153.071224] test_klp_callbacks_demo2: post_patch_callback: vmlinux [ 153.071226] livepatch: 'test_klp_callbacks_demo2': patching complete [ 153.073798] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo2/enabled [ 153.073819] livepatch: 'test_klp_callbacks_demo2': initializing unpatching transition [ 153.073840] test_klp_callbacks_demo2: pre_unpatch_callback: vmlinux [ 153.073841] livepatch: 'test_klp_callbacks_demo2': starting unpatching transition [ 154.031008] livepatch: 'test_klp_callbacks_demo2': completing unpatching transition [ 154.031113] test_klp_callbacks_demo2: post_unpatch_callback: vmlinux [ 154.031116] livepatch: 'test_klp_callbacks_demo2': unpatching complete [ 154.084458] % rmmod test_klp_callbacks_demo2 [ 154.161744] % rmmod test_klp_callbacks_demo [ 154.245192] livepatch: kernel.ftrace_enabled = 1 [ 154.253557] ===== TEST: basic shadow variable API ===== [ 154.256693] % modprobe test_klp_shadow_vars [ 154.258215] test_klp_shadow_vars: klp_shadow_get(obj=PTR1, id=0x1234) = PTR0 [ 154.258218] test_klp_shadow_vars: got expected NULL result [ 154.258220] test_klp_shadow_vars: shadow_ctor: PTR3 -> PTR2 [ 154.258221] test_klp_shadow_vars: klp_shadow_get_or_alloc(obj=PTR1, id=0x1234, size=8, gfp_flags=GFP_KERNEL), ctor=PTR4, ctor_data=PTR2 = PTR3 [ 154.258224] test_klp_shadow_vars: shadow_ctor: PTR6 -> PTR5 [ 154.258226] test_klp_shadow_vars: klp_shadow_alloc(obj=PTR1, id=0x1235, size=8, gfp_flags=GFP_KERNEL), ctor=PTR4, ctor_data=PTR5 = PTR6 [ 154.258228] test_klp_shadow_vars: shadow_ctor: PTR8 -> PTR7 [ 154.258229] test_klp_shadow_vars: klp_shadow_alloc(obj=PTR9, id=0x1234, size=8, gfp_flags=GFP_KERNEL), ctor=PTR4, ctor_data=PTR7 = PTR8 [ 154.258232] test_klp_shadow_vars: shadow_ctor: PTR11 -> PTR10 [ 154.258233] test_klp_shadow_vars: klp_shadow_alloc(obj=PTR9, id=0x1235, size=8, gfp_flags=GFP_KERNEL), ctor=PTR4, ctor_data=PTR10 = PTR11 [ 154.258235] test_klp_shadow_vars: shadow_ctor: PTR13 -> PTR12 [ 154.258236] test_klp_shadow_vars: klp_shadow_get_or_alloc(obj=PTR14, id=0x1234, size=8, gfp_flags=GFP_KERNEL), ctor=PTR4, ctor_data=PTR12 = PTR13 [ 154.258239] test_klp_shadow_vars: shadow_ctor: PTR16 -> PTR15 [ 154.258240] test_klp_shadow_vars: klp_shadow_alloc(obj=PTR14, id=0x1235, size=8, gfp_flags=GFP_KERNEL), ctor=PTR4, ctor_data=PTR15 = PTR16 [ 154.258242] test_klp_shadow_vars: klp_shadow_get(obj=PTR1, id=0x1234) = PTR3 [ 154.258243] test_klp_shadow_vars: got expected PTR3 -> PTR2 result [ 154.258244] test_klp_shadow_vars: klp_shadow_get(obj=PTR1, id=0x1235) = PTR6 [ 154.258246] test_klp_shadow_vars: got expected PTR6 -> PTR5 result [ 154.258268] test_klp_shadow_vars: klp_shadow_get(obj=PTR9, id=0x1234) = PTR8 [ 154.258269] test_klp_shadow_vars: got expected PTR8 -> PTR7 result [ 154.258270] test_klp_shadow_vars: klp_shadow_get(obj=PTR9, id=0x1235) = PTR11 [ 154.258271] test_klp_shadow_vars: got expected PTR11 -> PTR10 result [ 154.258273] test_klp_shadow_vars: klp_shadow_get(obj=PTR14, id=0x1234) = PTR13 [ 154.258274] test_klp_shadow_vars: got expected PTR13 -> PTR12 result [ 154.258275] test_klp_shadow_vars: klp_shadow_get(obj=PTR14, id=0x1235) = PTR16 [ 154.258276] test_klp_shadow_vars: got expected PTR16 -> PTR15 result [ 154.258278] test_klp_shadow_vars: klp_shadow_get_or_alloc(obj=PTR1, id=0x1234, size=8, gfp_flags=GFP_KERNEL), ctor=PTR4, ctor_data=PTR2 = PTR3 [ 154.258280] test_klp_shadow_vars: got expected PTR3 -> PTR2 result [ 154.258281] test_klp_shadow_vars: klp_shadow_get_or_alloc(obj=PTR9, id=0x1234, size=8, gfp_flags=GFP_KERNEL), ctor=PTR4, ctor_data=PTR7 = PTR8 [ 154.258283] test_klp_shadow_vars: got expected PTR8 -> PTR7 result [ 154.258284] test_klp_shadow_vars: klp_shadow_get_or_alloc(obj=PTR14, id=0x1234, size=8, gfp_flags=GFP_KERNEL), ctor=PTR4, ctor_data=PTR12 = PTR13 [ 154.258286] test_klp_shadow_vars: got expected PTR13 -> PTR12 result [ 154.258287] test_klp_shadow_vars: shadow_dtor(obj=PTR1, shadow_data=PTR3) [ 154.258289] test_klp_shadow_vars: klp_shadow_free(obj=PTR1, id=0x1234, dtor=PTR17) [ 154.258290] test_klp_shadow_vars: klp_shadow_get(obj=PTR1, id=0x1234) = PTR0 [ 154.258292] test_klp_shadow_vars: got expected NULL result [ 154.258292] test_klp_shadow_vars: shadow_dtor(obj=PTR9, shadow_data=PTR8) [ 154.258294] test_klp_shadow_vars: klp_shadow_free(obj=PTR9, id=0x1234, dtor=PTR17) [ 154.258295] test_klp_shadow_vars: klp_shadow_get(obj=PTR9, id=0x1234) = PTR0 [ 154.258297] test_klp_shadow_vars: got expected NULL result [ 154.258297] test_klp_shadow_vars: shadow_dtor(obj=PTR14, shadow_data=PTR13) [ 154.258299] test_klp_shadow_vars: klp_shadow_free(obj=PTR14, id=0x1234, dtor=PTR17) [ 154.258300] test_klp_shadow_vars: klp_shadow_get(obj=PTR14, id=0x1234) = PTR0 [ 154.258301] test_klp_shadow_vars: got expected NULL result [ 154.258302] test_klp_shadow_vars: klp_shadow_get(obj=PTR1, id=0x1235) = PTR6 [ 154.258303] test_klp_shadow_vars: got expected PTR6 -> PTR5 result [ 154.258304] test_klp_shadow_vars: klp_shadow_get(obj=PTR9, id=0x1235) = PTR11 [ 154.258306] test_klp_shadow_vars: got expected PTR11 -> PTR10 result [ 154.258307] test_klp_shadow_vars: klp_shadow_get(obj=PTR14, id=0x1235) = PTR16 [ 154.258308] test_klp_shadow_vars: got expected PTR16 -> PTR15 result [ 154.258317] test_klp_shadow_vars: klp_shadow_free_all(id=0x1235, dtor=PTR0) [ 154.258318] test_klp_shadow_vars: klp_shadow_get(obj=PTR1, id=0x1235) = PTR0 [ 154.258319] test_klp_shadow_vars: got expected NULL result [ 154.258320] test_klp_shadow_vars: klp_shadow_get(obj=PTR9, id=0x1235) = PTR0 [ 154.258321] test_klp_shadow_vars: got expected NULL result [ 154.258322] test_klp_shadow_vars: klp_shadow_get(obj=PTR14, id=0x1235) = PTR0 [ 154.258323] test_klp_shadow_vars: got expected NULL result [ 154.259549] % rmmod test_klp_shadow_vars [ 154.364539] livepatch: kernel.ftrace_enabled = 1 [ 154.373051] ===== TEST: system state modification ===== [ 154.376288] % modprobe test_klp_state [ 154.377808] livepatch: enabling patch 'test_klp_state' [ 154.377810] livepatch: 'test_klp_state': initializing patching transition [ 154.377832] test_klp_state: pre_patch_callback: vmlinux [ 154.377833] test_klp_state: allocate_loglevel_state: allocating space to store console_loglevel [ 154.377834] livepatch: 'test_klp_state': starting patching transition [ 155.951098] livepatch: 'test_klp_state': completing patching transition [ 155.951196] test_klp_state: post_patch_callback: vmlinux [ 155.951198] test_klp_state: fix_console_loglevel: fixing console_loglevel [ 155.951199] livepatch: 'test_klp_state': patching complete [ 156.005967] % echo 0 > /sys/kernel/livepatch/test_klp_state/enabled [ 156.005986] livepatch: 'test_klp_state': initializing unpatching transition [ 156.006003] test_klp_state: pre_unpatch_callback: vmlinux [ 156.006004] test_klp_state: restore_console_loglevel: restoring console_loglevel [ 156.006005] livepatch: 'test_klp_state': starting unpatching transition [ 156.991099] livepatch: 'test_klp_state': completing unpatching transition [ 156.991197] test_klp_state: post_unpatch_callback: vmlinux [ 156.991199] test_klp_state: free_loglevel_state: freeing space for the stored console_loglevel [ 156.991201] livepatch: 'test_klp_state': unpatching complete [ 157.016096] % rmmod test_klp_state [ 157.119439] ===== TEST: taking over system state modification ===== [ 157.122658] % modprobe test_klp_state [ 157.124299] livepatch: enabling patch 'test_klp_state' [ 157.124302] livepatch: 'test_klp_state': initializing patching transition [ 157.124324] test_klp_state: pre_patch_callback: vmlinux [ 157.124325] test_klp_state: allocate_loglevel_state: allocating space to store console_loglevel [ 157.124326] livepatch: 'test_klp_state': starting patching transition [ 158.031004] livepatch: 'test_klp_state': completing patching transition [ 158.031105] test_klp_state: post_patch_callback: vmlinux [ 158.031107] test_klp_state: fix_console_loglevel: fixing console_loglevel [ 158.031109] livepatch: 'test_klp_state': patching complete [ 158.044647] % modprobe test_klp_state2 [ 158.046174] livepatch: enabling patch 'test_klp_state2' [ 158.046176] livepatch: 'test_klp_state2': initializing patching transition [ 158.046194] test_klp_state2: pre_patch_callback: vmlinux [ 158.046195] test_klp_state2: allocate_loglevel_state: space to store console_loglevel already allocated [ 158.046197] livepatch: 'test_klp_state2': starting patching transition [ 158.991060] livepatch: 'test_klp_state2': completing patching transition [ 158.991184] test_klp_state2: post_patch_callback: vmlinux [ 158.991185] test_klp_state2: fix_console_loglevel: taking over the console_loglevel change [ 158.991186] livepatch: 'test_klp_state2': patching complete [ 159.065518] % rmmod test_klp_state [ 159.130779] % echo 0 > /sys/kernel/livepatch/test_klp_state2/enabled [ 159.130797] livepatch: 'test_klp_state2': initializing unpatching transition [ 159.130818] test_klp_state2: pre_unpatch_callback: vmlinux [ 159.130819] test_klp_state2: restore_console_loglevel: restoring console_loglevel [ 159.130820] livepatch: 'test_klp_state2': starting unpatching transition [ 160.911085] livepatch: 'test_klp_state2': completing unpatching transition [ 160.911224] test_klp_state2: post_unpatch_callback: vmlinux [ 160.911226] test_klp_state2: free_loglevel_state: freeing space for the stored console_loglevel [ 160.911227] livepatch: 'test_klp_state2': unpatching complete [ 160.948036] % rmmod test_klp_state2 [ 161.059424] ===== TEST: compatible cumulative livepatches ===== [ 161.062474] % modprobe test_klp_state2 [ 161.063931] livepatch: enabling patch 'test_klp_state2' [ 161.063934] livepatch: 'test_klp_state2': initializing patching transition [ 161.063957] test_klp_state2: pre_patch_callback: vmlinux [ 161.063958] test_klp_state2: allocate_loglevel_state: allocating space to store console_loglevel [ 161.063959] livepatch: 'test_klp_state2': starting patching transition [ 162.671079] livepatch: 'test_klp_state2': completing patching transition [ 162.671184] test_klp_state2: post_patch_callback: vmlinux [ 162.671186] test_klp_state2: fix_console_loglevel: fixing console_loglevel [ 162.671188] livepatch: 'test_klp_state2': patching complete [ 162.694355] % modprobe test_klp_state3 [ 162.695852] livepatch: enabling patch 'test_klp_state3' [ 162.695855] livepatch: 'test_klp_state3': initializing patching transition [ 162.695877] test_klp_state3: pre_patch_callback: vmlinux [ 162.695878] test_klp_state3: allocate_loglevel_state: space to store console_loglevel already allocated [ 162.695879] livepatch: 'test_klp_state3': starting patching transition [ 163.951036] livepatch: 'test_klp_state3': completing patching transition [ 163.951139] test_klp_state3: post_patch_callback: vmlinux [ 163.951141] test_klp_state3: fix_console_loglevel: taking over the console_loglevel change [ 163.951142] livepatch: 'test_klp_state3': patching complete [ 164.019372] % rmmod test_klp_state2 [ 164.093821] % modprobe test_klp_state2 [ 164.095460] livepatch: enabling patch 'test_klp_state2' [ 164.095463] livepatch: 'test_klp_state2': initializing patching transition [ 164.095484] test_klp_state2: pre_patch_callback: vmlinux [ 164.095485] test_klp_state2: allocate_loglevel_state: space to store console_loglevel already allocated [ 164.095487] livepatch: 'test_klp_state2': starting patching transition [ 165.871122] livepatch: 'test_klp_state2': completing patching transition [ 165.871280] test_klp_state2: post_patch_callback: vmlinux [ 165.871281] test_klp_state2: fix_console_loglevel: taking over the console_loglevel change [ 165.871283] livepatch: 'test_klp_state2': patching complete [ 165.926447] % echo 0 > /sys/kernel/livepatch/test_klp_state2/enabled [ 165.926486] livepatch: 'test_klp_state2': initializing unpatching transition [ 165.926507] test_klp_state2: pre_unpatch_callback: vmlinux [ 165.926508] test_klp_state2: restore_console_loglevel: restoring console_loglevel [ 165.926509] livepatch: 'test_klp_state2': starting unpatching transition [ 166.831076] livepatch: 'test_klp_state2': completing unpatching transition [ 166.831199] test_klp_state2: post_unpatch_callback: vmlinux [ 166.831201] test_klp_state2: free_loglevel_state: freeing space for the stored console_loglevel [ 166.831203] livepatch: 'test_klp_state2': unpatching complete [ 166.835243] % rmmod test_klp_state2 [ 166.901777] % rmmod test_klp_state3 [ 166.969742] ===== TEST: incompatible cumulative livepatches ===== [ 166.972899] % modprobe test_klp_state2 [ 166.974399] livepatch: enabling patch 'test_klp_state2' [ 166.974401] livepatch: 'test_klp_state2': initializing patching transition [ 166.974420] test_klp_state2: pre_patch_callback: vmlinux [ 166.974422] test_klp_state2: allocate_loglevel_state: allocating space to store console_loglevel [ 166.974423] livepatch: 'test_klp_state2': starting patching transition [ 168.681063] livepatch: 'test_klp_state2': completing patching transition [ 168.681165] test_klp_state2: post_patch_callback: vmlinux [ 168.681167] test_klp_state2: fix_console_loglevel: fixing console_loglevel [ 168.681169] livepatch: 'test_klp_state2': patching complete [ 168.703685] % modprobe test_klp_state [ 168.705124] livepatch: Livepatch patch (test_klp_state) is not compatible with the already installed livepatches. [ 168.860784] modprobe: ERROR: could not insert 'test_klp_state': Invalid argument [ 168.860833] % echo 0 > /sys/kernel/livepatch/test_klp_state2/enabled [ 168.860851] livepatch: 'test_klp_state2': initializing unpatching transition [ 168.860909] test_klp_state2: pre_unpatch_callback: vmlinux [ 168.860910] test_klp_state2: restore_console_loglevel: restoring console_loglevel [ 168.860911] livepatch: 'test_klp_state2': starting unpatching transition [ 169.871047] livepatch: 'test_klp_state2': completing unpatching transition [ 169.871186] test_klp_state2: post_unpatch_callback: vmlinux [ 169.871188] test_klp_state2: free_loglevel_state: freeing space for the stored console_loglevel [ 169.871189] livepatch: 'test_klp_state2': unpatching complete [ 169.971989] % rmmod test_klp_state2 [ 170.114423] livepatch: kernel.ftrace_enabled = 1 [ 170.122713] ===== TEST: livepatch interaction with ftrace_enabled sysctl ===== [ 170.124491] livepatch: kernel.ftrace_enabled = 0 [ 170.124552] % modprobe test_klp_livepatch [ 170.125916] livepatch: enabling patch 'test_klp_livepatch' [ 170.125918] livepatch: 'test_klp_livepatch': initializing patching transition [ 170.125942] livepatch: failed to register ftrace handler for function 'cmdline_proc_show' (-16) [ 170.125945] livepatch: failed to patch object 'vmlinux' [ 170.125946] livepatch: failed to enable patch 'test_klp_livepatch' [ 170.125947] livepatch: 'test_klp_livepatch': canceling patching transition, going to unpatch [ 170.125948] livepatch: 'test_klp_livepatch': completing unpatching transition [ 170.126056] livepatch: 'test_klp_livepatch': unpatching complete [ 170.260823] modprobe: ERROR: could not insert 'test_klp_livepatch': Device or resource busy [ 170.262584] livepatch: kernel.ftrace_enabled = 1 [ 170.265470] % modprobe test_klp_livepatch [ 170.266711] livepatch: enabling patch 'test_klp_livepatch' [ 170.266712] livepatch: 'test_klp_livepatch': initializing patching transition [ 170.267782] livepatch: 'test_klp_livepatch': starting patching transition [ 171.791076] livepatch: 'test_klp_livepatch': completing patching transition [ 171.791226] livepatch: 'test_klp_livepatch': patching complete [ 171.797053] livepatch: sysctl: setting key "kernel.ftrace_enabled": Device or resource busy [ 171.798001] % echo 0 > /sys/kernel/livepatch/test_klp_livepatch/enabled [ 171.798020] livepatch: 'test_klp_livepatch': initializing unpatching transition [ 171.798035] livepatch: 'test_klp_livepatch': starting unpatching transition [ 172.831042] livepatch: 'test_klp_livepatch': completing unpatching transition [ 172.832563] livepatch: 'test_klp_livepatch': unpatching complete [ 172.908336] % rmmod test_klp_livepatch [ 172.983414] livepatch: kernel.ftrace_enabled = 1 [ 172.991780] ===== TEST: sysfs test ===== [ 172.994796] % modprobe test_klp_livepatch [ 172.996248] livepatch: enabling patch 'test_klp_livepatch' [ 172.996250] livepatch: 'test_klp_livepatch': initializing patching transition [ 172.997482] livepatch: 'test_klp_livepatch': starting patching transition [ 174.671056] livepatch: 'test_klp_livepatch': completing patching transition [ 174.671194] livepatch: 'test_klp_livepatch': patching complete [ 174.734417] % echo 0 > /sys/kernel/livepatch/test_klp_livepatch/enabled [ 174.734432] livepatch: 'test_klp_livepatch': initializing unpatching transition [ 174.734466] livepatch: 'test_klp_livepatch': starting unpatching transition [ 175.711081] livepatch: 'test_klp_livepatch': completing unpatching transition [ 175.712575] livepatch: 'test_klp_livepatch': unpatching complete [ 175.744085] % rmmod test_klp_livepatch [ 175.808160] ===== TEST: sysfs test object/patched ===== [ 175.810980] % modprobe test_klp_callbacks_demo [ 175.812208] livepatch: enabling patch 'test_klp_callbacks_demo' [ 175.812210] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 175.812230] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 175.812231] livepatch: 'test_klp_callbacks_demo': starting patching transition [ 176.911051] livepatch: 'test_klp_callbacks_demo': completing patching transition [ 176.911161] test_klp_callbacks_demo: post_patch_callback: vmlinux [ 176.911163] livepatch: 'test_klp_callbacks_demo': patching complete [ 176.934731] % modprobe test_klp_callbacks_mod [ 176.935992] livepatch: applying patch 'test_klp_callbacks_demo' to loading module 'test_klp_callbacks_mod' [ 176.935994] test_klp_callbacks_demo: pre_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_COMING] Full formed, running module_init [ 176.935996] test_klp_callbacks_demo: post_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_COMING] Full formed, running module_init [ 176.936013] test_klp_callbacks_mod: test_klp_callbacks_mod_init [ 176.937945] % rmmod test_klp_callbacks_mod [ 176.938946] test_klp_callbacks_mod: test_klp_callbacks_mod_exit [ 176.938961] test_klp_callbacks_demo: pre_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_GOING] Going away [ 176.938963] livepatch: reverting patch 'test_klp_callbacks_demo' on unloading module 'test_klp_callbacks_mod' [ 176.938964] test_klp_callbacks_demo: post_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_GOING] Going away [ 176.991789] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled [ 176.991808] livepatch: 'test_klp_callbacks_demo': initializing unpatching transition [ 176.991828] test_klp_callbacks_demo: pre_unpatch_callback: vmlinux [ 176.991830] livepatch: 'test_klp_callbacks_demo': starting unpatching transition [ 178.191025] livepatch: 'test_klp_callbacks_demo': completing unpatching transition [ 178.191124] test_klp_callbacks_demo: post_unpatch_callback: vmlinux [ 178.191126] livepatch: 'test_klp_callbacks_demo': unpatching complete [ 178.202777] % rmmod test_klp_callbacks_demo [ 178.318263] livepatch: kernel.ftrace_enabled = 1 [ 178.326039] ===== TEST: basic function patching ===== [ 178.328835] % modprobe test_klp_livepatch [ 178.330156] livepatch: enabling patch 'test_klp_livepatch' [ 178.330158] livepatch: 'test_klp_livepatch': initializing patching transition [ 178.331256] livepatch: 'test_klp_livepatch': starting patching transition [ 179.711061] livepatch: 'test_klp_livepatch': completing patching transition [ 179.711168] livepatch: 'test_klp_livepatch': patching complete [ 179.757176] % echo 0 > /sys/kernel/livepatch/test_klp_livepatch/enabled [ 179.757196] livepatch: 'test_klp_livepatch': initializing unpatching transition [ 179.757219] livepatch: 'test_klp_livepatch': starting unpatching transition [ 180.751089] livepatch: 'test_klp_livepatch': completing unpatching transition [ 180.752537] livepatch: 'test_klp_livepatch': unpatching complete [ 180.767212] % rmmod test_klp_livepatch [ 180.830459] ===== TEST: multiple livepatches ===== [ 180.833537] % modprobe test_klp_livepatch [ 180.834932] livepatch: enabling patch 'test_klp_livepatch' [ 180.834933] livepatch: 'test_klp_livepatch': initializing patching transition [ 180.836072] livepatch: 'test_klp_livepatch': starting patching transition [ 181.711030] livepatch: 'test_klp_livepatch': completing patching transition [ 181.711129] livepatch: 'test_klp_livepatch': patching complete [ 181.753931] test_klp_livepatch: this has been live patched [ 181.758075] % modprobe test_klp_atomic_replace replace=0 [ 181.759630] livepatch: enabling patch 'test_klp_atomic_replace' [ 181.759632] livepatch: 'test_klp_atomic_replace': initializing patching transition [ 181.760761] livepatch: 'test_klp_atomic_replace': starting patching transition [ 182.751097] livepatch: 'test_klp_atomic_replace': completing patching transition [ 182.751210] livepatch: 'test_klp_atomic_replace': patching complete [ 182.779987] test_klp_livepatch: this has been live patched [ 182.780949] test_klp_atomic_replace: this has been live patched [ 182.781132] % echo 0 > /sys/kernel/livepatch/test_klp_atomic_replace/enabled [ 182.781152] livepatch: 'test_klp_atomic_replace': initializing unpatching transition [ 182.781172] livepatch: 'test_klp_atomic_replace': starting unpatching transition [ 183.711178] livepatch: 'test_klp_atomic_replace': completing unpatching transition [ 183.712627] livepatch: 'test_klp_atomic_replace': unpatching complete [ 183.791173] % rmmod test_klp_atomic_replace [ 183.881579] test_klp_livepatch: this has been live patched [ 183.882598] % echo 0 > /sys/kernel/livepatch/test_klp_livepatch/enabled [ 183.882616] livepatch: 'test_klp_livepatch': initializing unpatching transition [ 183.882634] livepatch: 'test_klp_livepatch': starting unpatching transition [ 184.751183] livepatch: 'test_klp_livepatch': completing unpatching transition [ 184.752715] livepatch: 'test_klp_livepatch': unpatching complete [ 184.791884] % rmmod test_klp_livepatch [ 184.921013] ===== TEST: atomic replace livepatch ===== [ 184.924117] % modprobe test_klp_livepatch [ 184.925507] livepatch: enabling patch 'test_klp_livepatch' [ 184.925509] livepatch: 'test_klp_livepatch': initializing patching transition [ 184.926666] livepatch: 'test_klp_livepatch': starting patching transition [ 185.791155] livepatch: 'test_klp_livepatch': completing patching transition [ 185.791263] livepatch: 'test_klp_livepatch': patching complete [ 185.844460] test_klp_livepatch: this has been live patched [ 185.848202] % modprobe test_klp_atomic_replace replace=1 [ 185.849784] livepatch: enabling patch 'test_klp_atomic_replace' [ 185.849786] livepatch: 'test_klp_atomic_replace': initializing patching transition [ 185.850899] livepatch: 'test_klp_atomic_replace': starting patching transition [ 186.751268] livepatch: 'test_klp_atomic_replace': completing patching transition [ 186.752724] livepatch: 'test_klp_atomic_replace': patching complete [ 186.769820] test_klp_atomic_replace: this has been live patched [ 186.771001] % rmmod test_klp_livepatch [ 186.842577] test_klp_atomic_replace: this has been live patched [ 186.842713] % echo 0 > /sys/kernel/livepatch/test_klp_atomic_replace/enabled [ 186.842732] livepatch: 'test_klp_atomic_replace': initializing unpatching transition [ 186.842752] livepatch: 'test_klp_atomic_replace': starting unpatching transition [ 187.711155] livepatch: 'test_klp_atomic_replace': completing unpatching transition [ 187.712686] livepatch: 'test_klp_atomic_replace': unpatching complete [ 187.751949] % rmmod test_klp_atomic_replace [ 187.875356] livepatch: kernel.ftrace_enabled = 1 [ 187.883440] ===== TEST: target module before livepatch ===== [ 187.886603] % modprobe test_klp_callbacks_mod [ 187.887986] test_klp_callbacks_mod: test_klp_callbacks_mod_init [ 187.891200] % modprobe test_klp_callbacks_demo [ 187.892630] livepatch: enabling patch 'test_klp_callbacks_demo' [ 187.892632] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 187.892658] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 187.892659] test_klp_callbacks_demo: pre_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state [ 187.892660] livepatch: 'test_klp_callbacks_demo': starting patching transition [ 189.071175] livepatch: 'test_klp_callbacks_demo': completing patching transition [ 189.071347] test_klp_callbacks_demo: post_patch_callback: vmlinux [ 189.071350] test_klp_callbacks_demo: post_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state [ 189.071351] livepatch: 'test_klp_callbacks_demo': patching complete [ 189.113416] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled [ 189.113437] livepatch: 'test_klp_callbacks_demo': initializing unpatching transition [ 189.113459] test_klp_callbacks_demo: pre_unpatch_callback: vmlinux [ 189.113460] test_klp_callbacks_demo: pre_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state [ 189.113461] livepatch: 'test_klp_callbacks_demo': starting unpatching transition [ 190.831161] livepatch: 'test_klp_callbacks_demo': completing unpatching transition [ 190.831300] test_klp_callbacks_demo: post_unpatch_callback: vmlinux [ 190.831303] test_klp_callbacks_demo: post_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state [ 190.831304] livepatch: 'test_klp_callbacks_demo': unpatching complete [ 190.928590] % rmmod test_klp_callbacks_demo [ 190.981743] % rmmod test_klp_callbacks_mod [ 190.982844] test_klp_callbacks_mod: test_klp_callbacks_mod_exit [ 191.068717] ===== TEST: module_coming notifier ===== [ 191.071881] % modprobe test_klp_callbacks_demo [ 191.073324] livepatch: enabling patch 'test_klp_callbacks_demo' [ 191.073326] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 191.073345] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 191.073347] livepatch: 'test_klp_callbacks_demo': starting patching transition [ 192.761063] livepatch: 'test_klp_callbacks_demo': completing patching transition [ 192.761166] test_klp_callbacks_demo: post_patch_callback: vmlinux [ 192.761168] livepatch: 'test_klp_callbacks_demo': patching complete [ 192.804600] % modprobe test_klp_callbacks_mod [ 192.806035] livepatch: applying patch 'test_klp_callbacks_demo' to loading module 'test_klp_callbacks_mod' [ 192.806038] test_klp_callbacks_demo: pre_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_COMING] Full formed, running module_init [ 192.806040] test_klp_callbacks_demo: post_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_COMING] Full formed, running module_init [ 192.806058] test_klp_callbacks_mod: test_klp_callbacks_mod_init [ 192.806411] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled [ 192.806429] livepatch: 'test_klp_callbacks_demo': initializing unpatching transition [ 192.806450] test_klp_callbacks_demo: pre_unpatch_callback: vmlinux [ 192.806452] test_klp_callbacks_demo: pre_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state [ 192.806453] livepatch: 'test_klp_callbacks_demo': starting unpatching transition [ 193.951153] livepatch: 'test_klp_callbacks_demo': completing unpatching transition [ 193.951254] test_klp_callbacks_demo: post_unpatch_callback: vmlinux [ 193.951256] test_klp_callbacks_demo: post_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state [ 193.951257] livepatch: 'test_klp_callbacks_demo': unpatching complete [ 194.016717] % rmmod test_klp_callbacks_demo [ 194.111640] % rmmod test_klp_callbacks_mod [ 194.112834] test_klp_callbacks_mod: test_klp_callbacks_mod_exit [ 194.179536] ===== TEST: module_going notifier ===== [ 194.182529] % modprobe test_klp_callbacks_mod [ 194.183902] test_klp_callbacks_mod: test_klp_callbacks_mod_init [ 194.186979] % modprobe test_klp_callbacks_demo [ 194.188306] livepatch: enabling patch 'test_klp_callbacks_demo' [ 194.188308] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 194.188334] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 194.188336] test_klp_callbacks_demo: pre_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state [ 194.188337] livepatch: 'test_klp_callbacks_demo': starting patching transition [ 195.871146] livepatch: 'test_klp_callbacks_demo': completing patching transition [ 195.871247] test_klp_callbacks_demo: post_patch_callback: vmlinux [ 195.871248] test_klp_callbacks_demo: post_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state [ 195.871250] livepatch: 'test_klp_callbacks_demo': patching complete [ 195.917690] % rmmod test_klp_callbacks_mod [ 195.918839] test_klp_callbacks_mod: test_klp_callbacks_mod_exit [ 195.918874] test_klp_callbacks_demo: pre_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_GOING] Going away [ 195.918876] livepatch: reverting patch 'test_klp_callbacks_demo' on unloading module 'test_klp_callbacks_mod' [ 195.918877] test_klp_callbacks_demo: post_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_GOING] Going away [ 196.000811] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled [ 196.000829] livepatch: 'test_klp_callbacks_demo': initializing unpatching transition [ 196.000847] test_klp_callbacks_demo: pre_unpatch_callback: vmlinux [ 196.000848] livepatch: 'test_klp_callbacks_demo': starting unpatching transition [ 196.831134] livepatch: 'test_klp_callbacks_demo': completing unpatching transition [ 196.831258] test_klp_callbacks_demo: post_unpatch_callback: vmlinux [ 196.831276] livepatch: 'test_klp_callbacks_demo': unpatching complete [ 196.909237] % rmmod test_klp_callbacks_demo [ 196.999252] ===== TEST: module_coming and module_going notifiers ===== [ 197.002219] % modprobe test_klp_callbacks_demo [ 197.003720] livepatch: enabling patch 'test_klp_callbacks_demo' [ 197.003722] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 197.003761] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 197.003762] livepatch: 'test_klp_callbacks_demo': starting patching transition [ 197.951097] livepatch: 'test_klp_callbacks_demo': completing patching transition [ 197.951197] test_klp_callbacks_demo: post_patch_callback: vmlinux [ 197.951199] livepatch: 'test_klp_callbacks_demo': patching complete [ 198.023498] % modprobe test_klp_callbacks_mod [ 198.024865] livepatch: applying patch 'test_klp_callbacks_demo' to loading module 'test_klp_callbacks_mod' [ 198.024868] test_klp_callbacks_demo: pre_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_COMING] Full formed, running module_init [ 198.024870] test_klp_callbacks_demo: post_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_COMING] Full formed, running module_init [ 198.024887] test_klp_callbacks_mod: test_klp_callbacks_mod_init [ 198.026043] % rmmod test_klp_callbacks_mod [ 198.027153] test_klp_callbacks_mod: test_klp_callbacks_mod_exit [ 198.027169] test_klp_callbacks_demo: pre_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_GOING] Going away [ 198.027171] livepatch: reverting patch 'test_klp_callbacks_demo' on unloading module 'test_klp_callbacks_mod' [ 198.027172] test_klp_callbacks_demo: post_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_GOING] Going away [ 198.110789] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled [ 198.110807] livepatch: 'test_klp_callbacks_demo': initializing unpatching transition [ 198.110828] test_klp_callbacks_demo: pre_unpatch_callback: vmlinux [ 198.110830] livepatch: 'test_klp_callbacks_demo': starting unpatching transition [ 199.881138] livepatch: 'test_klp_callbacks_demo': completing unpatching transition [ 199.881237] test_klp_callbacks_demo: post_unpatch_callback: vmlinux [ 199.881239] livepatch: 'test_klp_callbacks_demo': unpatching complete [ 199.925505] % rmmod test_klp_callbacks_demo [ 199.999151] ===== TEST: target module not present ===== [ 200.002145] % modprobe test_klp_callbacks_demo [ 200.003699] livepatch: enabling patch 'test_klp_callbacks_demo' [ 200.003701] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 200.003721] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 200.003723] livepatch: 'test_klp_callbacks_demo': starting patching transition [ 200.911124] livepatch: 'test_klp_callbacks_demo': completing patching transition [ 200.911242] test_klp_callbacks_demo: post_patch_callback: vmlinux [ 200.911244] livepatch: 'test_klp_callbacks_demo': patching complete [ 200.919249] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled [ 200.919267] livepatch: 'test_klp_callbacks_demo': initializing unpatching transition [ 200.919288] test_klp_callbacks_demo: pre_unpatch_callback: vmlinux [ 200.919289] livepatch: 'test_klp_callbacks_demo': starting unpatching transition [ 201.951160] livepatch: 'test_klp_callbacks_demo': completing unpatching transition [ 201.951277] test_klp_callbacks_demo: post_unpatch_callback: vmlinux [ 201.951279] livepatch: 'test_klp_callbacks_demo': unpatching complete [ 202.028867] % rmmod test_klp_callbacks_demo [ 202.119054] ===== TEST: pre-patch callback -ENODEV ===== [ 202.122040] % modprobe test_klp_callbacks_mod [ 202.123508] test_klp_callbacks_mod: test_klp_callbacks_mod_init [ 202.123862] % modprobe test_klp_callbacks_demo pre_patch_ret=-19 [ 202.125317] livepatch: enabling patch 'test_klp_callbacks_demo' [ 202.125319] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 202.125341] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 202.125342] livepatch: pre-patch callback failed for object 'vmlinux' [ 202.125343] livepatch: failed to enable patch 'test_klp_callbacks_demo' [ 202.125344] livepatch: 'test_klp_callbacks_demo': canceling patching transition, going to unpatch [ 202.125345] livepatch: 'test_klp_callbacks_demo': completing unpatching transition [ 202.125496] livepatch: 'test_klp_callbacks_demo': unpatching complete [ 202.250789] modprobe: ERROR: could not insert 'test_klp_callbacks_demo': No such device [ 202.251582] % rmmod test_klp_callbacks_mod [ 202.252724] test_klp_callbacks_mod: test_klp_callbacks_mod_exit [ 202.348771] ===== TEST: module_coming + pre-patch callback -ENODEV ===== [ 202.351804] % modprobe test_klp_callbacks_demo [ 202.353355] livepatch: enabling patch 'test_klp_callbacks_demo' [ 202.353357] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 202.353392] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 202.353393] livepatch: 'test_klp_callbacks_demo': starting patching transition [ 203.951197] livepatch: 'test_klp_callbacks_demo': completing patching transition [ 203.951351] test_klp_callbacks_demo: post_patch_callback: vmlinux [ 203.951353] livepatch: 'test_klp_callbacks_demo': patching complete [ 203.979670] % echo -19 > /sys/module/test_klp_callbacks_demo/parameters/pre_patch_ret [ 203.980548] % modprobe test_klp_callbacks_mod [ 203.981920] livepatch: applying patch 'test_klp_callbacks_demo' to loading module 'test_klp_callbacks_mod' [ 203.981922] test_klp_callbacks_demo: pre_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_COMING] Full formed, running module_init [ 203.981924] livepatch: pre-patch callback failed for object 'test_klp_callbacks_mod' [ 203.981925] livepatch: patch 'test_klp_callbacks_demo' failed for module 'test_klp_callbacks_mod', refusing to load module 'test_klp_callbacks_mod' [ 204.130800] modprobe: ERROR: could not insert 'test_klp_callbacks_mod': No such device [ 204.130845] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled [ 204.130862] livepatch: 'test_klp_callbacks_demo': initializing unpatching transition [ 204.130882] test_klp_callbacks_demo: pre_unpatch_callback: vmlinux [ 204.130884] livepatch: 'test_klp_callbacks_demo': starting unpatching transition [ 205.951235] livepatch: 'test_klp_callbacks_demo': completing unpatching transition [ 205.951341] test_klp_callbacks_demo: post_unpatch_callback: vmlinux [ 205.951343] livepatch: 'test_klp_callbacks_demo': unpatching complete [ 206.046975] % rmmod test_klp_callbacks_demo [ 206.128457] ===== TEST: multiple target modules ===== [ 206.131336] % modprobe test_klp_callbacks_busy block_transition=N [ 206.132672] test_klp_callbacks_busy: test_klp_callbacks_busy_init [ 206.132677] test_klp_callbacks_busy: busymod_work_func enter [ 206.132679] test_klp_callbacks_busy: busymod_work_func exit [ 206.135860] % modprobe test_klp_callbacks_demo [ 206.137206] livepatch: enabling patch 'test_klp_callbacks_demo' [ 206.137207] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 206.137228] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 206.137229] test_klp_callbacks_demo: pre_patch_callback: test_klp_callbacks_busy -> [MODULE_STATE_LIVE] Normal state [ 206.138577] livepatch: 'test_klp_callbacks_demo': starting patching transition [ 207.871214] livepatch: 'test_klp_callbacks_demo': completing patching transition [ 207.871314] test_klp_callbacks_demo: post_patch_callback: vmlinux [ 207.871316] test_klp_callbacks_demo: post_patch_callback: test_klp_callbacks_busy -> [MODULE_STATE_LIVE] Normal state [ 207.871318] livepatch: 'test_klp_callbacks_demo': patching complete [ 207.969934] % modprobe test_klp_callbacks_mod [ 207.971401] livepatch: applying patch 'test_klp_callbacks_demo' to loading module 'test_klp_callbacks_mod' [ 207.971404] test_klp_callbacks_demo: pre_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_COMING] Full formed, running module_init [ 207.971406] test_klp_callbacks_demo: post_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_COMING] Full formed, running module_init [ 207.971423] test_klp_callbacks_mod: test_klp_callbacks_mod_init [ 207.972674] % rmmod test_klp_callbacks_mod [ 207.973849] test_klp_callbacks_mod: test_klp_callbacks_mod_exit [ 207.973866] test_klp_callbacks_demo: pre_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_GOING] Going away [ 207.973868] livepatch: reverting patch 'test_klp_callbacks_demo' on unloading module 'test_klp_callbacks_mod' [ 207.973870] test_klp_callbacks_demo: post_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_GOING] Going away [ 208.050976] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled [ 208.050996] livepatch: 'test_klp_callbacks_demo': initializing unpatching transition [ 208.051017] test_klp_callbacks_demo: pre_unpatch_callback: vmlinux [ 208.051018] test_klp_callbacks_demo: pre_unpatch_callback: test_klp_callbacks_busy -> [MODULE_STATE_LIVE] Normal state [ 208.051020] livepatch: 'test_klp_callbacks_demo': starting unpatching transition [ 208.911216] livepatch: 'test_klp_callbacks_demo': completing unpatching transition [ 208.912965] test_klp_callbacks_demo: post_unpatch_callback: vmlinux [ 208.912967] test_klp_callbacks_demo: post_unpatch_callback: test_klp_callbacks_busy -> [MODULE_STATE_LIVE] Normal state [ 208.912969] livepatch: 'test_klp_callbacks_demo': unpatching complete [ 208.959486] % rmmod test_klp_callbacks_demo [ 209.071781] % rmmod test_klp_callbacks_busy [ 209.072943] test_klp_callbacks_busy: test_klp_callbacks_busy_exit [ 209.149873] ===== TEST: busy target module ===== [ 209.152833] % modprobe test_klp_callbacks_busy block_transition=Y [ 209.154258] test_klp_callbacks_busy: test_klp_callbacks_busy_init [ 209.154262] test_klp_callbacks_busy: busymod_work_func enter [ 209.157628] % modprobe test_klp_callbacks_demo [ 209.159018] livepatch: enabling patch 'test_klp_callbacks_demo' [ 209.159020] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 209.159040] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 209.159041] test_klp_callbacks_demo: pre_patch_callback: test_klp_callbacks_busy -> [MODULE_STATE_LIVE] Normal state [ 209.160430] livepatch: 'test_klp_callbacks_demo': starting patching transition [ 209.165518] % modprobe test_klp_callbacks_mod [ 209.166893] livepatch: applying patch 'test_klp_callbacks_demo' to loading module 'test_klp_callbacks_mod' [ 209.166896] test_klp_callbacks_demo: pre_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_COMING] Full formed, running module_init [ 209.166914] test_klp_callbacks_mod: test_klp_callbacks_mod_init [ 209.168092] % rmmod test_klp_callbacks_mod [ 209.169182] test_klp_callbacks_mod: test_klp_callbacks_mod_exit [ 209.169198] livepatch: reverting patch 'test_klp_callbacks_demo' on unloading module 'test_klp_callbacks_mod' [ 209.169200] test_klp_callbacks_demo: post_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_GOING] Going away [ 209.250960] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled [ 209.250978] livepatch: 'test_klp_callbacks_demo': reversing transition from patching to unpatching [ 209.251083] livepatch: 'test_klp_callbacks_demo': starting unpatching transition [ 211.871203] livepatch: 'test_klp_callbacks_demo': completing unpatching transition [ 211.872965] test_klp_callbacks_demo: post_unpatch_callback: vmlinux [ 211.872967] test_klp_callbacks_demo: post_unpatch_callback: test_klp_callbacks_busy -> [MODULE_STATE_LIVE] Normal state [ 211.872969] livepatch: 'test_klp_callbacks_demo': unpatching complete [ 211.971835] % rmmod test_klp_callbacks_demo [ 212.051698] % rmmod test_klp_callbacks_busy [ 212.090506] test_klp_callbacks_busy: busymod_work_func exit [ 212.090513] test_klp_callbacks_busy: test_klp_callbacks_busy_exit [ 212.169096] ===== TEST: multiple livepatches ===== [ 212.172221] % modprobe test_klp_callbacks_demo [ 212.173625] livepatch: enabling patch 'test_klp_callbacks_demo' [ 212.173627] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 212.173645] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 212.173646] livepatch: 'test_klp_callbacks_demo': starting patching transition [ 213.881119] livepatch: 'test_klp_callbacks_demo': completing patching transition [ 213.881238] test_klp_callbacks_demo: post_patch_callback: vmlinux [ 213.881240] livepatch: 'test_klp_callbacks_demo': patching complete [ 213.904735] % modprobe test_klp_callbacks_demo2 [ 213.906252] livepatch: enabling patch 'test_klp_callbacks_demo2' [ 213.906254] livepatch: 'test_klp_callbacks_demo2': initializing patching transition [ 213.906291] test_klp_callbacks_demo2: pre_patch_callback: vmlinux [ 213.906292] livepatch: 'test_klp_callbacks_demo2': starting patching transition [ 214.911228] livepatch: 'test_klp_callbacks_demo2': completing patching transition [ 214.911330] test_klp_callbacks_demo2: post_patch_callback: vmlinux [ 214.911332] livepatch: 'test_klp_callbacks_demo2': patching complete [ 214.923290] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo2/enabled [ 214.923309] livepatch: 'test_klp_callbacks_demo2': initializing unpatching transition [ 214.923323] test_klp_callbacks_demo2: pre_unpatch_callback: vmlinux [ 214.923324] livepatch: 'test_klp_callbacks_demo2': starting unpatching transition [ 215.951189] livepatch: 'test_klp_callbacks_demo2': completing unpatching transition [ 215.951289] test_klp_callbacks_demo2: post_unpatch_callback: vmlinux [ 215.951291] livepatch: 'test_klp_callbacks_demo2': unpatching complete [ 216.032305] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled [ 216.032322] livepatch: 'test_klp_callbacks_demo': initializing unpatching transition [ 216.032338] test_klp_callbacks_demo: pre_unpatch_callback: vmlinux [ 216.032339] livepatch: 'test_klp_callbacks_demo': starting unpatching transition [ 216.911208] livepatch: 'test_klp_callbacks_demo': completing unpatching transition [ 216.911327] test_klp_callbacks_demo: post_unpatch_callback: vmlinux [ 216.911329] livepatch: 'test_klp_callbacks_demo': unpatching complete [ 216.941200] % rmmod test_klp_callbacks_demo2 [ 217.011815] % rmmod test_klp_callbacks_demo [ 217.089875] ===== TEST: atomic replace ===== [ 217.092945] % modprobe test_klp_callbacks_demo [ 217.094433] livepatch: enabling patch 'test_klp_callbacks_demo' [ 217.094436] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 217.094455] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 217.094457] livepatch: 'test_klp_callbacks_demo': starting patching transition [ 217.951266] livepatch: 'test_klp_callbacks_demo': completing patching transition [ 217.951371] test_klp_callbacks_demo: post_patch_callback: vmlinux [ 217.951372] livepatch: 'test_klp_callbacks_demo': patching complete [ 218.014048] % modprobe test_klp_callbacks_demo2 replace=1 [ 218.015488] livepatch: enabling patch 'test_klp_callbacks_demo2' [ 218.015491] livepatch: 'test_klp_callbacks_demo2': initializing patching transition [ 218.015512] test_klp_callbacks_demo2: pre_patch_callback: vmlinux [ 218.015514] livepatch: 'test_klp_callbacks_demo2': starting patching transition [ 219.631259] livepatch: 'test_klp_callbacks_demo2': completing patching transition [ 219.631381] test_klp_callbacks_demo2: post_patch_callback: vmlinux [ 219.631383] livepatch: 'test_klp_callbacks_demo2': patching complete [ 219.643212] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo2/enabled [ 219.643241] livepatch: 'test_klp_callbacks_demo2': initializing unpatching transition [ 219.643273] test_klp_callbacks_demo2: pre_unpatch_callback: vmlinux [ 219.643274] livepatch: 'test_klp_callbacks_demo2': starting unpatching transition [ 220.831217] livepatch: 'test_klp_callbacks_demo2': completing unpatching transition [ 220.831316] test_klp_callbacks_demo2: post_unpatch_callback: vmlinux [ 220.831318] livepatch: 'test_klp_callbacks_demo2': unpatching complete [ 220.853623] % rmmod test_klp_callbacks_demo2 [ 220.931690] % rmmod test_klp_callbacks_demo [ 221.032866] livepatch: kernel.ftrace_enabled = 1 [ 221.041249] ===== TEST: basic shadow variable API ===== [ 221.044342] % modprobe test_klp_shadow_vars [ 221.046005] test_klp_shadow_vars: klp_shadow_get(obj=PTR1, id=0x1234) = PTR0 [ 221.046008] test_klp_shadow_vars: got expected NULL result [ 221.046010] test_klp_shadow_vars: shadow_ctor: PTR3 -> PTR2 [ 221.046011] test_klp_shadow_vars: klp_shadow_get_or_alloc(obj=PTR1, id=0x1234, size=8, gfp_flags=GFP_KERNEL), ctor=PTR4, ctor_data=PTR2 = PTR3 [ 221.046015] test_klp_shadow_vars: shadow_ctor: PTR6 -> PTR5 [ 221.046016] test_klp_shadow_vars: klp_shadow_alloc(obj=PTR1, id=0x1235, size=8, gfp_flags=GFP_KERNEL), ctor=PTR4, ctor_data=PTR5 = PTR6 [ 221.046019] test_klp_shadow_vars: shadow_ctor: PTR8 -> PTR7 [ 221.046020] test_klp_shadow_vars: klp_shadow_alloc(obj=PTR9, id=0x1234, size=8, gfp_flags=GFP_KERNEL), ctor=PTR4, ctor_data=PTR7 = PTR8 [ 221.046022] test_klp_shadow_vars: shadow_ctor: PTR11 -> PTR10 [ 221.046024] test_klp_shadow_vars: klp_shadow_alloc(obj=PTR9, id=0x1235, size=8, gfp_flags=GFP_KERNEL), ctor=PTR4, ctor_data=PTR10 = PTR11 [ 221.046026] test_klp_shadow_vars: shadow_ctor: PTR13 -> PTR12 [ 221.046028] test_klp_shadow_vars: klp_shadow_get_or_alloc(obj=PTR14, id=0x1234, size=8, gfp_flags=GFP_KERNEL), ctor=PTR4, ctor_data=PTR12 = PTR13 [ 221.046030] test_klp_shadow_vars: shadow_ctor: PTR16 -> PTR15 [ 221.046031] test_klp_shadow_vars: klp_shadow_alloc(obj=PTR14, id=0x1235, size=8, gfp_flags=GFP_KERNEL), ctor=PTR4, ctor_data=PTR15 = PTR16 [ 221.046034] test_klp_shadow_vars: klp_shadow_get(obj=PTR1, id=0x1234) = PTR3 [ 221.046035] test_klp_shadow_vars: got expected PTR3 -> PTR2 result [ 221.046036] test_klp_shadow_vars: klp_shadow_get(obj=PTR1, id=0x1235) = PTR6 [ 221.046038] test_klp_shadow_vars: got expected PTR6 -> PTR5 result [ 221.046039] test_klp_shadow_vars: klp_shadow_get(obj=PTR9, id=0x1234) = PTR8 [ 221.046041] test_klp_shadow_vars: got expected PTR8 -> PTR7 result [ 221.046042] test_klp_shadow_vars: klp_shadow_get(obj=PTR9, id=0x1235) = PTR11 [ 221.046043] test_klp_shadow_vars: got expected PTR11 -> PTR10 result [ 221.046045] test_klp_shadow_vars: klp_shadow_get(obj=PTR14, id=0x1234) = PTR13 [ 221.046046] test_klp_shadow_vars: got expected PTR13 -> PTR12 result [ 221.046047] test_klp_shadow_vars: klp_shadow_get(obj=PTR14, id=0x1235) = PTR16 [ 221.046049] test_klp_shadow_vars: got expected PTR16 -> PTR15 result [ 221.046050] test_klp_shadow_vars: klp_shadow_get_or_alloc(obj=PTR1, id=0x1234, size=8, gfp_flags=GFP_KERNEL), ctor=PTR4, ctor_data=PTR2 = PTR3 [ 221.046052] test_klp_shadow_vars: got expected PTR3 -> PTR2 result [ 221.046054] test_klp_shadow_vars: klp_shadow_get_or_alloc(obj=PTR9, id=0x1234, size=8, gfp_flags=GFP_KERNEL), ctor=PTR4, ctor_data=PTR7 = PTR8 [ 221.046056] test_klp_shadow_vars: got expected PTR8 -> PTR7 result [ 221.046057] test_klp_shadow_vars: klp_shadow_get_or_alloc(obj=PTR14, id=0x1234, size=8, gfp_flags=GFP_KERNEL), ctor=PTR4, ctor_data=PTR12 = PTR13 [ 221.046059] test_klp_shadow_vars: got expected PTR13 -> PTR12 result [ 221.046061] test_klp_shadow_vars: shadow_dtor(obj=PTR1, shadow_data=PTR3) [ 221.046063] test_klp_shadow_vars: klp_shadow_free(obj=PTR1, id=0x1234, dtor=PTR17) [ 221.046064] test_klp_shadow_vars: klp_shadow_get(obj=PTR1, id=0x1234) = PTR0 [ 221.046066] test_klp_shadow_vars: got expected NULL result [ 221.046067] test_klp_shadow_vars: shadow_dtor(obj=PTR9, shadow_data=PTR8) [ 221.046068] test_klp_shadow_vars: klp_shadow_free(obj=PTR9, id=0x1234, dtor=PTR17) [ 221.046070] test_klp_shadow_vars: klp_shadow_get(obj=PTR9, id=0x1234) = PTR0 [ 221.046071] test_klp_shadow_vars: got expected NULL result [ 221.046072] test_klp_shadow_vars: shadow_dtor(obj=PTR14, shadow_data=PTR13) [ 221.046073] test_klp_shadow_vars: klp_shadow_free(obj=PTR14, id=0x1234, dtor=PTR17) [ 221.046075] test_klp_shadow_vars: klp_shadow_get(obj=PTR14, id=0x1234) = PTR0 [ 221.046076] test_klp_shadow_vars: got expected NULL result [ 221.046077] test_klp_shadow_vars: klp_shadow_get(obj=PTR1, id=0x1235) = PTR6 [ 221.046079] test_klp_shadow_vars: got expected PTR6 -> PTR5 result [ 221.046080] test_klp_shadow_vars: klp_shadow_get(obj=PTR9, id=0x1235) = PTR11 [ 221.046081] test_klp_shadow_vars: got expected PTR11 -> PTR10 result [ 221.046083] test_klp_shadow_vars: klp_shadow_get(obj=PTR14, id=0x1235) = PTR16 [ 221.046084] test_klp_shadow_vars: got expected PTR16 -> PTR15 result [ 221.046092] test_klp_shadow_vars: klp_shadow_free_all(id=0x1235, dtor=PTR0) [ 221.046093] test_klp_shadow_vars: klp_shadow_get(obj=PTR1, id=0x1235) = PTR0 [ 221.046094] test_klp_shadow_vars: got expected NULL result [ 221.046095] test_klp_shadow_vars: klp_shadow_get(obj=PTR9, id=0x1235) = PTR0 [ 221.046097] test_klp_shadow_vars: got expected NULL result [ 221.046098] test_klp_shadow_vars: klp_shadow_get(obj=PTR14, id=0x1235) = PTR0 [ 221.046099] test_klp_shadow_vars: got expected NULL result [ 221.047460] % rmmod test_klp_shadow_vars [ 221.132199] livepatch: kernel.ftrace_enabled = 1 [ 221.140198] ===== TEST: system state modification ===== [ 221.143166] % modprobe test_klp_state [ 221.144614] livepatch: enabling patch 'test_klp_state' [ 221.144616] livepatch: 'test_klp_state': initializing patching transition [ 221.144637] test_klp_state: pre_patch_callback: vmlinux [ 221.144638] test_klp_state: allocate_loglevel_state: allocating space to store console_loglevel [ 221.144639] livepatch: 'test_klp_state': starting patching transition [ 222.111272] livepatch: 'test_klp_state': completing patching transition [ 222.111377] test_klp_state: post_patch_callback: vmlinux [ 222.111379] test_klp_state: fix_console_loglevel: fixing console_loglevel [ 222.111381] livepatch: 'test_klp_state': patching complete [ 222.162434] % echo 0 > /sys/kernel/livepatch/test_klp_state/enabled [ 222.162453] livepatch: 'test_klp_state': initializing unpatching transition [ 222.162474] test_klp_state: pre_unpatch_callback: vmlinux [ 222.162476] test_klp_state: restore_console_loglevel: restoring console_loglevel [ 222.162477] livepatch: 'test_klp_state': starting unpatching transition [ 223.951243] livepatch: 'test_klp_state': completing unpatching transition [ 223.951343] test_klp_state: post_unpatch_callback: vmlinux [ 223.951345] test_klp_state: free_loglevel_state: freeing space for the stored console_loglevel [ 223.951346] livepatch: 'test_klp_state': unpatching complete [ 223.978524] % rmmod test_klp_state [ 224.049861] ===== TEST: taking over system state modification ===== [ 224.052982] % modprobe test_klp_state [ 224.054535] livepatch: enabling patch 'test_klp_state' [ 224.054537] livepatch: 'test_klp_state': initializing patching transition [ 224.054558] test_klp_state: pre_patch_callback: vmlinux [ 224.054559] test_klp_state: allocate_loglevel_state: allocating space to store console_loglevel [ 224.054561] livepatch: 'test_klp_state': starting patching transition [ 224.921252] livepatch: 'test_klp_state': completing patching transition [ 224.921353] test_klp_state: post_patch_callback: vmlinux [ 224.921355] test_klp_state: fix_console_loglevel: fixing console_loglevel [ 224.921357] livepatch: 'test_klp_state': patching complete [ 224.974637] % modprobe test_klp_state2 [ 224.976246] livepatch: enabling patch 'test_klp_state2' [ 224.976248] livepatch: 'test_klp_state2': initializing patching transition [ 224.976275] test_klp_state2: pre_patch_callback: vmlinux [ 224.976276] test_klp_state2: allocate_loglevel_state: space to store console_loglevel already allocated [ 224.976278] livepatch: 'test_klp_state2': starting patching transition [ 226.031256] livepatch: 'test_klp_state2': completing patching transition [ 226.031388] test_klp_state2: post_patch_callback: vmlinux [ 226.031389] test_klp_state2: fix_console_loglevel: taking over the console_loglevel change [ 226.031390] livepatch: 'test_klp_state2': patching complete [ 226.097150] % rmmod test_klp_state [ 226.170953] % echo 0 > /sys/kernel/livepatch/test_klp_state2/enabled [ 226.170972] livepatch: 'test_klp_state2': initializing unpatching transition [ 226.170994] test_klp_state2: pre_unpatch_callback: vmlinux [ 226.170995] test_klp_state2: restore_console_loglevel: restoring console_loglevel [ 226.170996] livepatch: 'test_klp_state2': starting unpatching transition [ 227.951209] livepatch: 'test_klp_state2': completing unpatching transition [ 227.951314] test_klp_state2: post_unpatch_callback: vmlinux [ 227.951317] test_klp_state2: free_loglevel_state: freeing space for the stored console_loglevel [ 227.951318] livepatch: 'test_klp_state2': unpatching complete [ 227.987229] % rmmod test_klp_state2 [ 228.048401] ===== TEST: compatible cumulative livepatches ===== [ 228.051472] % modprobe test_klp_state2 [ 228.052836] livepatch: enabling patch 'test_klp_state2' [ 228.052839] livepatch: 'test_klp_state2': initializing patching transition [ 228.052858] test_klp_state2: pre_patch_callback: vmlinux [ 228.052860] test_klp_state2: allocate_loglevel_state: allocating space to store console_loglevel [ 228.052861] livepatch: 'test_klp_state2': starting patching transition [ 229.071292] livepatch: 'test_klp_state2': completing patching transition [ 229.071407] test_klp_state2: post_patch_callback: vmlinux [ 229.071409] test_klp_state2: fix_console_loglevel: fixing console_loglevel [ 229.071410] livepatch: 'test_klp_state2': patching complete [ 229.174501] % modprobe test_klp_state3 [ 229.175964] livepatch: enabling patch 'test_klp_state3' [ 229.175966] livepatch: 'test_klp_state3': initializing patching transition [ 229.175984] test_klp_state3: pre_patch_callback: vmlinux [ 229.175985] test_klp_state3: allocate_loglevel_state: space to store console_loglevel already allocated [ 229.175986] livepatch: 'test_klp_state3': starting patching transition [ 230.031287] livepatch: 'test_klp_state3': completing patching transition [ 230.031407] test_klp_state3: post_patch_callback: vmlinux [ 230.031409] test_klp_state3: fix_console_loglevel: taking over the console_loglevel change [ 230.031410] livepatch: 'test_klp_state3': patching complete [ 230.092633] % rmmod test_klp_state2 [ 230.174017] % modprobe test_klp_state2 [ 230.175415] livepatch: enabling patch 'test_klp_state2' [ 230.175416] livepatch: 'test_klp_state2': initializing patching transition [ 230.175437] test_klp_state2: pre_patch_callback: vmlinux [ 230.175438] test_klp_state2: allocate_loglevel_state: space to store console_loglevel already allocated [ 230.175453] livepatch: 'test_klp_state2': starting patching transition [ 231.871289] livepatch: 'test_klp_state2': completing patching transition [ 231.871392] test_klp_state2: post_patch_callback: vmlinux [ 231.871393] test_klp_state2: fix_console_loglevel: taking over the console_loglevel change [ 231.871394] livepatch: 'test_klp_state2': patching complete [ 231.902873] % echo 0 > /sys/kernel/livepatch/test_klp_state2/enabled [ 231.902893] livepatch: 'test_klp_state2': initializing unpatching transition [ 231.902909] test_klp_state2: pre_unpatch_callback: vmlinux [ 231.902910] test_klp_state2: restore_console_loglevel: restoring console_loglevel [ 231.902911] livepatch: 'test_klp_state2': starting unpatching transition [ 232.831270] livepatch: 'test_klp_state2': completing unpatching transition [ 232.831371] test_klp_state2: post_unpatch_callback: vmlinux [ 232.831373] test_klp_state2: free_loglevel_state: freeing space for the stored console_loglevel [ 232.831374] livepatch: 'test_klp_state2': unpatching complete [ 232.912312] % rmmod test_klp_state2 [ 232.961704] % rmmod test_klp_state3 [ 233.039460] ===== TEST: incompatible cumulative livepatches ===== [ 233.042189] % modprobe test_klp_state2 [ 233.043520] livepatch: enabling patch 'test_klp_state2' [ 233.043522] livepatch: 'test_klp_state2': initializing patching transition [ 233.043542] test_klp_state2: pre_patch_callback: vmlinux [ 233.043543] test_klp_state2: allocate_loglevel_state: allocating space to store console_loglevel [ 233.043545] livepatch: 'test_klp_state2': starting patching transition [ 234.191241] livepatch: 'test_klp_state2': completing patching transition [ 234.191348] test_klp_state2: post_patch_callback: vmlinux [ 234.191365] test_klp_state2: fix_console_loglevel: fixing console_loglevel [ 234.191368] livepatch: 'test_klp_state2': patching complete [ 234.263631] % modprobe test_klp_state [ 234.265068] livepatch: Livepatch patch (test_klp_state) is not compatible with the already installed livepatches. [ 234.380932] modprobe: ERROR: could not insert 'test_klp_state': Invalid argument [ 234.380979] % echo 0 > /sys/kernel/livepatch/test_klp_state2/enabled [ 234.380997] livepatch: 'test_klp_state2': initializing unpatching transition [ 234.381018] test_klp_state2: pre_unpatch_callback: vmlinux [ 234.381019] test_klp_state2: restore_console_loglevel: restoring console_loglevel [ 234.381020] livepatch: 'test_klp_state2': starting unpatching transition [ 235.951273] livepatch: 'test_klp_state2': completing unpatching transition [ 235.951373] test_klp_state2: post_unpatch_callback: vmlinux [ 235.951375] test_klp_state2: free_loglevel_state: freeing space for the stored console_loglevel [ 235.951376] livepatch: 'test_klp_state2': unpatching complete [ 235.994953] % rmmod test_klp_state2 [ 236.093180] livepatch: kernel.ftrace_enabled = 1 [ 236.101310] ===== TEST: livepatch interaction with ftrace_enabled sysctl ===== [ 236.102950] livepatch: kernel.ftrace_enabled = 0 [ 236.103030] % modprobe test_klp_livepatch [ 236.104411] livepatch: enabling patch 'test_klp_livepatch' [ 236.104414] livepatch: 'test_klp_livepatch': initializing patching transition [ 236.104437] livepatch: failed to register ftrace handler for function 'cmdline_proc_show' (-16) [ 236.104439] livepatch: failed to patch object 'vmlinux' [ 236.104440] livepatch: failed to enable patch 'test_klp_livepatch' [ 236.104441] livepatch: 'test_klp_livepatch': canceling patching transition, going to unpatch [ 236.104442] livepatch: 'test_klp_livepatch': completing unpatching transition [ 236.104560] livepatch: 'test_klp_livepatch': unpatching complete [ 236.260929] modprobe: ERROR: could not insert 'test_klp_livepatch': Device or resource busy [ 236.262507] livepatch: kernel.ftrace_enabled = 1 [ 236.265215] % modprobe test_klp_livepatch [ 236.266486] livepatch: enabling patch 'test_klp_livepatch' [ 236.266488] livepatch: 'test_klp_livepatch': initializing patching transition [ 236.267596] livepatch: 'test_klp_livepatch': starting patching transition [ 237.791212] livepatch: 'test_klp_livepatch': completing patching transition [ 237.791310] livepatch: 'test_klp_livepatch': patching complete [ 237.797154] livepatch: sysctl: setting key "kernel.ftrace_enabled": Device or resource busy [ 237.798043] % echo 0 > /sys/kernel/livepatch/test_klp_livepatch/enabled [ 237.798095] livepatch: 'test_klp_livepatch': initializing unpatching transition [ 237.798109] livepatch: 'test_klp_livepatch': starting unpatching transition [ 238.831322] livepatch: 'test_klp_livepatch': completing unpatching transition [ 238.832826] livepatch: 'test_klp_livepatch': unpatching complete [ 238.908640] % rmmod test_klp_livepatch [ 238.992263] livepatch: kernel.ftrace_enabled = 1 [ 238.999933] ===== TEST: sysfs test ===== [ 239.002807] % modprobe test_klp_livepatch [ 239.004110] livepatch: enabling patch 'test_klp_livepatch' [ 239.004111] livepatch: 'test_klp_livepatch': initializing patching transition [ 239.005181] livepatch: 'test_klp_livepatch': starting patching transition [ 240.111262] livepatch: 'test_klp_livepatch': completing patching transition [ 240.111381] livepatch: 'test_klp_livepatch': patching complete [ 240.132783] % echo 0 > /sys/kernel/livepatch/test_klp_livepatch/enabled [ 240.132799] livepatch: 'test_klp_livepatch': initializing unpatching transition [ 240.132815] livepatch: 'test_klp_livepatch': starting unpatching transition [ 241.081328] livepatch: 'test_klp_livepatch': completing unpatching transition [ 241.082831] livepatch: 'test_klp_livepatch': unpatching complete [ 241.142598] % rmmod test_klp_livepatch [ 241.210158] ===== TEST: sysfs test object/patched ===== [ 241.213283] % modprobe test_klp_callbacks_demo [ 241.214762] livepatch: enabling patch 'test_klp_callbacks_demo' [ 241.214764] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 241.214784] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 241.214785] livepatch: 'test_klp_callbacks_demo': starting patching transition [ 242.031320] livepatch: 'test_klp_callbacks_demo': completing patching transition [ 242.031449] test_klp_callbacks_demo: post_patch_callback: vmlinux [ 242.031451] livepatch: 'test_klp_callbacks_demo': patching complete [ 242.136182] % modprobe test_klp_callbacks_mod [ 242.137515] livepatch: applying patch 'test_klp_callbacks_demo' to loading module 'test_klp_callbacks_mod' [ 242.137517] test_klp_callbacks_demo: pre_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_COMING] Full formed, running module_init [ 242.137519] test_klp_callbacks_demo: post_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_COMING] Full formed, running module_init [ 242.137535] test_klp_callbacks_mod: test_klp_callbacks_mod_init [ 242.139783] % rmmod test_klp_callbacks_mod [ 242.140942] test_klp_callbacks_mod: test_klp_callbacks_mod_exit [ 242.140957] test_klp_callbacks_demo: pre_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_GOING] Going away [ 242.140959] livepatch: reverting patch 'test_klp_callbacks_demo' on unloading module 'test_klp_callbacks_mod' [ 242.140960] test_klp_callbacks_demo: post_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_GOING] Going away [ 242.231991] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled [ 242.232011] livepatch: 'test_klp_callbacks_demo': initializing unpatching transition [ 242.232030] test_klp_callbacks_demo: pre_unpatch_callback: vmlinux [ 242.232032] livepatch: 'test_klp_callbacks_demo': starting unpatching transition [ 243.071322] livepatch: 'test_klp_callbacks_demo': completing unpatching transition [ 243.071422] test_klp_callbacks_demo: post_unpatch_callback: vmlinux [ 243.071424] livepatch: 'test_klp_callbacks_demo': unpatching complete [ 243.141124] % rmmod test_klp_callbacks_demo [ 243.282256] livepatch: kernel.ftrace_enabled = 1 [ 243.290569] ===== TEST: basic function patching ===== [ 243.293596] % modprobe test_klp_livepatch [ 243.295013] livepatch: enabling patch 'test_klp_livepatch' [ 243.295016] livepatch: 'test_klp_livepatch': initializing patching transition [ 243.296162] livepatch: 'test_klp_livepatch': starting patching transition [ 244.911383] livepatch: 'test_klp_livepatch': completing patching transition [ 244.911489] livepatch: 'test_klp_livepatch': patching complete [ 244.924091] % echo 0 > /sys/kernel/livepatch/test_klp_livepatch/enabled [ 244.924112] livepatch: 'test_klp_livepatch': initializing unpatching transition [ 244.924134] livepatch: 'test_klp_livepatch': starting unpatching transition [ 245.871319] livepatch: 'test_klp_livepatch': completing unpatching transition [ 245.872799] livepatch: 'test_klp_livepatch': unpatching complete [ 245.934000] % rmmod test_klp_livepatch [ 246.029530] ===== TEST: multiple livepatches ===== [ 246.032436] % modprobe test_klp_livepatch [ 246.033861] livepatch: enabling patch 'test_klp_livepatch' [ 246.033863] livepatch: 'test_klp_livepatch': initializing patching transition [ 246.034968] livepatch: 'test_klp_livepatch': starting patching transition [ 247.711339] livepatch: 'test_klp_livepatch': completing patching transition [ 247.711489] livepatch: 'test_klp_livepatch': patching complete [ 247.763427] test_klp_livepatch: this has been live patched [ 247.767396] % modprobe test_klp_atomic_replace replace=0 [ 247.768853] livepatch: enabling patch 'test_klp_atomic_replace' [ 247.768854] livepatch: 'test_klp_atomic_replace': initializing patching transition [ 247.769960] livepatch: 'test_klp_atomic_replace': starting patching transition [ 248.751335] livepatch: 'test_klp_atomic_replace': completing patching transition [ 248.751471] livepatch: 'test_klp_atomic_replace': patching complete [ 248.788134] test_klp_livepatch: this has been live patched [ 248.789014] test_klp_atomic_replace: this has been live patched [ 248.789161] % echo 0 > /sys/kernel/livepatch/test_klp_atomic_replace/enabled [ 248.789181] livepatch: 'test_klp_atomic_replace': initializing unpatching transition [ 248.789197] livepatch: 'test_klp_atomic_replace': starting unpatching transition [ 249.711272] livepatch: 'test_klp_atomic_replace': completing unpatching transition [ 249.712588] livepatch: 'test_klp_atomic_replace': unpatching complete [ 249.798070] % rmmod test_klp_atomic_replace [ 249.851728] test_klp_livepatch: this has been live patched [ 249.852707] % echo 0 > /sys/kernel/livepatch/test_klp_livepatch/enabled [ 249.852727] livepatch: 'test_klp_livepatch': initializing unpatching transition [ 249.852745] livepatch: 'test_klp_livepatch': starting unpatching transition [ 250.751345] livepatch: 'test_klp_livepatch': completing unpatching transition [ 250.752836] livepatch: 'test_klp_livepatch': unpatching complete [ 250.761513] % rmmod test_klp_livepatch [ 250.851360] ===== TEST: atomic replace livepatch ===== [ 250.854431] % modprobe test_klp_livepatch [ 250.855791] livepatch: enabling patch 'test_klp_livepatch' [ 250.855793] livepatch: 'test_klp_livepatch': initializing patching transition [ 250.856996] livepatch: 'test_klp_livepatch': starting patching transition [ 251.711343] livepatch: 'test_klp_livepatch': completing patching transition [ 251.711461] livepatch: 'test_klp_livepatch': patching complete [ 251.773219] test_klp_livepatch: this has been live patched [ 251.777357] % modprobe test_klp_atomic_replace replace=1 [ 251.778873] livepatch: enabling patch 'test_klp_atomic_replace' [ 251.778875] livepatch: 'test_klp_atomic_replace': initializing patching transition [ 251.780049] livepatch: 'test_klp_atomic_replace': starting patching transition [ 252.911301] livepatch: 'test_klp_atomic_replace': completing patching transition [ 252.912669] livepatch: 'test_klp_atomic_replace': patching complete [ 253.001881] test_klp_atomic_replace: this has been live patched [ 253.002864] % rmmod test_klp_livepatch [ 253.052447] test_klp_atomic_replace: this has been live patched [ 253.052561] % echo 0 > /sys/kernel/livepatch/test_klp_atomic_replace/enabled [ 253.052580] livepatch: 'test_klp_atomic_replace': initializing unpatching transition [ 253.052597] livepatch: 'test_klp_atomic_replace': starting unpatching transition [ 253.871341] livepatch: 'test_klp_atomic_replace': completing unpatching transition [ 253.872934] livepatch: 'test_klp_atomic_replace': unpatching complete [ 253.961071] % rmmod test_klp_atomic_replace [ 254.075347] livepatch: kernel.ftrace_enabled = 1 [ 254.083375] ===== TEST: target module before livepatch ===== [ 254.086470] % modprobe test_klp_callbacks_mod [ 254.087750] test_klp_callbacks_mod: test_klp_callbacks_mod_init [ 254.091112] % modprobe test_klp_callbacks_demo [ 254.092572] livepatch: enabling patch 'test_klp_callbacks_demo' [ 254.092574] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 254.092593] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 254.092594] test_klp_callbacks_demo: pre_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state [ 254.092595] livepatch: 'test_klp_callbacks_demo': starting patching transition [ 254.911372] livepatch: 'test_klp_callbacks_demo': completing patching transition [ 254.911470] test_klp_callbacks_demo: post_patch_callback: vmlinux [ 254.911472] test_klp_callbacks_demo: post_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state [ 254.911474] livepatch: 'test_klp_callbacks_demo': patching complete [ 255.008950] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled [ 255.008969] livepatch: 'test_klp_callbacks_demo': initializing unpatching transition [ 255.009000] test_klp_callbacks_demo: pre_unpatch_callback: vmlinux [ 255.009002] test_klp_callbacks_demo: pre_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state [ 255.009020] livepatch: 'test_klp_callbacks_demo': starting unpatching transition [ 255.951355] livepatch: 'test_klp_callbacks_demo': completing unpatching transition [ 255.951452] test_klp_callbacks_demo: post_unpatch_callback: vmlinux [ 255.951454] test_klp_callbacks_demo: post_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state [ 255.951456] livepatch: 'test_klp_callbacks_demo': unpatching complete [ 256.018607] % rmmod test_klp_callbacks_demo [ 256.091916] % rmmod test_klp_callbacks_mod [ 256.093014] test_klp_callbacks_mod: test_klp_callbacks_mod_exit [ 256.169237] ===== TEST: module_coming notifier ===== [ 256.172297] % modprobe test_klp_callbacks_demo [ 256.173751] livepatch: enabling patch 'test_klp_callbacks_demo' [ 256.173753] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 256.173772] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 256.173774] livepatch: 'test_klp_callbacks_demo': starting patching transition [ 257.871420] livepatch: 'test_klp_callbacks_demo': completing patching transition [ 257.871550] test_klp_callbacks_demo: post_patch_callback: vmlinux [ 257.871552] livepatch: 'test_klp_callbacks_demo': patching complete [ 257.906694] % modprobe test_klp_callbacks_mod [ 257.907956] livepatch: applying patch 'test_klp_callbacks_demo' to loading module 'test_klp_callbacks_mod' [ 257.907958] test_klp_callbacks_demo: pre_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_COMING] Full formed, running module_init [ 257.907959] test_klp_callbacks_demo: post_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_COMING] Full formed, running module_init [ 257.907977] test_klp_callbacks_mod: test_klp_callbacks_mod_init [ 257.908350] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled [ 257.908367] livepatch: 'test_klp_callbacks_demo': initializing unpatching transition [ 257.908387] test_klp_callbacks_demo: pre_unpatch_callback: vmlinux [ 257.908388] test_klp_callbacks_demo: pre_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state [ 257.908390] livepatch: 'test_klp_callbacks_demo': starting unpatching transition [ 258.911396] livepatch: 'test_klp_callbacks_demo': completing unpatching transition [ 258.911552] test_klp_callbacks_demo: post_unpatch_callback: vmlinux [ 258.911554] test_klp_callbacks_demo: post_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state [ 258.911556] livepatch: 'test_klp_callbacks_demo': unpatching complete [ 258.918270] % rmmod test_klp_callbacks_demo [ 259.001970] % rmmod test_klp_callbacks_mod [ 259.002953] test_klp_callbacks_mod: test_klp_callbacks_mod_exit [ 259.118512] ===== TEST: module_going notifier ===== [ 259.121469] % modprobe test_klp_callbacks_mod [ 259.122753] test_klp_callbacks_mod: test_klp_callbacks_mod_init [ 259.125852] % modprobe test_klp_callbacks_demo [ 259.127258] livepatch: enabling patch 'test_klp_callbacks_demo' [ 259.127259] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 259.127280] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 259.127281] test_klp_callbacks_demo: pre_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state [ 259.127282] livepatch: 'test_klp_callbacks_demo': starting patching transition [ 260.191345] livepatch: 'test_klp_callbacks_demo': completing patching transition [ 260.191448] test_klp_callbacks_demo: post_patch_callback: vmlinux [ 260.191449] test_klp_callbacks_demo: post_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state [ 260.191451] livepatch: 'test_klp_callbacks_demo': patching complete [ 260.248083] % rmmod test_klp_callbacks_mod [ 260.249312] test_klp_callbacks_mod: test_klp_callbacks_mod_exit [ 260.249330] test_klp_callbacks_demo: pre_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_GOING] Going away [ 260.249332] livepatch: reverting patch 'test_klp_callbacks_demo' on unloading module 'test_klp_callbacks_mod' [ 260.249333] test_klp_callbacks_demo: post_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_GOING] Going away [ 260.311104] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled [ 260.311123] livepatch: 'test_klp_callbacks_demo': initializing unpatching transition [ 260.311150] test_klp_callbacks_demo: pre_unpatch_callback: vmlinux [ 260.311151] livepatch: 'test_klp_callbacks_demo': starting unpatching transition [ 261.151436] livepatch: 'test_klp_callbacks_demo': completing unpatching transition [ 261.151581] test_klp_callbacks_demo: post_unpatch_callback: vmlinux [ 261.151583] livepatch: 'test_klp_callbacks_demo': unpatching complete [ 261.220008] % rmmod test_klp_callbacks_demo [ 261.309304] ===== TEST: module_coming and module_going notifiers ===== [ 261.312251] % modprobe test_klp_callbacks_demo [ 261.313722] livepatch: enabling patch 'test_klp_callbacks_demo' [ 261.313724] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 261.313762] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 261.313763] livepatch: 'test_klp_callbacks_demo': starting patching transition [ 262.671500] livepatch: 'test_klp_callbacks_demo': completing patching transition [ 262.671624] test_klp_callbacks_demo: post_patch_callback: vmlinux [ 262.671626] livepatch: 'test_klp_callbacks_demo': patching complete [ 262.742090] % modprobe test_klp_callbacks_mod [ 262.743321] livepatch: applying patch 'test_klp_callbacks_demo' to loading module 'test_klp_callbacks_mod' [ 262.743324] test_klp_callbacks_demo: pre_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_COMING] Full formed, running module_init [ 262.743326] test_klp_callbacks_demo: post_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_COMING] Full formed, running module_init [ 262.743344] test_klp_callbacks_mod: test_klp_callbacks_mod_init [ 262.744479] % rmmod test_klp_callbacks_mod [ 262.745567] test_klp_callbacks_mod: test_klp_callbacks_mod_exit [ 262.745582] test_klp_callbacks_demo: pre_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_GOING] Going away [ 262.745584] livepatch: reverting patch 'test_klp_callbacks_demo' on unloading module 'test_klp_callbacks_mod' [ 262.745585] test_klp_callbacks_demo: post_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_GOING] Going away [ 262.811091] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled [ 262.811109] livepatch: 'test_klp_callbacks_demo': initializing unpatching transition [ 262.811130] test_klp_callbacks_demo: pre_unpatch_callback: vmlinux [ 262.811131] livepatch: 'test_klp_callbacks_demo': starting unpatching transition [ 263.951430] livepatch: 'test_klp_callbacks_demo': completing unpatching transition [ 263.951537] test_klp_callbacks_demo: post_unpatch_callback: vmlinux [ 263.951539] livepatch: 'test_klp_callbacks_demo': unpatching complete [ 264.022343] % rmmod test_klp_callbacks_demo [ 264.179776] ===== TEST: target module not present ===== [ 264.182883] % modprobe test_klp_callbacks_demo [ 264.184345] livepatch: enabling patch 'test_klp_callbacks_demo' [ 264.184347] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 264.184367] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 264.184368] livepatch: 'test_klp_callbacks_demo': starting patching transition [ 265.081369] livepatch: 'test_klp_callbacks_demo': completing patching transition [ 265.081514] test_klp_callbacks_demo: post_patch_callback: vmlinux [ 265.081516] livepatch: 'test_klp_callbacks_demo': patching complete [ 265.101043] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled [ 265.101062] livepatch: 'test_klp_callbacks_demo': initializing unpatching transition [ 265.101083] test_klp_callbacks_demo: pre_unpatch_callback: vmlinux [ 265.101084] livepatch: 'test_klp_callbacks_demo': starting unpatching transition [ 266.191411] livepatch: 'test_klp_callbacks_demo': completing unpatching transition [ 266.191510] test_klp_callbacks_demo: post_unpatch_callback: vmlinux [ 266.191512] livepatch: 'test_klp_callbacks_demo': unpatching complete [ 266.211817] % rmmod test_klp_callbacks_demo [ 266.279575] ===== TEST: pre-patch callback -ENODEV ===== [ 266.282491] % modprobe test_klp_callbacks_mod [ 266.283760] test_klp_callbacks_mod: test_klp_callbacks_mod_init [ 266.284111] % modprobe test_klp_callbacks_demo pre_patch_ret=-19 [ 266.285525] livepatch: enabling patch 'test_klp_callbacks_demo' [ 266.285527] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 266.285548] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 266.285549] livepatch: pre-patch callback failed for object 'vmlinux' [ 266.285550] livepatch: failed to enable patch 'test_klp_callbacks_demo' [ 266.285551] livepatch: 'test_klp_callbacks_demo': canceling patching transition, going to unpatch [ 266.285552] livepatch: 'test_klp_callbacks_demo': completing unpatching transition [ 266.285659] livepatch: 'test_klp_callbacks_demo': unpatching complete [ 266.481071] modprobe: ERROR: could not insert 'test_klp_callbacks_demo': No such device [ 266.482054] % rmmod test_klp_callbacks_mod [ 266.483170] test_klp_callbacks_mod: test_klp_callbacks_mod_exit [ 266.569358] ===== TEST: module_coming + pre-patch callback -ENODEV ===== [ 266.572523] % modprobe test_klp_callbacks_demo [ 266.573921] livepatch: enabling patch 'test_klp_callbacks_demo' [ 266.573924] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 266.573963] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 266.573965] livepatch: 'test_klp_callbacks_demo': starting patching transition [ 268.031434] livepatch: 'test_klp_callbacks_demo': completing patching transition [ 268.031535] test_klp_callbacks_demo: post_patch_callback: vmlinux [ 268.031537] livepatch: 'test_klp_callbacks_demo': patching complete [ 268.100668] % echo -19 > /sys/module/test_klp_callbacks_demo/parameters/pre_patch_ret [ 268.101662] % modprobe test_klp_callbacks_mod [ 268.102985] livepatch: applying patch 'test_klp_callbacks_demo' to loading module 'test_klp_callbacks_mod' [ 268.102988] test_klp_callbacks_demo: pre_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_COMING] Full formed, running module_init [ 268.102990] livepatch: pre-patch callback failed for object 'test_klp_callbacks_mod' [ 268.102991] livepatch: patch 'test_klp_callbacks_demo' failed for module 'test_klp_callbacks_mod', refusing to load module 'test_klp_callbacks_mod' [ 268.231087] modprobe: ERROR: could not insert 'test_klp_callbacks_mod': No such device [ 268.231141] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled [ 268.231156] livepatch: 'test_klp_callbacks_demo': initializing unpatching transition [ 268.231176] test_klp_callbacks_demo: pre_unpatch_callback: vmlinux [ 268.231177] livepatch: 'test_klp_callbacks_demo': starting unpatching transition [ 269.951417] livepatch: 'test_klp_callbacks_demo': completing unpatching transition [ 269.951520] test_klp_callbacks_demo: post_unpatch_callback: vmlinux [ 269.951522] livepatch: 'test_klp_callbacks_demo': unpatching complete [ 270.048128] % rmmod test_klp_callbacks_demo [ 270.110260] ===== TEST: multiple target modules ===== [ 270.113377] % modprobe test_klp_callbacks_busy block_transition=N [ 270.114847] test_klp_callbacks_busy: test_klp_callbacks_busy_init [ 270.114851] test_klp_callbacks_busy: busymod_work_func enter [ 270.114853] test_klp_callbacks_busy: busymod_work_func exit [ 270.118456] % modprobe test_klp_callbacks_demo [ 270.119920] livepatch: enabling patch 'test_klp_callbacks_demo' [ 270.119922] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 270.119941] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 270.119943] test_klp_callbacks_demo: pre_patch_callback: test_klp_callbacks_busy -> [MODULE_STATE_LIVE] Normal state [ 270.121350] livepatch: 'test_klp_callbacks_demo': starting patching transition [ 271.871484] livepatch: 'test_klp_callbacks_demo': completing patching transition [ 271.871585] test_klp_callbacks_demo: post_patch_callback: vmlinux [ 271.871587] test_klp_callbacks_demo: post_patch_callback: test_klp_callbacks_busy -> [MODULE_STATE_LIVE] Normal state [ 271.871589] livepatch: 'test_klp_callbacks_demo': patching complete [ 271.957226] % modprobe test_klp_callbacks_mod [ 271.958646] livepatch: applying patch 'test_klp_callbacks_demo' to loading module 'test_klp_callbacks_mod' [ 271.958665] test_klp_callbacks_demo: pre_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_COMING] Full formed, running module_init [ 271.958667] test_klp_callbacks_demo: post_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_COMING] Full formed, running module_init [ 271.958683] test_klp_callbacks_mod: test_klp_callbacks_mod_init [ 271.960010] % rmmod test_klp_callbacks_mod [ 271.961127] test_klp_callbacks_mod: test_klp_callbacks_mod_exit [ 271.961141] test_klp_callbacks_demo: pre_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_GOING] Going away [ 271.961143] livepatch: reverting patch 'test_klp_callbacks_demo' on unloading module 'test_klp_callbacks_mod' [ 271.961145] test_klp_callbacks_demo: post_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_GOING] Going away [ 272.031267] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled [ 272.031285] livepatch: 'test_klp_callbacks_demo': initializing unpatching transition [ 272.031303] test_klp_callbacks_demo: pre_unpatch_callback: vmlinux [ 272.031304] test_klp_callbacks_demo: pre_unpatch_callback: test_klp_callbacks_busy -> [MODULE_STATE_LIVE] Normal state [ 272.031306] livepatch: 'test_klp_callbacks_demo': starting unpatching transition [ 272.831467] livepatch: 'test_klp_callbacks_demo': completing unpatching transition [ 272.833230] test_klp_callbacks_demo: post_unpatch_callback: vmlinux [ 272.833232] test_klp_callbacks_demo: post_unpatch_callback: test_klp_callbacks_busy -> [MODULE_STATE_LIVE] Normal state [ 272.833233] livepatch: 'test_klp_callbacks_demo': unpatching complete [ 272.839688] % rmmod test_klp_callbacks_demo [ 272.912113] % rmmod test_klp_callbacks_busy [ 272.913268] test_klp_callbacks_busy: test_klp_callbacks_busy_exit [ 272.989731] ===== TEST: busy target module ===== [ 272.992863] % modprobe test_klp_callbacks_busy block_transition=Y [ 272.994427] test_klp_callbacks_busy: test_klp_callbacks_busy_init [ 272.994433] test_klp_callbacks_busy: busymod_work_func enter [ 272.997897] % modprobe test_klp_callbacks_demo [ 272.999390] livepatch: enabling patch 'test_klp_callbacks_demo' [ 272.999391] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 272.999413] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 272.999415] test_klp_callbacks_demo: pre_patch_callback: test_klp_callbacks_busy -> [MODULE_STATE_LIVE] Normal state [ 273.000863] livepatch: 'test_klp_callbacks_demo': starting patching transition [ 273.006166] % modprobe test_klp_callbacks_mod [ 273.007622] livepatch: applying patch 'test_klp_callbacks_demo' to loading module 'test_klp_callbacks_mod' [ 273.007624] test_klp_callbacks_demo: pre_patch_callback: test_klp_callbacks_mod -> [MODULE_STATE_COMING] Full formed, running module_init [ 273.007651] test_klp_callbacks_mod: test_klp_callbacks_mod_init [ 273.009014] % rmmod test_klp_callbacks_mod [ 273.010123] test_klp_callbacks_mod: test_klp_callbacks_mod_exit [ 273.010139] livepatch: reverting patch 'test_klp_callbacks_demo' on unloading module 'test_klp_callbacks_mod' [ 273.010141] test_klp_callbacks_demo: post_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_GOING] Going away [ 273.091251] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled [ 273.091269] livepatch: 'test_klp_callbacks_demo': reversing transition from patching to unpatching [ 273.091425] livepatch: 'test_klp_callbacks_demo': starting unpatching transition [ 275.791451] livepatch: 'test_klp_callbacks_demo': completing unpatching transition [ 275.793206] test_klp_callbacks_demo: post_unpatch_callback: vmlinux [ 275.793209] test_klp_callbacks_demo: post_unpatch_callback: test_klp_callbacks_busy -> [MODULE_STATE_LIVE] Normal state [ 275.793210] livepatch: 'test_klp_callbacks_demo': unpatching complete [ 275.815309] % rmmod test_klp_callbacks_demo [ 275.882051] % rmmod test_klp_callbacks_busy [ 275.890764] test_klp_callbacks_busy: busymod_work_func exit [ 275.890773] test_klp_callbacks_busy: test_klp_callbacks_busy_exit [ 275.959816] ===== TEST: multiple livepatches ===== [ 275.963029] % modprobe test_klp_callbacks_demo [ 275.964604] livepatch: enabling patch 'test_klp_callbacks_demo' [ 275.964606] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 275.964628] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 275.964629] livepatch: 'test_klp_callbacks_demo': starting patching transition [ 277.641504] livepatch: 'test_klp_callbacks_demo': completing patching transition [ 277.641611] test_klp_callbacks_demo: post_patch_callback: vmlinux [ 277.641613] livepatch: 'test_klp_callbacks_demo': patching complete [ 277.698468] % modprobe test_klp_callbacks_demo2 [ 277.700098] livepatch: enabling patch 'test_klp_callbacks_demo2' [ 277.700100] livepatch: 'test_klp_callbacks_demo2': initializing patching transition [ 277.700119] test_klp_callbacks_demo2: pre_patch_callback: vmlinux [ 277.700120] livepatch: 'test_klp_callbacks_demo2': starting patching transition [ 278.681475] livepatch: 'test_klp_callbacks_demo2': completing patching transition [ 278.681615] test_klp_callbacks_demo2: post_patch_callback: vmlinux [ 278.681617] livepatch: 'test_klp_callbacks_demo2': patching complete [ 278.719462] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo2/enabled [ 278.719482] livepatch: 'test_klp_callbacks_demo2': initializing unpatching transition [ 278.719504] test_klp_callbacks_demo2: pre_unpatch_callback: vmlinux [ 278.719505] livepatch: 'test_klp_callbacks_demo2': starting unpatching transition [ 279.791389] livepatch: 'test_klp_callbacks_demo2': completing unpatching transition [ 279.791487] test_klp_callbacks_demo2: post_unpatch_callback: vmlinux [ 279.791489] livepatch: 'test_klp_callbacks_demo2': unpatching complete [ 279.829592] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled [ 279.829612] livepatch: 'test_klp_callbacks_demo': initializing unpatching transition [ 279.829629] test_klp_callbacks_demo: pre_unpatch_callback: vmlinux [ 279.829630] livepatch: 'test_klp_callbacks_demo': starting unpatching transition [ 280.831497] livepatch: 'test_klp_callbacks_demo': completing unpatching transition [ 280.831602] test_klp_callbacks_demo: post_unpatch_callback: vmlinux [ 280.831604] livepatch: 'test_klp_callbacks_demo': unpatching complete [ 280.839540] % rmmod test_klp_callbacks_demo2 [ 280.912127] % rmmod test_klp_callbacks_demo [ 280.989065] ===== TEST: atomic replace ===== [ 280.991951] % modprobe test_klp_callbacks_demo [ 280.993414] livepatch: enabling patch 'test_klp_callbacks_demo' [ 280.993416] livepatch: 'test_klp_callbacks_demo': initializing patching transition [ 280.993436] test_klp_callbacks_demo: pre_patch_callback: vmlinux [ 280.993437] livepatch: 'test_klp_callbacks_demo': starting patching transition [ 281.871479] livepatch: 'test_klp_callbacks_demo': completing patching transition [ 281.871579] test_klp_callbacks_demo: post_patch_callback: vmlinux [ 281.871581] livepatch: 'test_klp_callbacks_demo': patching complete [ 281.912919] % modprobe test_klp_callbacks_demo2 replace=1 [ 281.914353] livepatch: enabling patch 'test_klp_callbacks_demo2' [ 281.914356] livepatch: 'test_klp_callbacks_demo2': initializing patching transition [ 281.914376] test_klp_callbacks_demo2: pre_patch_callback: vmlinux [ 281.914377] livepatch: 'test_klp_callbacks_demo2': starting patching transition [ 283.071478] livepatch: 'test_klp_callbacks_demo2': completing patching transition [ 283.071583] test_klp_callbacks_demo2: post_patch_callback: vmlinux [ 283.071585] livepatch: 'test_klp_callbacks_demo2': patching complete [ 283.135341] % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo2/enabled [ 283.135361] livepatch: 'test_klp_callbacks_demo2': initializing unpatching transition [ 283.135381] test_klp_callbacks_demo2: pre_unpatch_callback: vmlinux [ 283.135382] livepatch: 'test_klp_callbacks_demo2': starting unpatching transition [ 284.031462] livepatch: 'test_klp_callbacks_demo2': completing unpatching transition [ 284.031579] test_klp_callbacks_demo2: post_unpatch_callback: vmlinux [ 284.031580] livepatch: 'test_klp_callbacks_demo2': unpatching complete [ 284.044328] % rmmod test_klp_callbacks_demo2 [ 284.112113] % rmmod test_klp_callbacks_demo [ 284.224335] livepatch: kernel.ftrace_enabled = 1