* Re: [LTP] [PATCH] Use the value of /proc/sys/kernel/overflowgid as overflowgid.
2015-06-02 10:03 [LTP] [PATCH] Use the value of /proc/sys/kernel/overflowgid as overflowgid Yuan Sun
@ 2015-06-02 7:41 ` Jan Stancek
0 siblings, 0 replies; 2+ messages in thread
From: Jan Stancek @ 2015-06-02 7:41 UTC (permalink / raw)
To: Yuan Sun; +Cc: ltp-list
----- Original Message -----
> From: "Yuan Sun" <sunyuan3@huawei.com>
> To: jstancek@redhat.com
> Cc: ltp-list@lists.sourceforge.net
> Sent: Tuesday, 2 June, 2015 12:03:33 PM
> Subject: [PATCH] Use the value of /proc/sys/kernel/overflowgid as overflowgid.
>
> Signed-off-by: Yuan Sun <sunyuan3@huawei.com>
Hi,
pushed, I have also remove unused global variable and made the 2 remaining static.
Regards,
Jan
> ---
> testcases/kernel/containers/userns/userns01.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/testcases/kernel/containers/userns/userns01.c
> b/testcases/kernel/containers/userns/userns01.c
> index 8c45774..15cde43 100644
> --- a/testcases/kernel/containers/userns/userns01.c
> +++ b/testcases/kernel/containers/userns/userns01.c
> @@ -14,7 +14,8 @@
> /*
> * Verify that:
> * If a user ID has no mapping inside the namespace, user ID and group
> - * ID will be the value defined in the file /proc/sys/kernel/overflowuid,
> 65534.
> + * ID will be the value defined in the file
> /proc/sys/kernel/overflowuid(65534)
> + * and /proc/sys/kernel/overflowgid(65534).
> */
>
> #define _GNU_SOURCE
> @@ -29,12 +30,14 @@
> #include "libclone.h"
> #include "userns_helper.h"
> #define OVERFLOWUIDPATH "/proc/sys/kernel/overflowuid"
> +#define OVERFLOWGIDPATH "/proc/sys/kernel/overflowgid"
>
> char *TCID = "user_namespace1";
> int TST_TOTAL = 1;
>
> char fullpath[BUFSIZ];
> long overflowuid;
> +long overflowgid;
>
> /*
> * child_fn1() - Inside a new user namespace
> @@ -48,7 +51,7 @@ static int child_fn1(void *arg)
> gid = getegid();
>
> tst_resm(TINFO, "USERNS test is running in a new user namespace.");
> - if (uid == overflowuid && gid == overflowuid) {
> + if (uid == overflowuid && gid == overflowgid) {
> printf("Got expected uid and gid\n");
> exit_val = 0;
> } else {
> @@ -63,6 +66,7 @@ static void setup(void)
> {
> check_newuser();
> SAFE_FILE_SCANF(NULL, OVERFLOWUIDPATH, "%ld", &overflowuid);
> + SAFE_FILE_SCANF(NULL, OVERFLOWGIDPATH, "%ld", &overflowgid);
> }
>
> int main(int argc, char *argv[])
> --
> 1.9.1
>
>
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 2+ messages in thread
* [LTP] [PATCH] Use the value of /proc/sys/kernel/overflowgid as overflowgid.
@ 2015-06-02 10:03 Yuan Sun
2015-06-02 7:41 ` Jan Stancek
0 siblings, 1 reply; 2+ messages in thread
From: Yuan Sun @ 2015-06-02 10:03 UTC (permalink / raw)
To: jstancek; +Cc: ltp-list
Signed-off-by: Yuan Sun <sunyuan3@huawei.com>
---
testcases/kernel/containers/userns/userns01.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/testcases/kernel/containers/userns/userns01.c b/testcases/kernel/containers/userns/userns01.c
index 8c45774..15cde43 100644
--- a/testcases/kernel/containers/userns/userns01.c
+++ b/testcases/kernel/containers/userns/userns01.c
@@ -14,7 +14,8 @@
/*
* Verify that:
* If a user ID has no mapping inside the namespace, user ID and group
- * ID will be the value defined in the file /proc/sys/kernel/overflowuid, 65534.
+ * ID will be the value defined in the file /proc/sys/kernel/overflowuid(65534)
+ * and /proc/sys/kernel/overflowgid(65534).
*/
#define _GNU_SOURCE
@@ -29,12 +30,14 @@
#include "libclone.h"
#include "userns_helper.h"
#define OVERFLOWUIDPATH "/proc/sys/kernel/overflowuid"
+#define OVERFLOWGIDPATH "/proc/sys/kernel/overflowgid"
char *TCID = "user_namespace1";
int TST_TOTAL = 1;
char fullpath[BUFSIZ];
long overflowuid;
+long overflowgid;
/*
* child_fn1() - Inside a new user namespace
@@ -48,7 +51,7 @@ static int child_fn1(void *arg)
gid = getegid();
tst_resm(TINFO, "USERNS test is running in a new user namespace.");
- if (uid == overflowuid && gid == overflowuid) {
+ if (uid == overflowuid && gid == overflowgid) {
printf("Got expected uid and gid\n");
exit_val = 0;
} else {
@@ -63,6 +66,7 @@ static void setup(void)
{
check_newuser();
SAFE_FILE_SCANF(NULL, OVERFLOWUIDPATH, "%ld", &overflowuid);
+ SAFE_FILE_SCANF(NULL, OVERFLOWGIDPATH, "%ld", &overflowgid);
}
int main(int argc, char *argv[])
--
1.9.1
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-06-02 7:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-02 10:03 [LTP] [PATCH] Use the value of /proc/sys/kernel/overflowgid as overflowgid Yuan Sun
2015-06-02 7:41 ` Jan Stancek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox