All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: "xuyang2018.jy@fujitsu.com" <xuyang2018.jy@fujitsu.com>
Cc: "ltp@lists.linux.it" <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH v3 0/2] mount03: Convert to new API
Date: Mon, 15 Aug 2022 10:28:58 +0200	[thread overview]
Message-ID: <YvoDyrIGa3/BsqI3@pevik> (raw)
In-Reply-To: <1e791bd1-2661-95b0-1f0b-e3ca82b6524f@fujitsu.com>

Hi Xu,

...
> >>> -	SAFE_READ(0, otfd, readbuf, sizeof(readbuf));
> >>> +	nobody_uid = ltpuser->pw_uid;
> >>> +	nobody_gid = ltpuser->pw_gid;

> >>> -	SAFE_FSTAT(otfd, &file_stat);
> >>> +	snprintf(file, PATH_MAX, "%s/%s", MNTPOINT, TESTBIN);
> >>> +	TST_RESOURCE_COPY(NULL, TESTBIN, file);

> >> In fact, old test case copy resource file when mount fileystem, but now,
> >> you change this.  So in test_nosuid function, you test nosuid behaviour
> >> in tmpdir instead of different filesystems.

> > old code in setup:
> >      fs_type = tst_dev_fs_type();
> >      device = tst_acquire_device(cleanup);

> >      if (!device)
> >          tst_brkm(TCONF, cleanup, "Failed to obtain block device");

> >      tst_mkfs(cleanup, device, fs_type, NULL, NULL);

> >      SAFE_MKDIR(cleanup, mntpoint, DIR_MODE);

> >      SAFE_MOUNT(cleanup, device, mntpoint, fs_type, 0, NULL);
> >      TST_RESOURCE_COPY(cleanup, "mount03_setuid_test", path_name);

> > new code:
> >      snprintf(file, PATH_MAX, "%s/%s", MNTPOINT, TESTBIN);
> >      SAFE_CP(TESTBIN, file);

> > Well, Li in his v2 removed the code because there is .mntpoint = MNTPOINT, in
> > struct tst_test, therefore MNTPOINT is mounted in the filesystem, right?

> > But he also did SAFE_STAT and SAFE_CHMOD on MNTPOINT, which is IMHO wrong
> > (or at least different from the old code).

> Yes, it is wrong. I guess Chen misundertand mntpoint usage(it just 
> create mntpoint instead mount dev to a moutpoint).

> So do you will fix this?

Yes, see the diff below. I'm waiting little longer if anybody else has some
comments before merging it.

Thanks for your review.

> Best Regards
> Yang Xu

diff --git testcases/kernel/syscalls/mount/mount03.c testcases/kernel/syscalls/mount/mount03.c
index 74b018d78..9c58783d7 100644
--- testcases/kernel/syscalls/mount/mount03.c
+++ testcases/kernel/syscalls/mount/mount03.c
@@ -15,7 +15,6 @@
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <pwd.h>
-#include "old_resource.h"
 #include "tst_test.h"
 #include "lapi/mount.h"
 
@@ -145,7 +144,7 @@ static void setup(void)
 	nobody_gid = ltpuser->pw_gid;
 
 	snprintf(file, PATH_MAX, "%s/%s", MNTPOINT, TESTBIN);
-	TST_RESOURCE_COPY(NULL, TESTBIN, file);
+	SAFE_CP(TESTBIN, file);
 
 	SAFE_STAT(file, &st);
 	if (st.st_mode != SUID_MODE)

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

  reply	other threads:[~2022-08-15  8:29 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-11 13:57 [LTP] [PATCH v3 0/2] mount03: Convert to new API Petr Vorel
2022-08-11 13:57 ` [LTP] [PATCH v3 1/2] tst_test_macros.h: Add TST_EXP_EQ_STR Petr Vorel
2022-08-15  3:17   ` xuyang2018.jy
2022-08-11 13:57 ` [LTP] [PATCH v3 2/2] mount03: Convert to new API Petr Vorel
2022-08-16  9:07   ` Cyril Hrubis
2022-08-16  9:18     ` Petr Vorel
2022-08-16  9:31       ` Cyril Hrubis
2022-08-15  5:15 ` [LTP] [PATCH v3 0/2] " xuyang2018.jy
2022-08-15  6:40   ` Petr Vorel
2022-08-15  6:58     ` xuyang2018.jy
2022-08-15  8:28       ` Petr Vorel [this message]
2022-08-15  9:57         ` xuyang2018.jy
2022-08-15 14:19           ` Petr Vorel
2022-08-16  3:40             ` xuyang2018.jy
2022-08-16 11:49               ` Petr Vorel
2022-08-16 13:01                 ` Petr Vorel
2022-08-17  2:23                   ` xuyang2018.jy
2022-08-22 13:28           ` Petr Vorel
2022-08-22 13:35             ` Petr Vorel
2022-08-16  4:37     ` xuyang2018.jy
2022-08-16  6:57       ` Petr Vorel
2022-08-16  7:28         ` xuyang2018.jy
2022-08-16  9:00       ` Cyril Hrubis
2022-08-16  9:06         ` Petr Vorel
2022-08-16  9:57           ` xuyang2018.jy

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=YvoDyrIGa3/BsqI3@pevik \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=xuyang2018.jy@fujitsu.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 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.