[Fedora 02/19] mm: vm_brk(), align the length to page boundary

Vivek Goyal vgoyal at redhat.com
Thu Sep 5 14:03:47 UTC 2013


On Thu, Sep 05, 2013 at 08:26:26AM -0400, Josh Boyer wrote:
> On Wed, Sep 4, 2013 at 5:24 PM, Vivek Goyal <vgoyal at redhat.com> wrote:
> > I was writing some code where I was locking all pages of a process
> > during exec() time by setting VM_LOCKED flag in mm->def_flags. But
> > that lead to errors because length of mapping is not page aligned.
> >
> > login: [  174.669002] INFO: rcu_sched self-detected stall on CPU { 2}  (t=60000
> > jiffies g=2580 c=2579 q=1085)
> > [  174.669002] Pid: 4894, comm: kexec Not tainted 3.9.0-rc6+ #243
> > [  174.669002] Call Trace:
> > [  174.669002]  <IRQ>  [<ffffffff810c413a>] rcu_check_callbacks+0x21a/0x760
> > [  174.669002]  [<ffffffff810c7c0c>] ? acct_account_cputime+0x1c/0x20
> > [  174.669002]  [<ffffffff8104fd08>] update_process_times+0x48/0x80
> > [  174.669002]  [<ffffffff810913dd>] tick_sched_handle+0x3d/0x50
> > [  174.669002]  [<ffffffff810915e5>] tick_sched_timer+0x45/0x70
> > [  174.669002]  [<ffffffff81066951>] __run_hrtimer+0x81/0x220
> > [  174.669002]  [<ffffffff810915a0>] ? tick_nohz_handler+0xa0/0xa0
> > [  174.669002]  [<ffffffff8108ae0c>] ? ktime_get_update_offsets+0x4c/0xd0
> > [  174.669002]  [<ffffffff81067297>] hrtimer_interrupt+0xf7/0x250
> > [  174.669002]  [<ffffffff81886739>] smp_apic_timer_interrupt+0x69/0x99
> > [  174.669002]  [<ffffffff818859ca>] apic_timer_interrupt+0x6a/0x70
> > [  174.669002]  <EOI>  [<ffffffff8111e557>] ?  __mlock_vma_pages_range+0x57/0x70
> > [  174.669002]  [<ffffffff8111e568>] ? __mlock_vma_pages_range+0x68/0x70
> > [  174.669002]  [<ffffffff8111ea01>] __mm_populate+0x71/0x140
> > [  174.669002]  [<ffffffff81121b5f>] vm_brk+0x7f/0xa0
> > [  174.669002]  [<ffffffff81199633>] load_elf_binary+0x1a73/0x1b10
> > [  174.669002]  [<ffffffff812d25a5>] ? ima_bprm_check+0x55/0x70
> > [  174.669002]  [<ffffffff8114890a>] search_binary_handler+0x12a/0x3b0
> > [  174.669002]  [<ffffffff81197bc0>] ? load_elf_library+0x210/0x210
> > [  174.669002]  [<ffffffff8114aa00>] do_execve_common+0x500/0x5c0
> > [  174.669002]  [<ffffffff8114aaf7>] do_execve+0x37/0x40
> > [  174.669002]  [<ffffffff8114ad9d>] sys_execve+0x3d/0x60
> > [  174.669002]  [<ffffffff81885379>] stub_execve+0x69/0xa0
> >
> > Thanks to Michel and Hugh Dickens that they identified that __mm_populate()
> > will loop forever if passed in length is not page aligned. Similar
> > issues related to mmap() have already been fixed. This patch fixes
> > vm_brk().
> >
> > sys_brk() seems to be only other caller of do_brk() and sys_brk()
> > already aligns lenth to page boundary. So looks like page alignment
> > logic can be removed from do_brk().
> >
> > Signed-off-by: Michel Lespinasse <walken at google.com>
> > Signed-off-by: Vivek Goyal <vgoyal at redhat.com>
> 
> I'm surprised this hasn't been submitted upstream yet.  It seems
> orthogonal to the rest of them, and like something we'd want fixed
> upstream ASAP.
> 
> Did Michel or Hugh think there was an issue with doing the changes
> this way?  I can't seem to find anything on the lists, but I'm curious
> why they didn't submit the fix themselves.

Michel was supposed to send it upstream. I had pinged him twice and
nothing happened. 

There was no urgency on this as none of the other path hit this condition.

Thanks
Vivek


More information about the kernel mailing list