[LTP] [PATCH v3] madvise11.c:Check loadable module before rmmod

Wei Gao wegao@suse.com
Tue Mar 14 06:31:51 CET 2023


On Mon, Mar 13, 2023 at 03:06:38PM +0100, Cyril Hrubis wrote:
> Hi!
> > > +int tst_buildin_driver(const char *driver)
> > > +{
> > > +       return !tst_search_driver(driver, "modules.buildin");
> > > +}
> > > +
> > >  int tst_check_driver(const char *driver)
> > >  {
> > >  #ifdef __ANDROID__
> > > 
> > 
> > Try use above implementation but i found another TWARN : (
> > 
> > localhost:/home/ltp/testcases/kernel/syscalls/madvise # ./madvise11
> > tst_test.c:1560: TINFO: Timeout per run is 0h 01m 00s
> > madvise11.c:396: TINFO: Spawning 5 threads, with a total of 800 memory pages
> > madvise11.c:165: TINFO: Thread [3] returned 0, succeeded.
> > madvise11.c:165: TINFO: Thread [1] returned 0, succeeded.
> > madvise11.c:165: TINFO: Thread [2] returned 0, succeeded.
> > madvise11.c:165: TINFO: Thread [4] returned 0, succeeded.
> > madvise11.c:165: TINFO: Thread [0] returned 0, succeeded.
> > madvise11.c:199: TPASS: soft-offline / mmap race still clean
> > madvise11.c:327: TWARN: open(/sys/kernel/debug/hwpoison/unpoison-pfn,1,0000) failed: ENOENT (2) !!!!
> 
> That's strange, this should be equivalent to the modinfo patch you send,
> at least the modinfo parses the same file.
> 


This is caused by "_" and "-", current search function not do this tricky translate part.
Input parameter is hwpoison_inject but actually string in modules.xxx is hwpoison-inject

/lib/modules/5.14.21-150400.24.41-default/modules.dep | grep hwpo
kernel/mm/hwpoison-inject.ko.zst:

Other info just FYI:
//modprobe can accept both "-" and "_"
localhost:/home/ltp # modprobe hwpoison-inject
localhost:/home/ltp # modprobe hwpoison_inject

//get info from lsmod and /proc use "_"
localhost:/home/ltp # lsmod | grep hwpo
hwpoison_inject        16384  0
localhost:/home/ltp # cat /proc/modules | grep hwp
hwpoison_inject 16384 0 - Live 0xffffffffc09d6000

> -- 
> Cyril Hrubis
> chrubis@suse.cz


More information about the ltp mailing list