lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANaxB-zuh-TvODuQ9pdycqGUyXfO4rXXtyFmXFh905+es6AOXQ@mail.gmail.com>
Date:   Tue, 20 Jul 2021 00:33:11 -0700
From:   Andrei Vagin <avagin@...il.com>
To:     Cyrill Gorcunov <gorcunov@...il.com>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Keno Fischer <keno@...iacomputing.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Dmitry Safonov <0x7f454c46@...il.com>,
        Kirill Tkhai <ktkhai@...tuozzo.com>,
        "Eric W. Biederman" <ebiederm@...ssion.com>
Subject: Re: [PATCH] prctl: allow to setup brk for et_dyn executables

On Thu, Jan 21, 2021 at 2:12 PM Cyrill Gorcunov <gorcunov@...il.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.
>
> Reported-by: Keno Fischer <keno@...iacomputing.com>
> Signed-off-by: Cyrill Gorcunov <gorcunov@...il.com>
> CC: Andrew Morton <akpm@...ux-foundation.org>
> CC: Dmitry Safonov <0x7f454c46@...il.com>
> CC: Andrey Vagin <avagin@...il.com>

Acked-by: Andrey Vagin <avagin@...il.com>
Fixes: bbdc6076d2e5 ("binfmt_elf: move brk out of mmap when doing
direct loader exec")

> CC: Kirill Tkhai <ktkhai@...tuozzo.com>
> CC: Eric W. Biederman <ebiederm@...ssion.com>
> ---
> Guys, take a look please once time permit. Hopefully I didn't
> miss something 'cause made this patch via code reading only.
>
> Andrey, do we still have a criu container which tests new kernels,
> right? Would be great to run criu tests with this patch applied
> to make sure everything is intact.

Sorry for the delay. I run tests and everything works as expected.

Thanks,
Andrei

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ