All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Keno Fischer <keno@juliacomputing.com>,
	Dmitry Safonov <0x7f454c46@gmail.com>,
	Andrey Vagin <avagin@gmail.com>,
	Kirill Tkhai <ktkhai@virtuozzo.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>
Subject: Re: [PATCH] prctl: allow to setup brk for et_dyn executables
Date: Tue, 20 Jul 2021 14:51:48 -0700	[thread overview]
Message-ID: <20210720145148.cdcfa3210e39e88a591af12b@linux-foundation.org> (raw)
In-Reply-To: <20210121221207.GB2174@grain>

On Fri, 22 Jan 2021 01:12:07 +0300 Cyrill Gorcunov <gorcunov@gmail.com> wrote:

> Keno Fischer reported that when a binray loaded via
> ld-linux-x the prctl(PR_SET_MM_MAP) doesn't allow to
> setup brk value because it lays before mm:end_data.
> 
> For example a test program shows
> 
>  | # ~/t
>  |
>  | start_code      401000
>  | end_code        401a15
>  | start_stack     7ffce4577dd0
>  | start_data	   403e10
>  | end_data        40408c
>  | start_brk	   b5b000
>  | sbrk(0)         b5b000
> 
> and when executed via ld-linux
> 
>  | # /lib64/ld-linux-x86-64.so.2 ~/t
>  |
>  | start_code      7fc25b0a4000
>  | end_code        7fc25b0c4524
>  | start_stack     7fffcc6b2400
>  | start_data	   7fc25b0ce4c0
>  | end_data        7fc25b0cff98
>  | start_brk	   55555710c000
>  | sbrk(0)         55555710c000
> 
> This of course prevent criu from restoring such programs.
> Looking into how kernel operates with brk/start_brk inside
> brk() syscall I don't see any problem if we allow to setup
> brk/start_brk without checking for end_data. Even if someone
> pass some weird address here on a purpose then the worst
> possible result will be an unexpected unmapping of existing
> vma (own vma, since prctl works with the callers memory) but
> test for RLIMIT_DATA is still valid and a user won't be able
> to gain more memory in case of expanding VMAs via new values
> shipped with prctl call.

So...  do you recall why you added that test originally?

This is under prctl(CAP_SET_MM), yes?  What capabilities does this
require?


  parent reply	other threads:[~2021-07-20 21:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-21 22:12 Cyrill Gorcunov
2021-01-22  9:17 ` Kirill Tkhai
2021-07-20  7:33 ` Andrei Vagin
2021-07-20 13:54   ` Cyrill Gorcunov
2021-07-20 21:51 ` Andrew Morton [this message]
2021-07-20 22:25   ` Cyrill Gorcunov

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=20210720145148.cdcfa3210e39e88a591af12b@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=0x7f454c46@gmail.com \
    --cc=avagin@gmail.com \
    --cc=ebiederm@xmission.com \
    --cc=gorcunov@gmail.com \
    --cc=keno@juliacomputing.com \
    --cc=ktkhai@virtuozzo.com \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [PATCH] prctl: allow to setup brk for et_dyn executables' \
    /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

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.