On Wed, Jan 05, 2022 at 11:50:33AM IST, Alexei Starovoitov wrote: > On Sun, Jan 02, 2022 at 09:51:15PM +0530, Kumar Kartikeya Dwivedi wrote: > > This adds a complete test case to ensure we never take references to > > modules not in MODULE_STATE_LIVE, which can lead to UAF, and it also > > ensures we never access btf->kfunc_set_tab in an inconsistent state. > > > > The test uses userfaultfd to artifically widen the race. > > Fancy! > Does it have to use a different module? > Can it be part of bpf_testmod somehow? I was thinking of doing it with bpf_testmod, but then I realised it would be a problem with parallel mode of test_progs, where another selftest in parallel may rely on bpf_testmod (which this test would unload, load and make it fault, and then fail the load before restoring it by loading again), so I went with bpf_testmod. Maybe we can hardcode a list of tests to be executed serially in --workers=n > 1 mode? All serial tests are then executed in the beginning (or end), and then it starts invoking others in parallel as usual. -- Kartikeya