Re: [RFC PATCH] elf: enforce MAP_FIXED on overlaying elf segments (was: Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE)

2018-02-14 Thread Khalid Aziz
On Tue, 2018-02-13 at 11:04 +0100, Michal Hocko wrote: > > From 97e7355a6dc31a73005fa806566a57eb5c38032b Mon Sep 17 00:00:00 > 2001 > From: Michal Hocko > Date: Tue, 13 Feb 2018 10:50:53 +0100 > Subject: [PATCH] elf: enforce MAP_FIXED on overlaying elf segments > > Anshuman has reported that som

[RFC PATCH] elf: enforce MAP_FIXED on overlaying elf segments (was: Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE)

2018-02-13 Thread Michal Hocko
On Fri 02-02-18 07:55:14, Kees Cook wrote: > On Fri, Feb 2, 2018 at 12:40 AM, Michal Hocko wrote: > > On Thu 01-02-18 14:10:07, Michal Hocko wrote: > > Thanks a lot to Michael Matz for his background. He has pointed me to > > the following two segments from your binary[1] > > LOAD 0x00

Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE

2018-02-13 Thread Michal Hocko
On Tue 13-02-18 12:19:18, Anshuman Khandual wrote: > On 02/01/2018 07:18 PM, Michal Hocko wrote: > > On Thu 01-02-18 08:43:34, Anshuman Khandual wrote: > > [...] > >> $dmesg | grep elf_brk > >> [9.571192] elf_brk 10030328 elf_bss 1003 > >> > >> static int load_elf_binary(struct linux_binprm

Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE

2018-02-12 Thread Anshuman Khandual
On 02/01/2018 07:18 PM, Michal Hocko wrote: > On Thu 01-02-18 08:43:34, Anshuman Khandual wrote: > [...] >> $dmesg | grep elf_brk >> [9.571192] elf_brk 10030328 elf_bss 1003 >> >> static int load_elf_binary(struct linux_binprm *bprm) >> - >> >> if (unlikely (elf_brk

Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE

2018-02-12 Thread Anshuman Khandual
On 02/12/2018 08:18 PM, Michal Hocko wrote: > Did you have any chance to test the following hack, Anshuman? The system has some issues at the moment, will get back on this.

Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE

2018-02-12 Thread Michal Hocko
Did you have any chance to test the following hack, Anshuman? On Thu 01-02-18 14:48:29, Michal Hocko wrote: [...] > Just a blind shot... Does the following make any difference? > --- > diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c > index 021fe78998ea..04b24d00c911 100644 > --- a/fs/binfmt_elf.c

Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE

2018-02-01 Thread Kees Cook
On Fri, Feb 2, 2018 at 12:48 AM, Michal Hocko wrote: > On Thu 01-02-18 08:43:34, Anshuman Khandual wrote: > [...] >> $dmesg | grep elf_brk >> [9.571192] elf_brk 10030328 elf_bss 1003 >> >> static int load_elf_binary(struct linux_binprm *bprm) >> - >> >> if (unlike

Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE

2018-02-01 Thread Kees Cook
On Fri, Feb 2, 2018 at 12:40 AM, Michal Hocko wrote: > On Thu 01-02-18 14:10:07, Michal Hocko wrote: > Thanks a lot to Michael Matz for his background. He has pointed me to > the following two segments from your binary[1] > LOAD 0x 0x1000 0x1000

Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE

2018-02-01 Thread Michal Hocko
On Thu 01-02-18 08:43:34, Anshuman Khandual wrote: [...] > $dmesg | grep elf_brk > [9.571192] elf_brk 10030328 elf_bss 1003 > > static int load_elf_binary(struct linux_binprm *bprm) > - > > if (unlikely (elf_brk > elf_bss)) { > unsigned long

Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE

2018-02-01 Thread Michal Hocko
On Thu 01-02-18 14:10:07, Michal Hocko wrote: > [CC Kees and Linus - for your background, we are talking about failures > http://lkml.kernel.org/r/20180107090229.gb24...@dhcp22.suse.cz > introduced by > http://lkml.kernel.org/r/20171213092550.2774-3-mho...@kernel.org > Debugging has shown that

Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE

2018-02-01 Thread Michal Hocko
[CC Kees and Linus - for your background, we are talking about failures http://lkml.kernel.org/r/20180107090229.gb24...@dhcp22.suse.cz introduced by http://lkml.kernel.org/r/20171213092550.2774-3-mho...@kernel.org Debugging has shown that load_elf_binary tries to map elf segment over an existin

Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE

2018-01-31 Thread Anshuman Khandual
On 01/31/2018 06:49 PM, Michal Hocko wrote: > On Wed 31-01-18 10:35:38, Anshuman Khandual wrote: >> On 01/30/2018 03:12 PM, Michal Hocko wrote: > [...] >>> Anshuman, could you try to run >>> sed 's@^@@' /proc/self/smaps >>> on a system with MAP_FIXED_NOREPLACE reverted? >>> >> After reverting the f

Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE

2018-01-31 Thread Michal Hocko
On Wed 31-01-18 10:35:38, Anshuman Khandual wrote: > On 01/30/2018 03:12 PM, Michal Hocko wrote: [...] > > Anshuman, could you try to run > > sed 's@^@@' /proc/self/smaps > > on a system with MAP_FIXED_NOREPLACE reverted? > > > > After reverting the following commits from mmotm-2018-01-25-16-20 t

Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE

2018-01-30 Thread Anshuman Khandual
On 01/30/2018 03:12 PM, Michal Hocko wrote: > On Tue 30-01-18 14:35:12, Michael Ellerman wrote: >> Michal Hocko writes: >> >>> On Mon 29-01-18 11:02:09, Anshuman Khandual wrote: On 01/29/2018 08:17 AM, Anshuman Khandual wrote: > On 01/26/2018 07:34 PM, Michal Hocko wrote: >> On Fri 26

Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE

2018-01-30 Thread Michal Hocko
On Tue 30-01-18 14:35:12, Michael Ellerman wrote: > Michal Hocko writes: > > > On Mon 29-01-18 11:02:09, Anshuman Khandual wrote: > >> On 01/29/2018 08:17 AM, Anshuman Khandual wrote: > >> > On 01/26/2018 07:34 PM, Michal Hocko wrote: > >> >> On Fri 26-01-18 18:04:27, Anshuman Khandual wrote: > >

Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE

2018-01-29 Thread Michal Hocko
On Mon 29-01-18 11:02:09, Anshuman Khandual wrote: > On 01/29/2018 08:17 AM, Anshuman Khandual wrote: > > On 01/26/2018 07:34 PM, Michal Hocko wrote: > >> On Fri 26-01-18 18:04:27, Anshuman Khandual wrote: > >> [...] > >>> I tried to instrument mmap_region() for a single instance of 'sed' > >>> bin

Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE

2018-01-28 Thread Anshuman Khandual
On 01/29/2018 08:17 AM, Anshuman Khandual wrote: > On 01/26/2018 07:34 PM, Michal Hocko wrote: >> On Fri 26-01-18 18:04:27, Anshuman Khandual wrote: >> [...] >>> I tried to instrument mmap_region() for a single instance of 'sed' >>> binary and traced all it's VMA creation. But there is no trace whe

Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE

2018-01-28 Thread Anshuman Khandual
On 01/26/2018 07:34 PM, Michal Hocko wrote: > On Fri 26-01-18 18:04:27, Anshuman Khandual wrote: > [...] >> I tried to instrument mmap_region() for a single instance of 'sed' >> binary and traced all it's VMA creation. But there is no trace when >> that 'anon' VMA got created which suddenly shows u

Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE

2018-01-26 Thread Michal Hocko
On Fri 26-01-18 18:04:27, Anshuman Khandual wrote: [...] > I tried to instrument mmap_region() for a single instance of 'sed' > binary and traced all it's VMA creation. But there is no trace when > that 'anon' VMA got created which suddenly shows up during subsequent > elf_map() call eventually fai

Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE

2018-01-26 Thread Anshuman Khandual
On 01/24/2018 02:35 PM, Michal Hocko wrote: > On Wed 24-01-18 10:39:41, Anshuman Khandual wrote: >> On 01/23/2018 09:36 PM, Michal Hocko wrote: >>> On Tue 23-01-18 21:28:28, Anshuman Khandual wrote: On 01/23/2018 06:15 PM, Michal Hocko wrote: > On Tue 23-01-18 16:55:18, Anshuman Khandual w

Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE

2018-01-24 Thread Michal Hocko
On Wed 24-01-18 10:39:41, Anshuman Khandual wrote: > On 01/23/2018 09:36 PM, Michal Hocko wrote: > > On Tue 23-01-18 21:28:28, Anshuman Khandual wrote: > >> On 01/23/2018 06:15 PM, Michal Hocko wrote: > >>> On Tue 23-01-18 16:55:18, Anshuman Khandual wrote: > On 01/17/2018 01:37 PM, Michal Hoc

Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE

2018-01-23 Thread Anshuman Khandual
On 01/23/2018 09:36 PM, Michal Hocko wrote: > On Tue 23-01-18 21:28:28, Anshuman Khandual wrote: >> On 01/23/2018 06:15 PM, Michal Hocko wrote: >>> On Tue 23-01-18 16:55:18, Anshuman Khandual wrote: On 01/17/2018 01:37 PM, Michal Hocko wrote: > On Thu 11-01-18 15:38:37, Anshuman Khandual w

Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE

2018-01-23 Thread Michal Hocko
On Tue 23-01-18 21:28:28, Anshuman Khandual wrote: > On 01/23/2018 06:15 PM, Michal Hocko wrote: > > On Tue 23-01-18 16:55:18, Anshuman Khandual wrote: > >> On 01/17/2018 01:37 PM, Michal Hocko wrote: > >>> On Thu 11-01-18 15:38:37, Anshuman Khandual wrote: > On 01/09/2018 09:43 PM, Michal Hoc

Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE

2018-01-23 Thread Anshuman Khandual
On 01/23/2018 06:15 PM, Michal Hocko wrote: > On Tue 23-01-18 16:55:18, Anshuman Khandual wrote: >> On 01/17/2018 01:37 PM, Michal Hocko wrote: >>> On Thu 11-01-18 15:38:37, Anshuman Khandual wrote: On 01/09/2018 09:43 PM, Michal Hocko wrote: >>> [...] > Did you manage to catch _who_ is re

Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE

2018-01-23 Thread Michal Hocko
On Tue 23-01-18 16:55:18, Anshuman Khandual wrote: > On 01/17/2018 01:37 PM, Michal Hocko wrote: > > On Thu 11-01-18 15:38:37, Anshuman Khandual wrote: > >> On 01/09/2018 09:43 PM, Michal Hocko wrote: > > [...] > >>> Did you manage to catch _who_ is requesting that anonymous mapping? Do > >>> you n

Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE

2018-01-23 Thread Anshuman Khandual
On 01/17/2018 01:37 PM, Michal Hocko wrote: > On Thu 11-01-18 15:38:37, Anshuman Khandual wrote: >> On 01/09/2018 09:43 PM, Michal Hocko wrote: > [...] >>> Did you manage to catch _who_ is requesting that anonymous mapping? Do >>> you need a help with the debugging patch? >> >> Not yet, will get ba

Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE

2018-01-17 Thread Michal Hocko
On Thu 11-01-18 15:38:37, Anshuman Khandual wrote: > On 01/09/2018 09:43 PM, Michal Hocko wrote: [...] > > Did you manage to catch _who_ is requesting that anonymous mapping? Do > > you need a help with the debugging patch? > > Not yet, will get back on this. ping? -- Michal Hocko SUSE Labs

Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE

2018-01-11 Thread Anshuman Khandual
On 01/09/2018 09:43 PM, Michal Hocko wrote: > On Tue 09-01-18 17:18:38, Anshuman Khandual wrote: >> On 01/09/2018 03:42 AM, Michael Ellerman wrote: >>> Anshuman Khandual writes: >>> On 01/07/2018 04:56 PM, Michael Ellerman wrote: > Michal Hocko writes: > >> On Sun 07-01-18 12:19:

Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE

2018-01-09 Thread Michal Hocko
On Tue 09-01-18 17:18:38, Anshuman Khandual wrote: > On 01/09/2018 03:42 AM, Michael Ellerman wrote: > > Anshuman Khandual writes: > > > >> On 01/07/2018 04:56 PM, Michael Ellerman wrote: > >>> Michal Hocko writes: > >>> > On Sun 07-01-18 12:19:32, Anshuman Khandual wrote: > > On 01/05/

Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE

2018-01-09 Thread Anshuman Khandual
On 01/09/2018 03:42 AM, Michael Ellerman wrote: > Anshuman Khandual writes: > >> On 01/07/2018 04:56 PM, Michael Ellerman wrote: >>> Michal Hocko writes: >>> On Sun 07-01-18 12:19:32, Anshuman Khandual wrote: > On 01/05/2018 02:16 PM, Michal Hocko wrote: [...] >> Could you give

Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE

2018-01-08 Thread Michael Ellerman
Anshuman Khandual writes: > On 01/07/2018 04:56 PM, Michael Ellerman wrote: >> Michal Hocko writes: >> >>> On Sun 07-01-18 12:19:32, Anshuman Khandual wrote: On 01/05/2018 02:16 PM, Michal Hocko wrote: >>> [...] > Could you give us more information about the failure please. Debugging >

Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE

2018-01-07 Thread Anshuman Khandual
On 01/07/2018 04:56 PM, Michael Ellerman wrote: > Michal Hocko writes: > >> On Sun 07-01-18 12:19:32, Anshuman Khandual wrote: >>> On 01/05/2018 02:16 PM, Michal Hocko wrote: >> [...] Could you give us more information about the failure please. Debugging patch from http://lkml.kernel.or

Re: ppc elf_map breakage with MAP_FIXED_NOREPLACE (was: Re: mmotm 2018-01-04-16-19 uploaded)

2018-01-07 Thread Michael Ellerman
Michal Hocko writes: > On Sun 07-01-18 12:19:32, Anshuman Khandual wrote: >> On 01/05/2018 02:16 PM, Michal Hocko wrote: > [...] >> > Could you give us more information about the failure please. Debugging >> > patch from http://lkml.kernel.org/r/20171218091302.gl16...@dhcp22.suse.cz >> > should h

ppc elf_map breakage with MAP_FIXED_NOREPLACE (was: Re: mmotm 2018-01-04-16-19 uploaded)

2018-01-07 Thread Michal Hocko
On Sun 07-01-18 12:19:32, Anshuman Khandual wrote: > On 01/05/2018 02:16 PM, Michal Hocko wrote: [...] > > Could you give us more information about the failure please. Debugging > > patch from http://lkml.kernel.org/r/20171218091302.gl16...@dhcp22.suse.cz > > should help to see what is the clashing