All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Jackson <ian.jackson@citrix.com>
To: George Dunlap <george.dunlap@citrix.com>
Cc: Anthony Perard <anthony.perard@citrix.com>,
	xen-devel@lists.xenproject.org, Wei Liu <wei.liu2@citrix.com>
Subject: Re: [PATCH 4/5] tools/dm_depriv: Add first cut RLIMITs
Date: Fri, 26 Oct 2018 15:02:43 +0100	[thread overview]
Message-ID: <23507.7811.731969.357295@mariner.uk.xensource.com> (raw)
In-Reply-To: <20181005165701.28030-4-george.dunlap@citrix.com>

George Dunlap writes ("[PATCH 4/5] tools/dm_depriv: Add first cut RLIMITs"):
> Limit the ability of a potentially compromised QEMU to consume system
> resources.  Key limits:
>  - RLIMIT_FSIZE (file size): 256KiB
>  - RLIMIT_NPROC (after uid changes to a unique uid)

Thanks.

> +static struct {
> +    int resource;
> +    rlim_t limit;
> +} rlimits[] = {
> +#define RLIMIT_ENTRY(r, l) \
> +    { .resource = r, .limit = l }
> +    /* Big enough for log files, not big enough for a DoS */
> +    RLIMIT_ENTRY(RLIMIT_FSIZE, 256*1024),
> +
> +    /* Shouldn't need any of these */
> +    RLIMIT_ENTRY(RLIMIT_NPROC, 0),
> +    RLIMIT_ENTRY(RLIMIT_CORE, 0),
> +    RLIMIT_ENTRY(RLIMIT_MSGQUEUE, 0),
> +    RLIMIT_ENTRY(RLIMIT_LOCKS, 0),
> +    RLIMIT_ENTRY(RLIMIT_MEMLOCK, 0),

I would have justified the values so this looked more tabular.

> +    /* Set various "easy" rlimits */
> +    for (i = 0; rlimits[i].resource != RLIMIT_NLIMITS; i++) {
> +        struct rlimit rlim;
> +
> +        rlim.rlim_cur = rlim.rlim_max = rlimits[i].limit;
> +        
> +        r = setrlimit(rlimits[i].resource, &rlim);
> +        if (r < 0) {
> +            LOGE(ERROR, "Setting rlimit %d to %lld failed\n",
> +                                  rlimits[i].resource,
> +                                  (unsigned long long)rlimits[i].limit);

I think you mean %llu not %lld.  With that last point changed,

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

Ian.

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

  reply	other threads:[~2018-10-26 14:03 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 [this message]
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
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=23507.7811.731969.357295@mariner.uk.xensource.com \
    --to=ian.jackson@citrix.com \
    --cc=anthony.perard@citrix.com \
    --cc=george.dunlap@citrix.com \
    --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.