[PATCH blktests] nvme/046: add test for unprivileged passthrough

Shinichiro Kawasaki shinichiro.kawasaki at wdc.com
Thu Feb 9 18:01:14 PST 2023


On Feb 09, 2023 / 15:15, Kanchan Joshi wrote:
> Ths creates a non-root user "blktest46", alters permissions for
> char-device node (/dev/ngX) and runs few passthrough commands.
> At the end of the test, user is deleted and permissions are reverted.
> 
> Signed-off-by: Kanchan Joshi <joshi.k at samsung.com>

Thanks for the patch. I guess this test case exercises nvme_cmd_allowed() in
drivers/nvme/host/ioctl.c. The test contents look valid and good.

This test case adds and deletes a user. For every test case run, it creates and
removes the user home directory and touches /etc files. It does not sound right
for me. It changes system set up, and sudden test case stop will leave the user.

I suggest to ask blktests users to prepare the normal user and specify it to a
config file variable (it can be named NORMAL_USER or something). I also suggest
to add two new helper functions: _require_user() will check that the specified
user is valid, and _run_user() will wrap the "su $NORMAL_USER -c" command line.

If you don't mind, I can create another patch for further discussion based on
the suggestion above, and modify your patch to use the new helper functions.

-- 
Shin'ichiro Kawasaki


More information about the Linux-nvme mailing list