Cyril Hrubis | 1a1339d | 2014-02-12 19:25:10 +0100 | [diff] [blame] | 1 | --------------------------------- |
| 2 | Enable CODE COVERAGE for your Kernel: |
| 3 | --------------------------------- |
| 4 | 1) Apply kernel-gcov patch(s) against the corresponding Kernel. They are available here: |
| 5 | http://ltp.cvs.sourceforge.net/viewvc/ltp/utils/analysis/gcov-kernel/linux-2.*.*-gcov.patch?view=log, |
| 6 | 2) Also enable the following options in your .config file before building the kernel |
| 7 | CONFIG_GCOV_PROFILE=y |
| 8 | CONFIG_GCOV_ALL=y |
| 9 | CONFIG_GCOV_PROC=m |
| 10 | CONFIG_GCOV_HAMMER=y |
| 11 | |
| 12 | --------------------------------- |
| 13 | Enabling Kernel Configuration to test Containers/Namespaces |
| 14 | --------------------------------- |
| 15 | CONFIG_NAMESPACES=y |
| 16 | CONFIG_UTS_NS=y |
| 17 | CONFIG_IPC_NS=y |
| 18 | CONFIG_USER_NS=y |
| 19 | CONFIG_PID_NS=y |
| 20 | CONFIG_NET_NS=y |
| 21 | CONFIG_VETH=y |
| 22 | CONFIG_MACVLAN=y |
| 23 | |
| 24 | The IPC namespaces do not automatically enable IPC, so you may |
| 25 | also want to have: |
| 26 | |
| 27 | CONFIG_SYSVIPC=y |
| 28 | CONFIG_SYSVIPC_SYSCTL=y |
| 29 | CONFIG_POSIX_MQUEUE=y |
| 30 | |
| 31 | --------------------------------- |
| 32 | Enabling Kernel Configuration to test Controllers |
| 33 | --------------------------------- |
| 34 | CONFIG_CGROUPS=y |
| 35 | CONFIG_CGROUP_DEBUG=y |
| 36 | CONFIG_CGROUP_NS=y |
| 37 | CONFIG_GROUP_SCHED=y |
| 38 | CONFIG_FAIR_GROUP_SCHED=y |
| 39 | CONFIG_RT_GROUP_SCHED=y |
| 40 | CONFIG_CGROUP_SCHED=y |
| 41 | CONFIG_CGROUP_MEM_RES_CTLR=y |
| 42 | CONFIG_LOCKDEP=y |
| 43 | --------------------------------- |
| 44 | Enabling Kernel Configuration to test Power Management features |
| 45 | --------------------------------- |
| 46 | CONFIG_CPU_FREQ=y |
| 47 | CONFIG_CPU_FREQ_TABLE=y |
| 48 | CONFIG_CPU_FREQ_DEBUG=y |
| 49 | CONFIG_CPU_FREQ_STAT=y |
| 50 | CONFIG_CPU_FREQ_STAT_DETAILS=y |
| 51 | CONFIG_CPU_IDLE=y |
| 52 | CONFIG_CPU_IDLE_GOV_LADDER=y |
| 53 | CONFIG_CPU_IDLE_GOV_MENU=y |
| 54 | CONFIG_SCHED_MC=y |
| 55 | CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y |
| 56 | CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE=y |
| 57 | CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y |
| 58 | CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y |
| 59 | CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE=y |
| 60 | CONFIG_CPU_FREQ_GOV_PERFORMANCE=y |
| 61 | CONFIG_CPU_FREQ_GOV_POWERSAVE=y |
| 62 | CONFIG_CPU_FREQ_GOV_USERSPACE=y |
| 63 | CONFIG_CPU_FREQ_GOV_ONDEMAND=y |
| 64 | CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y |
| 65 | --------------------------------- |
| 66 | Enabling Kernel Configuration to test filecaps security feature |
| 67 | --------------------------------- |
| 68 | CONFIG_SECURITY_FILE_CAPABILITIES=y |
| 69 | --------------------------------- |
| 70 | Enabling Kernel Configuration to test p9auth security feature |
| 71 | --------------------------------- |
| 72 | CONFIG_CRYPTO=y |
| 73 | CONFIG_STAGING=y |
| 74 | # CONFIG_STAGING_EXCLUDE_BUILD is not set |
| 75 | CONFIG_PLAN9AUTH=m |
| 76 | (Or CONFIG_PLAN9AUTH=y) |
| 77 | You also will need openssl installed. |
| 78 | You will also need to have an user named 'ltp' |
| 79 | created to execute this test. |
| 80 | --------------------------------- |
| 81 | Enabling Kernel Configuration to test SELinux security feature |
| 82 | --------------------------------- |
| 83 | Your Kernel should have been built with the following options to |
| 84 | test SELinux: |
| 85 | |
| 86 | CONFIG_SECURITY=y |
| 87 | CONFIG_SECURITY_NETWORK=y |
| 88 | CONFIG_SECURITY_NETWORK_XFRM=y |
| 89 | |
| 90 | CONFIG_SECURITY_DEFAULT_MMAP_MIN_ADDR=0 |
| 91 | This has to be set to a positive value if you want to test this check. |
| 92 | Fedora kernels set it to 65536. |
| 93 | |
| 94 | CONFIG_SECURITY_SELINUX=y |
| 95 | CONFIG_SECURITY_SELINUX_BOOTPARAM=y |
| 96 | CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE=1 |
| 97 | CONFIG_SECURITY_SELINUX_DEVELOP=y |
| 98 | CONFIG_SECURITY_SELINUX_AVC_STATS=y |
| 99 | CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE=1 |
| 100 | CONFIG_SECURITY_SELINUX_ENABLE_SECMARK_DEFAULT=y |
| 101 | |
| 102 | CONFIG_SECURITY_SELINUX_POLICYDB_VERSION_MAX=y |
| 103 | You don't want this one unless you are running Fedora 3 or 4. |
| 104 | On anything newer, it will cause unnecessary policy expansion. |
| 105 | |
| 106 | CONFIG_SECURITY_SMACK=y |
| 107 | CONFIG_SECURITY_SELINUX=y |
| 108 | |
| 109 | By default, if you boot with multiple LSMs compiled into the kernel, the |
| 110 | kernel won't boot succesfully - there can be only one (aside from |
| 111 | explicit internal "stacking" e.g. as is done for combining SELinux or |
| 112 | Smack with capabilities). Unless you use the security= option to select |
| 113 | one at boot. SELinux and Smack will honor the security= option. |
| 114 | --------------------------------- |
| 115 | --------------------------------- |
| 116 | Enabling Kernel Configuration to test SMACK security feature |
| 117 | --------------------------------- |
| 118 | CONFIG_NETLABEL=y |
| 119 | CONFIG_SECURITY=y |
| 120 | CONFIG_SECURITY_NETWORK=y |
| 121 | CONFIG_SECURITY_SMACK=y |
| 122 | CONFIG_SECURITY_SELINUX should not be set |
| 123 | |
| 124 | For more information to build/install/run these tests, look through: |
| 125 | ltp/testcases/kernel/security/smack/README |
| 126 | --------------------------------- |
| 127 | --------------------------------- |
| 128 | Enablement for Enhancement to kexec/kdump for implementing the following features: |
| 129 | - Backup/restore memory used by the original kernel before/after kexec. |
| 130 | - Save/restore CPU state before/after kexec. |
| 131 | Now, only the i386 architecture is supported. More from the following git logs: |
| 132 | http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3ab83521378268044a448113c6aa9a9e245f4d2f, |
| 133 | http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=89081d17f7bb81d89fa1aa9b70f821c5cf4d39e9, |
| 134 | --------------------------------- |
| 135 | CONFIG_X86_32=y |
| 136 | CONFIG_RELOCATABLE=y |
| 137 | CONFIG_KEXEC=y |
| 138 | CONFIG_CRASH_DUMP=y |
| 139 | CONFIG_PM=y |
| 140 | CONFIG_HIBERNATION=y |
| 141 | CONFIG_KEXEC_JUMP=y |
| 142 | --------------------------------- |
| 143 | Enabling HOTPLUG for your Kernels |
| 144 | --------------------------------- |
| 145 | CONFIG_HOTPLUG=y |
| 146 | CONFIG_HOTPLUG_CPU=y |
| 147 | CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y |
| 148 | CONFIG_ACPI_HOTPLUG_CPU=y |
| 149 | CONFIG_HOTPLUG_PCI_PCIE=y |
| 150 | CONFIG_HOTPLUG_PCI=y |
| 151 | CONFIG_HOTPLUG_PCI_FAKE=y |
| 152 | CONFIG_HOTPLUG_PCI_COMPAQ=y |
| 153 | CONFIG_HOTPLUG_PCI_COMPAQ_NVRAM=y |
| 154 | CONFIG_HOTPLUG_PCI_IBM=y |
| 155 | CONFIG_HOTPLUG_PCI_ACPI=y |
| 156 | CONFIG_HOTPLUG_PCI_ACPI_IBM=y |
| 157 | CONFIG_HOTPLUG_PCI_CPCI=y |
| 158 | CONFIG_HOTPLUG_PCI_CPCI_ZT5550=y |
| 159 | CONFIG_HOTPLUG_PCI_CPCI_GENERIC=y |
| 160 | CONFIG_HOTPLUG_PCI_SHPC=y |
| 161 | --------------------------------- |
| 162 | Video For Linux Two API testing Requirements: |
| 163 | You need to have a video device (i.e. webcam, tuner card, etc.) connected to your system and available under /dev/video0. If you don't have any hardware device available, you can still test the "Virtual Video Driver". To compile this you need to compile your kernel with CONFIG_VIDEO_VIVI=m under: |
| 164 | -> Device Drivers |
| 165 | -> Multimedia devices |
| 166 | -> Video For Linux |
| 167 | -> Video capture adapters |
| 168 | -> Virtual Video Driver |
| 169 | |
| 170 | The tests also require CUnit Framework to be installed before compiling the tests. Download & Install the same from: |
| 171 | http://sourceforge.net/projects/cunit/ |
| 172 | --------------------------------- |
| 173 | --------------------------------- |
| 174 | Native language support (nls) testsuite requirements |
| 175 | ---------------------------------------------------- |
| 176 | CONFIG_NLS=m |
| 177 | CONFIG_BLOCK=y |
| 178 | --------------------------------- |
| 179 | Enabling Controller area network (CAN) protocol support for your Kernels |
| 180 | --------------------------------- |
| 181 | CONFIG_NET=y |
| 182 | CONFIG_CAN=m |
| 183 | CONFIG_CAN_RAW=m |
| 184 | CONFIG_CAN_BCM=m |
| 185 | # CAN Device Drivers |
| 186 | CONFIG_CAN_VCAN=m |
| 187 | --------------------------------- |
| 188 | Enabling Fault Injection Support for your kernel (version 2.6.29). |
| 189 | Please check with the original kernel for the fault injection |
| 190 | types it supports. Following supports will be available: |
| 191 | |
| 192 | /sys/kernel/debug/fail_io_timeout/interval |
| 193 | /sys/kernel/debug/fail_io_timeout/probability |
| 194 | /sys/kernel/debug/fail_io_timeout/reject-end |
| 195 | /sys/kernel/debug/fail_io_timeout/reject-start |
| 196 | /sys/kernel/debug/fail_io_timeout/require-end |
| 197 | /sys/kernel/debug/fail_io_timeout/require-start |
| 198 | /sys/kernel/debug/fail_io_timeout/space |
| 199 | /sys/kernel/debug/fail_io_timeout/stacktrace-depth |
| 200 | /sys/kernel/debug/fail_io_timeout/task-filter |
| 201 | /sys/kernel/debug/fail_io_timeout/times |
| 202 | /sys/kernel/debug/fail_io_timeout/verbose |
| 203 | |
| 204 | /sys/kernel/debug/fail_make_request/interval |
| 205 | /sys/kernel/debug/fail_make_request/probability |
| 206 | /sys/kernel/debug/fail_make_request/reject-end |
| 207 | /sys/kernel/debug/fail_make_request/reject-start |
| 208 | /sys/kernel/debug/fail_make_request/require-end |
| 209 | /sys/kernel/debug/fail_make_request/require-start |
| 210 | /sys/kernel/debug/fail_make_request/space |
| 211 | /sys/kernel/debug/fail_make_request/stacktrace-depth |
| 212 | /sys/kernel/debug/fail_make_request/task-filter |
| 213 | /sys/kernel/debug/fail_make_request/times |
| 214 | /sys/kernel/debug/fail_make_request/verbose |
| 215 | |
| 216 | /sys/kernel/debug/fail_page_alloc/ignore-gfp-highmem |
| 217 | /sys/kernel/debug/fail_page_alloc/ignore-gfp-wait |
| 218 | /sys/kernel/debug/fail_page_alloc/interval |
| 219 | /sys/kernel/debug/fail_page_alloc/min-order |
| 220 | /sys/kernel/debug/fail_page_alloc/probability |
| 221 | /sys/kernel/debug/fail_page_alloc/reject-end |
| 222 | /sys/kernel/debug/fail_page_alloc/reject-start |
| 223 | /sys/kernel/debug/fail_page_alloc/require-end |
| 224 | /sys/kernel/debug/fail_page_alloc/require-start |
| 225 | /sys/kernel/debug/fail_page_alloc/space |
| 226 | /sys/kernel/debug/fail_page_alloc/stacktrace-depth |
| 227 | /sys/kernel/debug/fail_page_alloc/task-filter |
| 228 | /sys/kernel/debug/fail_page_alloc/times |
| 229 | /sys/kernel/debug/fail_page_alloc/verbose |
| 230 | |
| 231 | /sys/kernel/debug/failslab/ignore-gfp-wait |
| 232 | /sys/kernel/debug/failslab/interval |
| 233 | /sys/kernel/debug/failslab/probability |
| 234 | /sys/kernel/debug/failslab/reject-end |
| 235 | /sys/kernel/debug/failslab/reject-start |
| 236 | /sys/kernel/debug/failslab/require-end |
| 237 | /sys/kernel/debug/failslab/require-start |
| 238 | /sys/kernel/debug/failslab/space |
| 239 | /sys/kernel/debug/failslab/stacktrace-depth |
| 240 | /sys/kernel/debug/failslab/task-filter |
| 241 | /sys/kernel/debug/failslab/times |
| 242 | /sys/kernel/debug/failslab/verbose |
| 243 | |
| 244 | when the below kernel config options are set: |
| 245 | |
| 246 | CONFIG_FAULT_INJECTION=y |
| 247 | CONFIG_DEBUG_KERNEL=y |
| 248 | CONFIG_FAILSLAB=y (Fault-injection capability for kmalloc) |
| 249 | (CONFIG_SLAB=y || CONFIG_SLUB=y) if CONFIG_FAILSLAB=y |
| 250 | CONFIG_FAIL_PAGE_ALLOC=y (Fault-injection capabilitiy for alloc_pages()) |
| 251 | CONFIG_FAIL_MAKE_REQUEST=y (Fault-injection capability for disk IO) |
| 252 | CONFIG_BLOCK=y if CONFIG_FAIL_MAKE_REQUEST=y |
| 253 | CONFIG_FAIL_IO_TIMEOUT=y (Faul-injection capability for faking disk interrupts) |
| 254 | CONFIG_BLOCK=y if CONFIG_FAIL_IO_TIMEOUT=y |
| 255 | CONFIG_FAULT_INJECTION_DEBUG_FS=y (Debugfs entries for fault-injection capabilities) |
| 256 | (CONFIG_SYSFS=y && CONFIG_DEBUG_FS=y) if CONFIG_FAULT_INJECTION_DEBUG_FS=y |
| 257 | CONFIG_FAULT_INJECTION_STACKTRACE_FILTER=y (stacktrace filter for fault-injection capabilities) |
| 258 | (CONFIG_FAULT_INJECTION_DEBUG_FS=y && CONFIG_STACKTRACE_SUPPORT=y && !CONFIG_X86_64) if |
| 259 | CONFIG_FAULT_INJECTION_STACKTRACE_FILTER=y |
| 260 | |
| 261 | For more information on Fault injection, please refer to: |
| 262 | linux-2.6/Documentation/fault-injection/fault-injection.txt, |
| 263 | |
| 264 | You should also have made the following entries in your /etc/fstab file |
| 265 | once the kernel is booted with the above CONFIG options set: |
| 266 | |
| 267 | debugfs /sys/kernel/debug/ debugfs |
| 268 | |
| 269 | # How the Kernel Fault Injection works for LTP ? |
| 270 | |
| 271 | 1) Build Kernel with all the above possible kernel CONFIG Options, |
| 272 | 2) Create the above entry in /etc/fstab file, |
| 273 | 3) Reboot in the new kernel, |
| 274 | 4) Goto LTPROOT. Build and Install LTP as per ltp/INSTALL file, |
| 275 | 5) Choose your own test(or default) to run with fault injection as follows: |
| 276 | ./runltp -f <command_file> -F <LOOPS>,<FAULT_PROBABILITY> |
| 277 | |
| 278 | The algorithm functions like: |
| 279 | loop (for each testcase) |
| 280 | begin |
| 281 | execute_testcase(inside_stable_kernel) |
| 282 | begin |
| 283 | insert_fault_into_kernel() |
| 284 | loop X Times |
| 285 | begin |
| 286 | execute_testcase(inside_fault_kernel) |
| 287 | end |
| 288 | restore_kernel_to_normal() |
| 289 | end |
| 290 | end |
| 291 | |
| 292 | # External TODOs: |
| 293 | 1) Add or modify testcases when relevant kernel functionality changes. |
| 294 | --------------------------------- |
| 295 | |
| 296 | --------------------------------- |
| 297 | Enabling Kernel Configuration to test ext4 new features |
| 298 | --------------------------------- |
| 299 | CONFIG_EXT4_FS=y |
| 300 | CONFIG_EXT4DEV_COMPAT=y |
| 301 | CONFIG_EXT4_FS_XATTR=y |
| 302 | CONFIG_EXT4_FS_POSIX_ACL=y |
| 303 | CONFIG_EXT4_FS_SECURITY=y |
| 304 | |
| 305 | Beside that, the following packages are necessary. |
| 306 | e2fsprogs |
| 307 | e2fsprogs-devel |
| 308 | e2fsprogs-libs |
| 309 | And the version of packages must be 1.41.4 or above. |
| 310 | |
| 311 | For more information to build/install/run these tests, look through: |
| 312 | ltp/testcases/kernel/fs/ext4-new-features/README |
| 313 | --------------------------------- |