All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Palethorpe <rpalethorpe@suse.de>
To: Petr Vorel <pvorel@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2] mknod02.c: Simplify and convert to new LTP API
Date: Wed, 23 Aug 2023 10:21:07 +0100	[thread overview]
Message-ID: <87wmxmumkr.fsf@suse.de> (raw)
In-Reply-To: <20230516115841.GA7742@pevik>

Hello,

Petr Vorel <pvorel@suse.cz> writes:

> Hi Avinesh,
>
>> Simply test when parent directory does not have set-group-ID bit set,
>> new node gets GID from effective GID of the process and does not inherit
>> the group ownership from its parent directory.
>
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
>
> Few comments below.
>
>>  testcases/kernel/syscalls/mknod/mknod02.c | 316 +++-------------------
>>  1 file changed, 36 insertions(+), 280 deletions(-)
>
> ...
>> +/*\
>> + * [Description]
>>   *
>> + * Verify that if mknod(2) creates a filesystem node in a directory which
>> + * does not have the set-group-ID bit set, new node will not inherit the
>> + * group ownership from its parent directory and its group ID will be the
>> + * effective group ID of the process.
>
> @Cyril I wonder if it'd be good to test this on all_filesystems. Are we trying
> to use use all_filesystems = 1 when subject of testing is using VFS or the
> opposite? (kernel docs mentions "VFS system calls open(2), stat(2), read(2),
> write(2), chmod(2)". It also mentions locking [2]).
>
> BTW looking what has mknod in vfs, it's just nfsd and 9p (none of them are used
> in all_filesystems):
>
> $ git grep  mknod $(git ls-files fs/|grep -i vfs)
> fs/9p/vfs_inode.c: * for mknod(2).
> fs/9p/vfs_inode.c: * v9fs_vfs_mknod - create a special file
> fs/9p/vfs_inode.c:v9fs_vfs_mknod(struct mnt_idmap *idmap, struct inode *dir,
> fs/9p/vfs_inode.c:      .mknod = v9fs_vfs_mknod,
> fs/9p/vfs_inode.c:      .mknod = v9fs_vfs_mknod,
> fs/9p/vfs_inode_dotl.c:v9fs_vfs_mknod_dotl(struct mnt_idmap *idmap, struct inode *dir,
> fs/9p/vfs_inode_dotl.c: return v9fs_vfs_mknod_dotl(idmap, dir, dentry, omode, 0);
> fs/9p/vfs_inode_dotl.c: * v9fs_vfs_mknod_dotl - create a special file
> fs/9p/vfs_inode_dotl.c:v9fs_vfs_mknod_dotl(struct mnt_idmap *idmap, struct inode *dir,
> fs/9p/vfs_inode_dotl.c:         p9_debug(P9_DEBUG_VFS, "Failed to get acl values in mknod %d\n",
> fs/9p/vfs_inode_dotl.c: err = p9_client_mknod_dotl(dfid, name, mode, rdev, gid, &qid);
> fs/9p/vfs_inode_dotl.c: .mknod = v9fs_vfs_mknod_dotl,
> fs/nfsd/vfs.c:          host_err = vfs_mknod(&nop_mnt_idmap, dirp,
> dchild,

It is defined for all major file systems on the directory
inode_operations struct (e.g. search btrfs_mknod, xfs_vn_mknod, ext4_mknod).

If you setup clangd and provide a reasonabl compile_commands.json
(i.e. relatively large kernel config) you can search for places where
struct inode_operations.mk_nod is set.

So I'll go ahead and try to merge it.

-- 
Thank you,
Richard.

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

      parent reply	other threads:[~2023-08-23  9:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-15 15:56 [LTP] [PATCH v2] mknod02.c: Simplify and convert to new LTP API Avinesh Kumar
2023-05-16 11:58 ` Petr Vorel
2023-05-17 15:07   ` Avinesh Kumar
2023-08-23  9:21   ` Richard Palethorpe [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wmxmumkr.fsf@suse.de \
    --to=rpalethorpe@suse.de \
    --cc=ltp@lists.linux.it \
    --cc=pvorel@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.