Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2252373imm; Tue, 4 Sep 2018 00:50:26 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaZSzNwG6ezICREseiXdLSUQucgqxkSq5CAoFthhEFRze6zCLW8qGvNocM1WJR1vIQlTeLw X-Received: by 2002:a62:1314:: with SMTP id b20-v6mr34177415pfj.230.1536047425949; Tue, 04 Sep 2018 00:50:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536047425; cv=none; d=google.com; s=arc-20160816; b=QdClOPAzsM3ks27fvgMJ2iSWEswuR2XvZ6Npxcuroc+em4rzQtPTuRUzrXE+9qR8cG KhcgWhHWcTsyGzhIFxbNcpfLwsAKM8vS9yPgcsSJmIG1fRX8nC8+IEDddB7qpZVhuFO5 sYo4VYyfCrLPO1Ug6kvtwmVIIuAm2M8IKKoEiZpIw2TOh7LnLBAt7vwUf8UkCubgRidK 6toB/JFL1/aABzKq44nGvYtN0uVIBW2NKV0mlAMyhs9xK549JEWu3Rb5fQHfF9+mQ4mq nF+fx/XIds3hoq/bT97Qf1ptHdSTRDLb+3RUR7H8wq+Hs78aJwxFSGnWw7imw7He9Xd5 WoyQ== 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 :arc-authentication-results; bh=WnDTIFh+sYzFHizUKwkQXpCnPCC0jH5byYq7GZ2Cxd4=; b=NHKWiByyrZfhL352HWxLhtkZXNyEms9hDKV2+kORCvgfBgt7zqSdHVlLxfjaKAAjQT XYX/Km9YrUOR+AlhNVY6nn+3oHQdvidywTEOkUwPfIwsuulcKEQM8kTMutMzbPQxlrOL zZ2ZlH7UR3S+5triYHNyB5DPNYp0o+KfGcwdBG8/pq3OcFt3vqj9bQ6QOe5VSDqIDsvY 5wZ9vXmvM0V2cwJGKsDEL1w6rn5o4p6+WK9D43PWiVutvTbTKrOeUr80usNxWyKcMe6Y Cje4I1WCDXCIpDPYFVHiT7Y0+nhcTmoi/KyO11wWQBWT4hp6pW+OV1Kw8wQuTp6fpA9Z NsJg== 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 i135-v6si18141209pgc.154.2018.09.04.00.50.09; Tue, 04 Sep 2018 00:50:25 -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 S1726220AbeIDMM6 (ORCPT + 99 others); Tue, 4 Sep 2018 08:12:58 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:56412 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725990AbeIDMM6 (ORCPT ); Tue, 4 Sep 2018 08:12:58 -0400 Received: from p4fea45ac.dip0.t-ipconnect.de ([79.234.69.172] helo=[192.168.0.145]) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1fx657-0000W5-BF; Tue, 04 Sep 2018 09:49:01 +0200 Date: Tue, 4 Sep 2018 09:49:00 +0200 (CEST) From: Thomas Gleixner To: "Yang, Bin" cc: "mingo@kernel.org" , "hpa@zytor.com" , "linux-kernel@vger.kernel.org" , "peterz@infradead.org" , "Gross, Mark" , "x86@kernel.org" , "Hansen, Dave" Subject: Re: [PATCH v3 1/5] x86/mm: avoid redundant checking if pgprot has no change In-Reply-To: <76cf0aca5a2f8e9b94fd0631274a3d4ad825d077.camel@intel.com> Message-ID: References: <1534814186-37067-1-git-send-email-bin.yang@intel.com> <1534814186-37067-2-git-send-email-bin.yang@intel.com> <76cf0aca5a2f8e9b94fd0631274a3d4ad825d077.camel@intel.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 Tue, 4 Sep 2018, Yang, Bin wrote: > On Mon, 2018-09-03 at 23:57 +0200, Thomas Gleixner wrote: > > > > The last patch which does the overlap check is equally broken: > > Sorry that I did not understand the broken of last patch. I meant 4/5 sorry. That's the one which introduces the overlap check and does this: > > + /* > > + * Ensure that the requested pgprot does not violate static protection > > + * requirements. > > + */ > > + new_prot = static_protections(req_prot, address, > > + numpages << PAGE_SHIFT, pfn); > > > > It expands new_prot to the whole range even if the protections only > > overlap. That should not happen in practice, but we have no checks for that > > at all. > > Below code in patch #3 should cover this check. It will double check > new_prot in whole large page range. Which is exactly what is wrong. Read again what I wrote. Thanks, tglx