Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3597847yba; Tue, 23 Apr 2019 06:37:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqzlPHAFsV9U9i558UGYGbe9/qXOs8oL1/kfYNICJpXgichVHGwWI9n7vSCiWKzzXVT2toKV X-Received: by 2002:a17:902:2aa8:: with SMTP id j37mr26620603plb.164.1556026644135; Tue, 23 Apr 2019 06:37:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556026644; cv=none; d=google.com; s=arc-20160816; b=iQ3KDYN9y/xzLhPFfrON+oApDppOzkPdeo4jtPNO4HW2Xwbg2nDqpphWEe7bl5Kv0p B9+YPAMy1Ou0F6cO3BUzf7jt6SvV6cjr+2kTsHEi1qoQDp5d1MQPf+CSmpO0lWHyaxmt rK6HSG4naTYoEYAYQGMJA7981Gvpnhm14m7Oj0kHLeQcpCkW7wjpIi0JaORlE3mlcDsR Q8NFsivrwpThB7BRLCIM+c53b+PDkJLpqI3rcarujo6fW2nOVRZs3WNs4Oo5ubS5QaF8 HsBKk0xyu3WrD9sAkJXdPc2imoyrnzqHxUqG7Bdjzqhbm1oYy/xG5gporzvOoop0bEze E2dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=FI5QWZjiAYXqsEQkJdumsZm7TZ1OoUuyoIjnnABex7Q=; b=eSYziSkx16x1sFJ69NX5Uxwi7b5MRQqCzoz+cegyJLs9+Js6ZfzOxZ4IN1kvXoyEaO sxjNL2C+IDzcQntVlVGymIl5Y3nKZLOyqcyCFJDqV937hecKj5G3swV4mTxOfMdye5U+ RKnB0zLpphAxKVU6z6AepOyJ2pfzW0TOIxIoQqYkMQqU6nlbVtdhvk/wlnJw8G084so6 DZFbB4yH1b9cnr/YHcprMEAuIQjjE0xMHhWVkVinvqY2pAetGaEh+5UjYSh8rml8Uvj/ sxvU84lhFAxrWuTBukddeLTP+yoi/8qRPw80edszKx2gNoSOgDv/Pqn5JECarCIv44Nr Kx1w== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w10si15695282plz.37.2019.04.23.06.37.08; Tue, 23 Apr 2019 06:37:24 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727762AbfDWNep (ORCPT + 99 others); Tue, 23 Apr 2019 09:34:45 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:49107 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726801AbfDWNep (ORCPT ); Tue, 23 Apr 2019 09:34:45 -0400 Received: from p5de0b374.dip0.t-ipconnect.de ([93.224.179.116] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1hIvZ0-0007x3-5X; Tue, 23 Apr 2019 15:34:22 +0200 Date: Tue, 23 Apr 2019 15:34:14 +0200 (CEST) From: Thomas Gleixner To: Laurent Dufour cc: Michael Ellerman , Dave Hansen , LKML , rguenther@suse.de, mhocko@suse.com, vbabka@suse.cz, luto@amacapital.net, x86@kernel.org, Andrew Morton , linux-mm@kvack.org, stable@vger.kernel.org Subject: Re: [PATCH] x86/mpx: fix recursive munmap() corruption In-Reply-To: <6718ede2-1fcb-1a8f-a116-250eef6416c7@linux.vnet.ibm.com> Message-ID: References: <20190401141549.3F4721FE@viggo.jf.intel.com> <87d0lht1c0.fsf@concordia.ellerman.id.au> <6718ede2-1fcb-1a8f-a116-250eef6416c7@linux.vnet.ibm.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-995733783-1556026462=:9956" X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-995733783-1556026462=:9956 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT On Tue, 23 Apr 2019, Laurent Dufour wrote: > Le 20/04/2019 à 12:31, Michael Ellerman a écrit : > > Thomas Gleixner writes: > > > Aside of that the powerpc variant looks suspicious: > > > > > > static inline void arch_unmap(struct mm_struct *mm, > > > unsigned long start, unsigned long end) > > > { > > > if (start <= mm->context.vdso_base && mm->context.vdso_base < end) > > > mm->context.vdso_base = 0; > > > } > > > > > > Shouldn't that be: > > > > > > if (start >= mm->context.vdso_base && mm->context.vdso_base < end) > > > > > > Hmm? > > > > Yeah looks pretty suspicious. I'll follow-up with Laurent who wrote it. > > Thanks for spotting it! > > I've to admit that I had to read that code carefully before answering. > > There are 2 assumptions here: > 1. 'start' and 'end' are page aligned (this is guaranteed by __do_munmap(). > 2. the VDSO is 1 page (this is guaranteed by the union vdso_data_store on > powerpc). > > The idea is to handle a munmap() call surrounding the VDSO area: > | VDSO | > ^start ^end > > This is covered by this test, as the munmap() matching the exact boundaries of > the VDSO is handled too. > > Am I missing something ? Well if this is the intention, then you missed to add a comment explaining it :) Thanks, tglx --8323329-995733783-1556026462=:9956--