~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/livepatch/test-syscall.sh

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /tools/testing/selftests/livepatch/test-syscall.sh (Architecture sparc64) and /tools/testing/selftests/livepatch/test-syscall.sh (Architecture mips)


  1 #!/bin/bash                                         1 #!/bin/bash
  2 # SPDX-License-Identifier: GPL-2.0                  2 # SPDX-License-Identifier: GPL-2.0
  3 # Copyright (C) 2023 SUSE                           3 # Copyright (C) 2023 SUSE
  4 # Author: Marcos Paulo de Souza <mpdesouza@suse      4 # Author: Marcos Paulo de Souza <mpdesouza@suse.com>
  5                                                     5 
  6 . $(dirname $0)/functions.sh                        6 . $(dirname $0)/functions.sh
  7                                                     7 
  8 MOD_SYSCALL=test_klp_syscall                        8 MOD_SYSCALL=test_klp_syscall
  9                                                     9 
 10 setup_config                                       10 setup_config
 11                                                    11 
 12 # - Start _NRPROC processes calling getpid and     12 # - Start _NRPROC processes calling getpid and load a livepatch to patch the
 13 #   getpid syscall. Check if all the processes     13 #   getpid syscall. Check if all the processes transitioned to the livepatched
 14 #   state.                                         14 #   state.
 15                                                    15 
 16 start_test "patch getpid syscall while being h     16 start_test "patch getpid syscall while being heavily hammered"
 17                                                    17 
 18 NPROC=$(getconf _NPROCESSORS_ONLN)                 18 NPROC=$(getconf _NPROCESSORS_ONLN)
 19 MAXPROC=128                                        19 MAXPROC=128
 20                                                    20 
 21 for i in $(seq 1 $(($NPROC < $MAXPROC ? $NPROC     21 for i in $(seq 1 $(($NPROC < $MAXPROC ? $NPROC : $MAXPROC))); do
 22         ./test_klp-call_getpid &                   22         ./test_klp-call_getpid &
 23         pids[$i]="$!"                              23         pids[$i]="$!"
 24 done                                               24 done
 25                                                    25 
 26 pid_list=$(echo ${pids[@]} | tr ' ' ',')           26 pid_list=$(echo ${pids[@]} | tr ' ' ',')
 27 load_lp $MOD_SYSCALL klp_pids=$pid_list            27 load_lp $MOD_SYSCALL klp_pids=$pid_list
 28                                                    28 
 29 # wait for all tasks to transition to patched      29 # wait for all tasks to transition to patched state
 30 loop_until 'grep -q '^0$' /sys/kernel/test_klp     30 loop_until 'grep -q '^0$' /sys/kernel/test_klp_syscall/npids'
 31                                                    31 
 32 pending_pids=$(cat /sys/kernel/test_klp_syscal     32 pending_pids=$(cat /sys/kernel/test_klp_syscall/npids)
 33 log "$MOD_SYSCALL: Remaining not livepatched p     33 log "$MOD_SYSCALL: Remaining not livepatched processes: $pending_pids"
 34                                                    34 
 35 for pid in ${pids[@]}; do                          35 for pid in ${pids[@]}; do
 36         kill $pid || true                          36         kill $pid || true
 37 done                                               37 done
 38                                                    38 
 39 disable_lp $MOD_SYSCALL                            39 disable_lp $MOD_SYSCALL
 40 unload_lp $MOD_SYSCALL                             40 unload_lp $MOD_SYSCALL
 41                                                    41 
 42 check_result "% insmod test_modules/$MOD_SYSCA     42 check_result "% insmod test_modules/$MOD_SYSCALL.ko klp_pids=$pid_list
 43 livepatch: enabling patch '$MOD_SYSCALL'           43 livepatch: enabling patch '$MOD_SYSCALL'
 44 livepatch: '$MOD_SYSCALL': initializing patchi     44 livepatch: '$MOD_SYSCALL': initializing patching transition
 45 livepatch: '$MOD_SYSCALL': starting patching t     45 livepatch: '$MOD_SYSCALL': starting patching transition
 46 livepatch: '$MOD_SYSCALL': completing patching     46 livepatch: '$MOD_SYSCALL': completing patching transition
 47 livepatch: '$MOD_SYSCALL': patching complete       47 livepatch: '$MOD_SYSCALL': patching complete
 48 $MOD_SYSCALL: Remaining not livepatched proces     48 $MOD_SYSCALL: Remaining not livepatched processes: 0
 49 % echo 0 > /sys/kernel/livepatch/$MOD_SYSCALL/     49 % echo 0 > /sys/kernel/livepatch/$MOD_SYSCALL/enabled
 50 livepatch: '$MOD_SYSCALL': initializing unpatc     50 livepatch: '$MOD_SYSCALL': initializing unpatching transition
 51 livepatch: '$MOD_SYSCALL': starting unpatching     51 livepatch: '$MOD_SYSCALL': starting unpatching transition
 52 livepatch: '$MOD_SYSCALL': completing unpatchi     52 livepatch: '$MOD_SYSCALL': completing unpatching transition
 53 livepatch: '$MOD_SYSCALL': unpatching complete     53 livepatch: '$MOD_SYSCALL': unpatching complete
 54 % rmmod $MOD_SYSCALL"                              54 % rmmod $MOD_SYSCALL"
 55                                                    55 
 56 exit 0                                             56 exit 0
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php