public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Jan Stancek <jstancek@redhat.com>
To: Yuan Sun <sunyuan3@huawei.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] userns02: always set/check GID mapping
Date: Mon, 20 Jul 2015 08:17:29 -0400 (EDT)	[thread overview]
Message-ID: <1723241423.662829.1437394649041.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <1437394221-22320-1-git-send-email-sunyuan3@huawei.com>





----- Original Message -----
> From: "Yuan Sun" <sunyuan3@huawei.com>
> To: jstancek@redhat.com
> Cc: ltp-list@lists.sourceforge.net
> Sent: Monday, 20 July, 2015 2:10:21 PM
> Subject: [PATCH] userns02: always set/check GID mapping
> 
> Signed-off-by: Yuan Sun <sunyuan3@huawei.com>

Pushed with following text added to commit message:
    The test previously relied on fact that it can always set GID mapping.
    To allow this for unprivileged users on kernels >= 3.19, we have to
    disable setgroups first.

Thanks,
Jan

> ---
>  testcases/kernel/containers/userns/userns02.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/testcases/kernel/containers/userns/userns02.c
> b/testcases/kernel/containers/userns/userns02.c
> index 3bcb97d..e1677b6 100644
> --- a/testcases/kernel/containers/userns/userns02.c
> +++ b/testcases/kernel/containers/userns/userns02.c
> @@ -62,7 +62,6 @@ static int child_fn1(void)
>  static void setup(void)
>  {
>  	check_newuser();
> -
>  	tst_tmpdir();
>  	TST_CHECKPOINT_INIT(NULL);
>  }
> @@ -96,6 +95,14 @@ int main(int argc, char *argv[])
>  		fd = SAFE_OPEN(cleanup, path, O_WRONLY, 0644);
>  		SAFE_WRITE(cleanup, 1, fd, content, strlen(content));
>  		SAFE_CLOSE(cleanup, fd);
> +
> +		if (access("/proc/self/setgroups", F_OK) == 0) {
> +			sprintf(path, "/proc/%d/setgroups", childpid);
> +			fd = SAFE_OPEN(cleanup, path, O_WRONLY, 0644);
> +			SAFE_WRITE(cleanup, 1, fd, "deny", 4);
> +			SAFE_CLOSE(cleanup, fd);
> +		}
> +
>  		sprintf(path, "/proc/%d/gid_map", childpid);
>  		sprintf(content, "100 %d 1", parentgid);
>  		fd = SAFE_OPEN(cleanup, path, O_WRONLY, 0644);
> --
> 1.9.1
> 
> 

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

           reply	other threads:[~2015-07-21 22:25 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <1437394221-22320-1-git-send-email-sunyuan3@huawei.com>]

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=1723241423.662829.1437394649041.JavaMail.zimbra@redhat.com \
    --to=jstancek@redhat.com \
    --cc=ltp-list@lists.sourceforge.net \
    --cc=sunyuan3@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