cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

notifier-error-inject.rst (3119B)


      1Notifier error injection
      2========================
      3
      4Notifier error injection provides the ability to inject artificial errors to
      5specified notifier chain callbacks. It is useful to test the error handling of
      6notifier call chain failures which is rarely executed.  There are kernel
      7modules that can be used to test the following notifiers.
      8
      9 * PM notifier
     10 * Memory hotplug notifier
     11 * powerpc pSeries reconfig notifier
     12 * Netdevice notifier
     13
     14PM notifier error injection module
     15----------------------------------
     16This feature is controlled through debugfs interface
     17
     18  /sys/kernel/debug/notifier-error-inject/pm/actions/<notifier event>/error
     19
     20Possible PM notifier events to be failed are:
     21
     22 * PM_HIBERNATION_PREPARE
     23 * PM_SUSPEND_PREPARE
     24 * PM_RESTORE_PREPARE
     25
     26Example: Inject PM suspend error (-12 = -ENOMEM)::
     27
     28	# cd /sys/kernel/debug/notifier-error-inject/pm/
     29	# echo -12 > actions/PM_SUSPEND_PREPARE/error
     30	# echo mem > /sys/power/state
     31	bash: echo: write error: Cannot allocate memory
     32
     33Memory hotplug notifier error injection module
     34----------------------------------------------
     35This feature is controlled through debugfs interface
     36
     37  /sys/kernel/debug/notifier-error-inject/memory/actions/<notifier event>/error
     38
     39Possible memory notifier events to be failed are:
     40
     41 * MEM_GOING_ONLINE
     42 * MEM_GOING_OFFLINE
     43
     44Example: Inject memory hotplug offline error (-12 == -ENOMEM)::
     45
     46	# cd /sys/kernel/debug/notifier-error-inject/memory
     47	# echo -12 > actions/MEM_GOING_OFFLINE/error
     48	# echo offline > /sys/devices/system/memory/memoryXXX/state
     49	bash: echo: write error: Cannot allocate memory
     50
     51powerpc pSeries reconfig notifier error injection module
     52--------------------------------------------------------
     53This feature is controlled through debugfs interface
     54
     55  /sys/kernel/debug/notifier-error-inject/pSeries-reconfig/actions/<notifier event>/error
     56
     57Possible pSeries reconfig notifier events to be failed are:
     58
     59 * PSERIES_RECONFIG_ADD
     60 * PSERIES_RECONFIG_REMOVE
     61 * PSERIES_DRCONF_MEM_ADD
     62 * PSERIES_DRCONF_MEM_REMOVE
     63
     64Netdevice notifier error injection module
     65----------------------------------------------
     66This feature is controlled through debugfs interface
     67
     68  /sys/kernel/debug/notifier-error-inject/netdev/actions/<notifier event>/error
     69
     70Netdevice notifier events which can be failed are:
     71
     72 * NETDEV_REGISTER
     73 * NETDEV_CHANGEMTU
     74 * NETDEV_CHANGENAME
     75 * NETDEV_PRE_UP
     76 * NETDEV_PRE_TYPE_CHANGE
     77 * NETDEV_POST_INIT
     78 * NETDEV_PRECHANGEMTU
     79 * NETDEV_PRECHANGEUPPER
     80 * NETDEV_CHANGEUPPER
     81
     82Example: Inject netdevice mtu change error (-22 == -EINVAL)::
     83
     84	# cd /sys/kernel/debug/notifier-error-inject/netdev
     85	# echo -22 > actions/NETDEV_CHANGEMTU/error
     86	# ip link set eth0 mtu 1024
     87	RTNETLINK answers: Invalid argument
     88
     89For more usage examples
     90-----------------------
     91There are tools/testing/selftests using the notifier error injection features
     92for CPU and memory notifiers.
     93
     94 * tools/testing/selftests/cpu-hotplug/on-off-test.sh
     95 * tools/testing/selftests/memory-hotplug/on-off-test.sh
     96
     97These scripts first do simple online and offline tests and then do fault
     98injection tests if notifier error injection module is available.