From: Cyril Hrubis <chrubis@suse.cz>
To: Yang Xu <xuyang2018.jy@fujitsu.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v3 3/3] syscalls/setgroups03: Convert to new API
Date: Mon, 14 Aug 2023 16:49:07 +0200 [thread overview]
Message-ID: <ZNo-4xc1oQf7aJ2k@yuki> (raw)
In-Reply-To: <1692012648-1970-3-git-send-email-xuyang2018.jy@fujitsu.com>
Hi!
> + * 05/2002 Ported by André Merlier
^
I suppose that this is the line that confuses your email client or mail
server so that we end up with invalid encoding.
I've managed to hand edit the patch so that it applies and I've replaced
the invalid sequence with ascii 'e' character.
I've also fixed the safe buffers part. The glist3 is supposed to be set
to bad addres, it does not make sense to allocate it as a safe buffer at
all and then replace the value in setup. The glist1 has to be allocated
with a proper size instead of allocated with SAFE_MALLOC(). And the
glist2 can be just single entry just like in the second test, but should
be initialized properly, the bonus point is that we get rid of the
GID16_CHECK() that way as well.
Pushed with folling diff, thanks.
diff --git a/testcases/kernel/syscalls/setgroups/setgroups03.c b/testcases/kernel/syscalls/setgroups/setgroups03.c
index d0331b216..fbf8de0bb 100644
--- a/testcases/kernel/syscalls/setgroups/setgroups03.c
+++ b/testcases/kernel/syscalls/setgroups/setgroups03.c
@@ -4,7 +4,7 @@
* Copyright (c) International Business Machines Corp., 2001
* Copyright (c) Linux Test Project, 2003-2023
* 07/2001 Ported by Wayne Boyer
* 05/2002 Ported by Andre Merlier
*/
/*\
@@ -36,7 +36,7 @@ static struct tcase {
int exp_errno;
} tcases[] = {
{NGROUPS + 1, &glist1, EINVAL},
- {NGROUPS, &glist2, EPERM},
+ {1, &glist2, EPERM},
{NGROUPS, &glist3, EFAULT},
};
@@ -56,32 +56,20 @@ static void verify_setgroups(unsigned int i)
static void setup(void)
{
- glist1 = SAFE_MALLOC((NGROUPS + 1) * sizeof(GID_T));
-
user_info = SAFE_GETPWNAM(TESTUSER);
- GID16_CHECK(user_info->pw_gid, getpwnam);
- glist2 = (GID_T *)&(user_info->pw_gid);
-
+ glist2[0] = 42;
glist3 = tst_get_bad_addr(NULL);
}
-static void cleanup(void)
-{
- if (glist1)
- free(glist1);
-}
-
static struct tst_test test = {
.test = verify_setgroups,
.tcnt = ARRAY_SIZE(tcases),
.bufs = (struct tst_buffers []) {
- {&glist1, .size = sizeof(GID_T)},
+ {&glist1, .size = sizeof(GID_T) * (NGROUPS + 1)},
{&glist2, .size = sizeof(GID_T)},
- {&glist3, .size = sizeof(GID_T)},
{&user_info, .size = sizeof(struct passwd)},
{},
},
.setup = setup,
- .cleanup = cleanup,
.needs_root = 1,
};
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2023-08-14 14:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-14 11:30 [LTP] [PATCH v3 1/3] syscalls/setgroups01: Convert to new API Yang Xu
2023-08-14 11:30 ` [LTP] [PATCH v3 2/3] syscalls/setgroups02: " Yang Xu
2023-08-14 14:15 ` Cyril Hrubis
2023-08-14 11:30 ` [LTP] [PATCH v3 3/3] syscalls/setgroups03: " Yang Xu
2023-08-14 14:49 ` Cyril Hrubis [this message]
2023-08-14 14:05 ` [LTP] [PATCH v3 1/3] syscalls/setgroups01: " Cyril Hrubis
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=ZNo-4xc1oQf7aJ2k@yuki \
--to=chrubis@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox