[LTP] [PATCH v3 3/4] tst_kconfig: add module mappings for vsock/vsock_loopback

Li Wang li.wang@linux.dev
Wed Oct 14 07:01:12 CEST 2026


On Mon, Oct 12, 2026 at 03:51:32PM +0000, Andrea Cervesato wrote:
> Hi Li,
> 
> > The test needs root only to load the modules; the reproducer runs as
> > an ordinary nonroot process in the initial namespace, which can use
> > loopback VSOCK on nonprivileged ports. Drop privileges to nobody after
> > module loading and regain root in cleanup() so the modules can be
> > unloaded.
> 
> Please drop the root _only_ if we are root, we shouldn'f force the test
> to be root always, even when we are user.

After thinking it over, I'd prefer to leave this patch unchanged:

The test does need root, but not for the reproducer itself -- it needs
root for setup and cleanup:

  - loading vsock_loopback requires CAP_SYS_MODULE;
  - unloading it in cleanup() also requires CAP_SYS_MODULE.

Without .needs_root = 1, a non-root run would skip the automatic
module load in tst_kconfig, bind() would then fail with
EADDRNOTAVAIL and the test would abort with TBROK instead of being
skipped cleanly.

Keeping .needs_root = 1 and dropping privileges to nobody in setup()
is exactly what makes the reproducer run as an ordinary non-root
process while still allowing the modules to be loaded and unloaded.

-- 
Regards,
Li Wang


More information about the ltp mailing list