Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1379718imm; Thu, 23 Aug 2018 01:59:41 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyfTwEZ8LTJ/y7lgCHTjgNPZl68qc8eErS4HBDi2WnZMTDcUOsJhQxfdeSyyRDxozxwLezw X-Received: by 2002:a65:48c6:: with SMTP id o6-v6mr11546179pgs.99.1535014781777; Thu, 23 Aug 2018 01:59:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535014781; cv=none; d=google.com; s=arc-20160816; b=UGfTSMHAzTtblRVXbdx9Lr0m2ZYxoEOjjAwIdNpqpnq6ZZoqh2PaNSUGHcWQjeVhDD LX2Aoz5Zo+8dEpmbu/hRUI+Z0yRdOoulDUOL+uS6liebWEDAFJsk1+Nldm9GvCg+xikU y+7hizoK8xrIwBJaVLiKmFwPowc7aksQkZymNC8nMpbZ3L5jaENzZlHCa8/8KUl79B7B IS5U3MdfRpVJrEfyir7So4kLlrZ/yRrsclS5cLOPuwCCFme6KaIZtenSIbpKh+9rgPvc USy7Z8K3e2jUd0zt9JLnzvQb7uex7KPUsVikgmq/hvv91IuAPXBatn1+ubhpeJKfzL6/ /Jwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=BCNmXqcIxbm5zIjC75KM7oLydwwuvoK6+0p0lK6o+Hc=; b=Qo55d9JPu916ToaeA1kp+gc5XjKpaWXEPR6c4jlmaKwX2tK8KFcSBms7ciDGCnO2ng INENlSpwhhT8pkbm+S8rIr0/ZihFFs9TVoGTIhnmq2p3a7ZluVFrCEaB95C205ue4Nv5 RuEjdrNgvUw0wGXFMWYPpR0psEhVuY9hOEKwT1vKVoLCtr1adiDgHmC6onRkTEjr/myq xhdXRoL6uCu73G96tH8vx1ZNO45MB9Ciu38yOAZGhJSVq6TRPsU3bDH+MRPRbQHdtZJZ VfcJtG9YgcSgOaRrZsOe7epQjPlnWzSj3EdXf+6lEXG/nZARLo39RY/lrXYkYjqNiWL5 zHww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s59-v6si760884plb.341.2018.08.23.01.59.25; Thu, 23 Aug 2018 01:59:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728245AbeHWMZ6 (ORCPT + 99 others); Thu, 23 Aug 2018 08:25:58 -0400 Received: from mx2.suse.de ([195.135.220.15]:38050 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726966AbeHWMZ5 (ORCPT ); Thu, 23 Aug 2018 08:25:57 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 38C8EAED6; Thu, 23 Aug 2018 08:57:15 +0000 (UTC) Date: Thu, 23 Aug 2018 10:57:14 +0200 From: Michal Hocko To: Nadav Amit Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , stable@vger.kernel.org Subject: Re: [PATCH] mm: respect arch_dup_mmap() return value Message-ID: <20180823085714.GY29735@dhcp22.suse.cz> References: <20180823051229.211856-1-namit@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180823051229.211856-1-namit@vmware.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 22-08-18 22:12:29, Nadav Amit wrote: > Commit d70f2a14b72a4 ("include/linux/sched/mm.h: uninline > mmdrop_async(), etc") ignored the return value of arch_dup_mmap(). As a > result, on x86, a failure to duplicate the LDT (e.g., due to memory > allocation error), would leave the duplicated memory mapping in an > inconsistent state. > > Fix by regarding the return value, as it was before the change. Ohh, well spotted! I have a vague recollection I didn't really like the patch. For other reasons. I didn't get to review it properly back then because I didn't have much time and I didn't have a high motivation because I simple disagreed with the patch. > Fixes: d70f2a14b72a4 ("include/linux/sched/mm.h: uninline mmdrop_async(), etc") > Cc: Andrew Morton > Cc: stable@vger.kernel.org > Signed-off-by: Nadav Amit Acked-by: Michal Hocko Thanks! > --- > kernel/fork.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/kernel/fork.c b/kernel/fork.c > index 1b27babc4c78..4527d1d331de 100644 > --- a/kernel/fork.c > +++ b/kernel/fork.c > @@ -549,8 +549,7 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm, > goto out; > } > /* a new mm has just been created */ > - arch_dup_mmap(oldmm, mm); > - retval = 0; > + retval = arch_dup_mmap(oldmm, mm); > out: > up_write(&mm->mmap_sem); > flush_tlb_mm(oldmm); > -- > 2.17.1 > -- Michal Hocko SUSE Labs