Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1314548ybl; Wed, 28 Aug 2019 12:46:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqykWa+rna//0+ML4RaE4z0gi7Y7s01lqnPXT64sdZYsZERrftXOToAxRAYHUVKESVVhyzsQ X-Received: by 2002:aa7:8b46:: with SMTP id i6mr6548678pfd.190.1567021594838; Wed, 28 Aug 2019 12:46:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567021594; cv=none; d=google.com; s=arc-20160816; b=DJpy4fz0mbGb7m73m0HIiW9o90cOuyie6EF65i+gtz85Fi6oY1qk2ck8vdAq6OhgsT DqHOmCVRAeMi6i9ytvtszTjvwtcIFYDCtrqsEKIruxAbVnwA++G3ja9IozFExZrIKqeB QEhfHdEVQ+WfdqLGf4b0OgrkFs+ym588CnEMKF1RBZQSWyf00gPh1B4zCubHOfuFR2lZ AzRXZ3iSgaHPZAM/Gau6RwA3G2UKioAJ45byEs3zS4c0B3LUs7weMA6Wc6pHp+GqDycL NffKghYnRdq266x/LvDEKXnLmLHgnBPqULSX1cKGM1/R47ts9/kXmXjj3uqv981/2Qpx 1EBw== 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=EwBO9RJexXiJpAZpXqau54JiIy2HqBgGz2wAldorxFY=; b=nYEWu0KCVUVkM9HaqYJWykwW0XkXq3I7XvQUc1iXS3kgc4RtDf58hbj5XWqChzsRJq HZOm81hwqy5mkBw6VNx9f7taUJNYLeSQUwz0oyykCQihGhHd8S+qqHeYyAGGBcaOYmsC aTTIwra3brL9PCRbDmdKZZK6M9aOOFKUaWKG0UfMTM/iWlk+UQq35bdToIb3A0K8Lkhc wOD4B7m0ReynN4WcEwEBpzHxuQcbM09MRlxd9WbRiTZ/LN4QPoxk7OIdgiZHgfXzn32d F6wxt+wbDGa76UnqRo+fLuAVhtWvHRP6aq4JchXhKmjedViv4uKKae5sN0nq8s0VcJnL htzA== 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 v61si2639781plb.355.2019.08.28.12.46.18; Wed, 28 Aug 2019 12:46:34 -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 S1726805AbfH1TpM (ORCPT + 99 others); Wed, 28 Aug 2019 15:45:12 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:48310 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726697AbfH1TpL (ORCPT ); Wed, 28 Aug 2019 15:45:11 -0400 Received: from p5de0b6c5.dip0.t-ipconnect.de ([93.224.182.197] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1i33sQ-0003JR-JC; Wed, 28 Aug 2019 21:45:06 +0200 Date: Wed, 28 Aug 2019 21:45:05 +0200 (CEST) From: Thomas Gleixner To: Ingo Molnar cc: LKML , x86@kernel.org, Song Liu , Joerg Roedel , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Rik van Riel Subject: Re: [patch 1/2] x86/mm/pti: Handle unaligned address gracefully in pti_clone_pagetable() In-Reply-To: <20190828185832.GA77809@gmail.com> Message-ID: References: <20190828142445.454151604@linutronix.de> <20190828143123.971884723@linutronix.de> <20190828185832.GA77809@gmail.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII 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 On Wed, 28 Aug 2019, Ingo Molnar wrote: > > pmd = pmd_offset(pud, addr); > > if (pmd_none(*pmd)) { > > - addr += PMD_SIZE; > > + WARN_ON_ONCE(addr & PMD_MASK); > > + addr = round_up(addr + 1, PMD_SIZE); > > So given that PUD_MASK and PMD_MASK are masking out the *offset*: > > arch/x86/include/asm/pgtable_64_types.h:#define PMD_MASK (~(PMD_SIZE - 1)) > > Didn't we want something like: > > WARN_ON_ONCE(addr & ~PUD_MASK); > > WARN_ON_ONCE(addr & ~PMD_MASK); > > to warn about an unaligned 'addr', or am I misreading the intent here? Bah, right you are...