commit | 733e64419de0e60197e9393126fcbbf7b74dc72a | [log] [tgz] |
---|---|---|
author | Yang Xu <xuyang2018.jy@cn.fujitsu.com> | Wed Mar 18 12:55:02 2020 +0800 |
committer | Li Wang <liwang@redhat.com> | Mon Apr 13 14:18:22 2020 +0800 |
tree | 741564937e72ff01496f9af347662a58750cf97c | |
parent | e29c454c8baf574207e56f0e869a42f08c1f4fed [diff] |
ltp_tpci.c: fix a null pointer The commit 3dd286bdbee ("ltp_tpci.c: Update legacy code") introduced a warning as below: ../ltp_tpci.c: In function ‘probe_pci_dev’: ../ltp_tpci.c:107:8: warning: ‘dev’ is used uninitialized in this function [-Wuninitialized] struct pci_dev *dev; dev = pci_get_domain_bus_and_slot(pci_domain_nr(dev->bus), bus, slot) This will lead to system crash when we run this case because it triggers a null pointer. Use 0 domain intead of pci_domain_nr. [Desnes:] It is safe to use 0 since function pci_get_bus_and_slot(unsigned int bus, unsigned int devfn) removed on kernel commit <5cf0c37a71da0f3> ("PCI: Remove pci_get_bus_and_slot() function") used to be a wrapper for pci_get_domain_bus_and_slot(0, bus, devfn). This patch avoids the following Oops: [69614.978596] Unable to handle kernel paging request for data at address 0x00000010 [69614.978602] Faulting instruction address: 0xd000000003c200a4 [69614.978606] Oops: Kernel access of bad area, sig: 11 [#1] [69614.978609] LE SMP NR_CPUS=2048 NUMA PowerNV [69614.978613] Modules linked in: ltp_tpci(OE) vmac chacha20_generic poly1305_generic chacha20poly1305 snd_timer snd soundcore authenc pcrypt crypto_user sha3_generic salsa20_generic uinput can_raw can dummy veth n_gsm pps_ldisc ppp_synctty n_hdlc ppp_async ppp_generic slhc kvm_hv kvm_pr kvm binfmt_misc nfsv3 nfs_acl nfs lockd grace fscache tun brd vfat fat fuse overlay ext4 mbcache jbd2 loop sunrpc uio_pdrv_genirq ses xts ipmi_powernv enclosure ipmi_devintf uio scsi_transport_sas ibmpowernv ipmi_msghandler leds_powernv vmx_crypto powernv_rng powernv_op_panel ip_tables xfs libcrc32c sr_mod cdrom sd_mod sg ipr libata tg3 dm_mirror dm_region_hash dm_log dm_mod [last unloaded: ltp_block_dev] [69614.978653] Features: eBPF/sock [69614.978657] CPU: 1 PID: 2292176 Comm: tpci Kdump: loaded Tainted: G W OE --------- - - 4.18.0-187.el8.ppc64le #1 [69614.978662] NIP: d000000003c200a4 LR: d000000003c2006c CTR: c000000000dc8c00 [69614.978666] REGS: c0000004be437a20 TRAP: 0300 Tainted: G W OE --------- - - (4.18.0-187.el8.ppc64le) [69614.978670] MSR: 9000000000009033 <SF,HV,EE,ME,IR,DR,RI,LE> CR: 28002272 XER: 20000000 [69614.978676] CFAR: c000000000008934 DAR: 0000000000000010 DSISR: 40000000 IRQMASK: 0 GPR00: d000000003c2006c c0000004be437ca0 d000000003c2a300 0000000000000000 GPR04: d000000003c214ba 0000000000000000 c0000007846448c9 0000000000000000 GPR08: c0000004be437d04 0000000000000000 0000000000000000 0000000000000000 GPR12: 0000000000002200 c0000007ffffee00 0000000000000000 0000000000000000 GPR16: 0000000000000000 000000001001cf98 000000001001cf78 000000001001cff0 GPR20: 000000001001d010 000000001001cf58 00007fff92643190 0000000010040530 GPR24: 000000001001d108 000000001001cf48 c0000004be437df0 0000000000000001 GPR28: fffffffffffffff2 0000000000000000 d000000003c22f80 0000000000000000 [69614.978711] NIP [d000000003c200a4] sys_bus_slot+0x8c/0x170 [ltp_tpci] [69614.978715] LR [d000000003c2006c] sys_bus_slot+0x54/0x170 [ltp_tpci] [69614.978718] Call Trace: [69614.978721] [c0000004be437ca0] [d000000003c2006c] sys_bus_slot+0x54/0x170 [ltp_tpci] (unreliable) [69614.978727] [c0000004be437d40] [c0000000008da5bc] dev_attr_store+0x3c/0x60 [69614.978732] [c0000004be437d60] [c0000000005fb908] sysfs_kf_write+0x68/0x80 [69614.978736] [c0000004be437d80] [c0000000005f9fb4] kernfs_fop_write+0x104/0x270 [69614.978741] [c0000004be437dd0] [c0000000004ff624] sys_write+0x134/0x3a0 [69614.978745] [c0000004be437e30] [c00000000000b388] system_call+0x5c/0x70 [69614.978748] Instruction dump: [69614.978751] ebde8010 80a10064 e87e0000 78bdc622 54bf063e 2fa30000 419e0014 48000e89 [69614.978757] e8410018 39200000 f93e0000 39200000 <e8690010> 48000dd1 e8410018 7fe5fb78 [69614.978764] ---[ end trace 414b1270f579351f ]--- Fixes: 3dd286b ("ltp_tpci.c: Update legacy code") Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com> Reviewed-by: Desnes A. Nunes do Rosario <desnesn@linux.ibm.com> Signed-off-by: Li Wang <liwang@redhat.com>
Linux Test Project is a joint project started by SGI, OSDL and Bull developed and maintained by IBM, Cisco, Fujitsu, SUSE, Red Hat, Oracle and others. The project goal is to deliver tests to the open source community that validate the reliability, robustness, and stability of Linux.
The LTP testsuite contains a collection of tools for testing the Linux kernel and related features. Our goal is to improve the Linux kernel and system libraries by bringing test automation to the testing effort. Interested open source contributors are encouraged to join.
Project pages are located at: http://linux-test-project.github.io/
The latest image is always available at: https://github.com/linux-test-project/ltp/releases
The discussion about the project happens at ltp mailing list: http://lists.linux.it/listinfo/ltp
The git repository is located at GitHub at: https://github.com/linux-test-project/ltp
The patchwork instance is at: https://patchwork.ozlabs.org/project/ltp/list/
Be careful with these tests!
Don't run them on production systems. Growfiles, doio, and iogen in particular stress the I/O capabilities of systems and while they should not cause problems on properly functioning systems, they are intended to find (or cause) problems.
If you have git, autoconf, automake, m4 and pkg-config, the linux headers and the common developer packages installed, the chances are the following will work:
$ git clone https://github.com/linux-test-project/ltp.git $ cd ltp $ make autotools $ ./configure
Now you can continue either with compiling and running a single test or with compiling and installing the whole testsuite.
For optional library dependencies look into scripts for major distros in travis/
directory. You can also build whole LTP with ./build.sh
script.
If you need to execute a single test you actually do not need to compile the whole LTP, if you want to run a syscall testcase following should work.
$ cd testcases/kernel/syscalls/foo $ make $ PATH=$PATH:$PWD ./foo01
Shell testcases are a bit more complicated since these need a path to a shell library as well as to compiled binary helpers, but generally following should work.
$ cd testcases/lib $ make $ cd ../commands/foo $ PATH=$PATH:$PWD:$PWD/../../lib/ ./foo01.sh
Open Posix Testsuite has it's own build system which needs Makefiles to be generated first, then compilation should work in subdirectories as well.
$ cd testcases/open_posix_testsuite/ $ make generate-makefiles $ cd conformance/interfaces/foo $ make $ ./foo_1-1.run-test
$ make $ make install
This will install LTP to /opt/ltp
.
doc/mini-howto-building-ltp-from-git.txt
.INSTALL
and ./configure --help
.Some tests will be disabled if the configure script can not find their build dependencies.
TCONF
due to a missing component, check the ./configure
output.INSTALL
.To run all the test suites
$ cd /opt/ltp $ ./runltp
Note that many test cases have to be executed as root.
To run a particular test suite
$ ./runltp -f syscalls
To run all tests with madvise
in the name
$ ./runltp -f syscalls -s madvise
Also see
$ ./runltp --help
Test suites (e.g. syscalls) are defined in the runtest directory. Each file contains a list of test cases in a simple format, see doc/ltp-run-files.txt.
Each test case has its own executable or script, these can be executed directly
$ testcases/bin/abort01
Some have arguments
$ testcases/bin/fork13 -i 37
The vast majority of test cases accept the -h (help) switch
$ testcases/bin/ioctl01 -h
Many require certain environment variables to be set
$ LTPROOT=/opt/ltp PATH="$PATH:$LTPROOT/testcases/bin" testcases/bin/wc01.sh
Most commonly, the path variable needs to be set and also LTPROOT
, but there are a number of other variables, runltp
usually sets these for you.
Note that all shell scripts need the PATH
to be set. However this is not limited to shell scripts, many C based tests need environment variables as well.
For more info see doc/user-guide.txt
or online at https://github.com/linux-test-project/ltp/wiki/User-Guidelines.
Network tests require certain setup, described in testcases/network/README.md
(online at https://github.com/linux-test-project/ltp/tree/master/testcases/network) and INSTALL
.
Before you start you should read following documents:
doc/test-writing-guidelines.txt
doc/build-system-guide.txt
doc/library-api-writing-guidelines.txt
There is also a step-by-step tutorial:
doc/c-test-tutorial-simple.txt
If something is not covered there don't hesitate to ask on the LTP mailing list. Also note that these documents are available online at:
Although we accept GitHub pull requests, the preferred way is sending patches to our mailing list.
It's a good idea to test patches on Travis CI before posting to mailing list. Our travis setup covers various architectures and distributions in order to make sure LTP compiles cleanly on most common configurations. For testing you need to sign up to Travis CI, enable running builds on your LTP fork on https://travis-ci.org/account/repositories and push your branch.