All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony PERARD <anthony.perard@citrix.com>
To: George Dunlap <george.dunlap@citrix.com>
Cc: Ross Lagerwall <ross.lagerwall@citrix.com>,
	xen-devel@lists.xenproject.org,
	Stefano Stabellini <sstabellini@kernel.org>,
	Wei Liu <wei.liu2@citrix.com>,
	Ian Jackson <ian.jackson@citrix.com>
Subject: Re: [PATCH 5/5] RFC: test/depriv: Add a tool to check process-level depriv
Date: Mon, 8 Oct 2018 17:28:24 +0100	[thread overview]
Message-ID: <20181008162824.GD1331@perard.uk.xensource.com> (raw)
In-Reply-To: <20181005165701.28030-5-george.dunlap@citrix.com>

On Fri, Oct 05, 2018 at 05:57:01PM +0100, George Dunlap wrote:
> +# TEST: Process / group id
> +#
> +# Read /proc/<qpid>/status, checking Uid and Gid lines
> +#
> +# Uid should be xen-qemuuser-range-base+$domid
> +# Gid should be 65534 ("nobody")

That is wrong. Gid doesn't have to be nobody. gid can be chosen when
creating the base user id. (And I'm pretty sure "nobody" should be
avoided.)

> +# FIXME: deal with other UID configurations?
> +echo -n "Process UID: "
> +tgt_uid=$(id -u xen-qemuuser-range-base)
> +tgt_uid=$(( $tgt_uid + $domid ))
> +
> +# Example input:
> +# Uid:	1193	1193	1193	1193
> +input=$(grep ^Uid: /proc/$dmpid/status)
> +if [[ "$input" =~ ^Uid:[[:space:]]+([0-9]+)[[:space:]]+([0-9]+)[[:space:]]+([0-9]+)[[:space:]]+([0-9]+)$ ]] ; then
> +    result="PASSED"
> +    for i in {1..4}; do
> +	if [[ "${BASH_REMATCH[$i]}" != "$tgt_uid" ]] ; then
> +	    result="FAILED"
> +	    failed="true"
> +	    break
> +	fi
> +    done
> +else
> +    result="FAILED"
> +    failed="true"
> +fi
> +echo $result
> +
> +# Example input:
> +# Gid:	10020	10020	10020	10020
> +echo -n "Process GID: "
> +tgt_gid=$(id -g nobody)

This should be `id -g xen-qemuuser-range-base`.

-- 
Anthony PERARD

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2018-10-08 16:28 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-05 16:56 [PATCH 1/5] docs/qemu-deprivilege: Revise and update with status and future plans George Dunlap
2018-10-05 16:56 ` [PATCH 2/5] tools/dm_restrict: Ask QEMU to chroot George Dunlap
2018-10-26 13:52   ` Ian Jackson
2018-10-05 16:56 ` [PATCH 3/5] tools/dm_restrict: Unshare mount and IPC namespaces on Linux George Dunlap
2018-10-26 14:00   ` Ian Jackson
2018-10-26 16:18     ` George Dunlap
2018-10-05 16:57 ` [PATCH 4/5] tools/dm_depriv: Add first cut RLIMITs George Dunlap
2018-10-26 14:02   ` Ian Jackson
2018-10-26 16:31     ` George Dunlap
2018-10-05 16:57 ` [PATCH 5/5] RFC: test/depriv: Add a tool to check process-level depriv George Dunlap
2018-10-08 16:28   ` Anthony PERARD [this message]
2018-10-08 16:44     ` Ian Jackson
2018-10-26 15:28     ` George Dunlap
2018-10-29 10:16       ` Ian Jackson
2018-10-26 14:06   ` Ian Jackson
2018-10-26 14:24     ` George Dunlap
2018-10-26 14:27       ` Ian Jackson
2018-10-26 12:45 ` [PATCH 1/5] docs/qemu-deprivilege: Revise and update with status and future plans George Dunlap
2018-10-26 13:45 ` Ian Jackson
     [not found]   ` <bdf85f15-4eb7-a1b1-75cf-b31cae07010b@citrix.com>
2018-11-02 11:50     ` George Dunlap

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=20181008162824.GD1331@perard.uk.xensource.com \
    --to=anthony.perard@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=ian.jackson@citrix.com \
    --cc=ross.lagerwall@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /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.