From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752828AbcCKMmQ (ORCPT ); Fri, 11 Mar 2016 07:42:16 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:33369 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752261AbcCKMmE (ORCPT ); Fri, 11 Mar 2016 07:42:04 -0500 Date: Fri, 11 Mar 2016 13:42:01 +0100 From: Michal Hocko To: Vlastimil Babka Cc: LKML , Andrew Morton , linux-mm@kvack.org, Alex Deucher , Alex Thorlton , Andrea Arcangeli , Andy Lutomirski , Benjamin LaHaise , Christian =?iso-8859-1?Q?K=F6nig?= , Daniel Vetter , Dave Hansen , David Airlie , Davidlohr Bueso , David Rientjes , "H . Peter Anvin" , Hugh Dickins , Ingo Molnar , Johannes Weiner , "Kirill A . Shutemov" , Konstantin Khlebnikov , linux-arch@vger.kernel.org, Mel Gorman , Oleg Nesterov , Peter Zijlstra , Petr Cermak , Thomas Gleixner , Ingo Molnar , Alexander Viro Subject: Re: [PATCH 04/18] mm, aout: handle vm_brk failures Message-ID: <20160311124201.GK27701@dhcp22.suse.cz> References: <1456752417-9626-1-git-send-email-mhocko@kernel.org> <1456752417-9626-5-git-send-email-mhocko@kernel.org> <56E29ECA.5050809@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <56E29ECA.5050809@suse.cz> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 11-03-16 11:32:42, Vlastimil Babka wrote: > On 02/29/2016 02:26 PM, Michal Hocko wrote: > >From: Michal Hocko > > > >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 > >Cc: Ingo Molnar > >Cc: "H. Peter Anvin" > >Cc: Alexander Viro > >Signed-off-by: Michal Hocko > > Acked--by: Vlastimil Babka 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