Re: [PATCH 04/18] mm, aout: handle vm_brk failures

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri 11-03-16 11:32:42, Vlastimil Babka wrote:
> On 02/29/2016 02:26 PM, Michal Hocko wrote:
> >From: Michal Hocko <mhocko@xxxxxxxx>
> >
> >vm_brk is allowed to fail but load_aout_binary simply ignores the error
> >and happily continues. I haven't noticed any problem from that in real
> >life but later patches will make the failure more likely because
> >vm_brk will become killable (resp. mmap_sem for write waiting will become
> >killable) so we should be more careful now.
> >
> >The error handling should be quite straightforward because there are
> >calls to vm_mmap which check the error properly already. The only
> >notable exception is set_brk which is called after beyond_if label.
> >But nothing indicates that we cannot move it above set_binfmt as the two
> >do not depend on each other and fail before we do set_binfmt and alter
> >reference counting.
> >
> >Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> >Cc: Ingo Molnar <mingo@xxxxxxxxxx>
> >Cc: "H. Peter Anvin" <hpa@xxxxxxxxx>
> >Cc: Alexander Viro <viro@xxxxxxxxxxxxxxxxxx>
> >Signed-off-by: Michal Hocko <mhocko@xxxxxxxx>
> 
> Acked--by: Vlastimil Babka <vbabka@xxxxxxx>

thanks!
> 
> [...]
> 
> >@@ -378,7 +381,9 @@ static int load_aout_library(struct file *file)
> >  			       "N_TXTOFF is not page aligned. Please convert library: %pD\n",
> >  			       file);
> >  		}
> >-		vm_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss);
> >+		retval = vm_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss);
> >+		if (IS_ERR_VALUE(retval))
> >+			goto out;
> >  		
> 
> You could have removed the extra whitespace on the line above, which my vim
> so prominently highlights :)

Fixed

> 
> >  		read_code(file, start_addr, N_TXTOFF(ex),
> >  			  ex.a_text + ex.a_data);
> >

-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]