From: "Günther Noack" <gnoack3000@gmail.com>
To: xiujianfeng <xiujianfeng@huawei.com>
Cc: mic@digikod.net, paul@paul-moore.com, jmorris@namei.org,
serge@hallyn.com, shuah@kernel.org, corbet@lwn.net,
linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-doc@vger.kernel.org
Subject: Re: [PATCH -next 3/5] landlock/selftests: add selftests for chmod and chown
Date: Sat, 27 Aug 2022 18:57:57 +0200 [thread overview]
Message-ID: <YwpNFWB9ELDLNLA1@nuc> (raw)
In-Reply-To: <64b93d8e-f2b0-31c8-0736-3194053de687@huawei.com>
On Sat, Aug 27, 2022 at 07:14:30PM +0800, xiujianfeng wrote:
> Hi,
>
> 在 2022/8/23 3:26, Günther Noack 写道:
> > On Mon, Aug 22, 2022 at 07:46:59PM +0800, Xiu Jianfeng wrote:
> > > +TEST_F_FORK(layout1, unhandled_chmod)
> > > +{
> > > + const struct rule rules[] = {
> > > + {
> > > + .path = file2_s3d1,
> > > + .access = LANDLOCK_ACCESS_FS_READ_FILE |
> > > + LANDLOCK_ACCESS_FS_WRITE_FILE,
> > > + },
> > > + {
> > > + .path = file3_s3d1,
> > > + .access = LANDLOCK_ACCESS_FS_READ_FILE |
> > > + LANDLOCK_ACCESS_FS_WRITE_FILE,
> > > + },
> > > + {},
> > > + };
> > > + const int ruleset_fd =
> > > + create_ruleset(_metadata, ACCESS_RW, rules);
> > > +
> > > + ASSERT_LE(0, ruleset_fd);
> > > + enforce_ruleset(_metadata, ruleset_fd);
> > > + ASSERT_EQ(0, close(ruleset_fd));
> > > +
> > > + ASSERT_EQ(0, test_chmod(file2_s3d1));
> > > + ASSERT_EQ(0, test_fchmod(file2_s3d1));
> > > + ASSERT_EQ(0, test_chmod(file3_s3d1));
> > > + ASSERT_EQ(0, test_chmod(dir_s3d1));
> > > +}
> >
> > I missed it in the previous mail:
> >
> > There are also the chown variants lchown() and fchownat(), as well as
> > the chmod variant fchmodat(), which might be interesting to test,
> > especially the symlink scenarios.
> >
> > fchmodat() has a AT_SYMLINK_NOFOLLOW flag which does the chmod
> > equivalent to lchown().
> >
>
> man fchmodat shows as follows:
> ...
> AT_SYMLINK_NOFOLLOW
> If pathname is a symbolic link, do not dereference it: instead operate on
> the link itself. This flag is not currently implemented.
> ...
>
> so I suppose this can not be test. Please correct me if I am wrong.
Good point - I didn't realize that AT_SYMLINK_NOFOLLOW was not
implemented for fchmodat. In that case, this only applies to lchown.
—Günther
--
next prev parent reply other threads:[~2022-08-27 16:58 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-22 11:46 [PATCH -next 0/5] landlock: add chmod and chown support Xiu Jianfeng
2022-08-22 11:46 ` [PATCH -next 1/5] landlock: expand access_mask_t to u32 type Xiu Jianfeng
2022-08-22 11:46 ` [PATCH -next 2/5] landlock: add chmod and chown support Xiu Jianfeng
2022-08-22 18:25 ` Günther Noack
2022-08-22 21:07 ` Mickaël Salaün
2022-08-23 12:50 ` xiujianfeng
2022-08-24 11:44 ` Mickaël Salaün
2022-08-26 8:36 ` xiujianfeng
2022-08-26 9:36 ` Mickaël Salaün
2022-08-26 11:14 ` xiujianfeng
2022-08-26 11:32 ` Mickaël Salaün
2022-08-22 11:46 ` [PATCH -next 3/5] landlock/selftests: add selftests for chmod and chown Xiu Jianfeng
2022-08-22 18:53 ` Günther Noack
2022-08-22 21:28 ` Mickaël Salaün
2022-08-24 8:27 ` xiujianfeng
2022-08-22 19:26 ` Günther Noack
2022-08-27 11:14 ` xiujianfeng
2022-08-27 16:57 ` Günther Noack [this message]
2022-08-22 11:47 ` [PATCH -next 4/5] landlock/samples: add chmod and chown support Xiu Jianfeng
2022-08-22 11:47 ` [PATCH -next 5/5] landlock: update chmod and chown support in document Xiu Jianfeng
2022-08-22 21:25 ` Mickaël Salaün
2022-08-22 19:17 ` [PATCH -next 0/5] landlock: add chmod and chown support Günther Noack
2022-08-22 19:35 ` Casey Schaufler
2022-08-22 21:18 ` Günther Noack
2022-08-22 21:21 ` Mickaël Salaün
2022-08-22 21:53 ` Casey Schaufler
2022-08-23 17:10 ` Mickaël Salaün
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=YwpNFWB9ELDLNLA1@nuc \
--to=gnoack3000@gmail.com \
--cc=corbet@lwn.net \
--cc=jmorris@namei.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=mic@digikod.net \
--cc=paul@paul-moore.com \
--cc=serge@hallyn.com \
--cc=shuah@kernel.org \
--cc=xiujianfeng@huawei.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).