Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2568985ybk; Tue, 12 May 2020 02:41:03 -0700 (PDT) X-Google-Smtp-Source: APiQypISAQZP9oJ6mnIS7YZgkUpT/XlcBDklEm7p8FGUgNYszMmympf/c62iUcvQ4CFWuRNmQwQ1 X-Received: by 2002:aa7:dcd7:: with SMTP id w23mr17544163edu.300.1589276462994; Tue, 12 May 2020 02:41:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589276462; cv=none; d=google.com; s=arc-20160816; b=yRvSGFdbyZUYygytdZsB7a+TLqaIuySjvuOGSAtGp52XOGdT24ytNYl9ra1V9/tKkU T+31+AL5LhfvJfaHB8ej8gduJdJEJpBsqlAC+c7NNICryS67GgAvz9yvJBJZMhLJp4wQ R0PzO3VRvuG+XowSZLl5t6IbzuuZChJIhiB1nIzLbsiU3iw6o1WNZ1tI3N1FWKK7nfZg L1ivyiVkaLWPl3au9e5iqthCy2478D8GATjfzF5bHqCRBiAsgXnbEqTjlSRCNOq/PrvZ 8ESdU3ksPsbiD4PRG5OzWCqoJ0zF4lo+pYnDMB5zu7Xx7RmjieS4a+GqhK4JF5CLqjiT A1Pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:mime-version:user-agent:date:message-id:subject :from:cc:to; bh=9DzI05ftvc4S3v0AOOBDea1vgSBX/EcboKcWqHOxnJ8=; b=P6/rtX1vJUb5XVI7WQdrh3YCP20hqsVX4bVmLjp1q/ZWK6w3elgipZLlGImSqHRVBW 7KdqpiL4ht1NnAuwVDPYUNRwzntBHs037oKyj6BnJZ5tqJYfTpW/TjvNeUBbRt7vInb3 gNfbL5RorMWQgbM/UDl4OcO7yxj4ojDsm76DO0XHtY+Ku8TtgD1bwg6UGzNfdrDhID1z VGSJ0Ve3JPK5qLbEVjknspEot2l9rIB0goVyyKLzoiMsXE5cWognY1zlGdnABtNRPj/1 NhsXMF7r4fbW+iEyyqQM1VkBBMLCT0R0B+QTB6mNnRar+Qt4JaM6FQEWj2Ahbhd/m1kZ Zokw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m10si8078008edr.459.2020.05.12.02.40.39; Tue, 12 May 2020 02:41:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729118AbgELJjC (ORCPT + 99 others); Tue, 12 May 2020 05:39:02 -0400 Received: from mx2.suse.de ([195.135.220.15]:43596 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726187AbgELJjB (ORCPT ); Tue, 12 May 2020 05:39:01 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 4CE94AF8D; Tue, 12 May 2020 09:39:03 +0000 (UTC) To: Steven Price Cc: the arch/x86 maintainers , lkml From: Jan Beulich Subject: your "x86: mm: convert dump_pagetables to use walk_page_range" change Message-ID: Date: Tue, 12 May 2020 11:39:00 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Steven, in the description of this change you say: "The effective permissions are passed down the chain using new fields in struct pg_state." I don't see how this works, and I suppose this part of the change is (part of) the reason why a W+X warning has magically disappeared in 5.6.x (compared to 5.5.x) when running a 32-bit kernel under Xen. Quoting the relevant piece of code: if (level > 0) { new_eff = effective_prot(st->prot_levels[level - 1], new_prot); } else { new_eff = new_prot; } if (level >= 0) st->prot_levels[level] = new_eff; The generic framework calls note_page() only for leaf pages or holes afaics. The protections for a leaf page found at a level other than the numerically highest one have no meaning at all for a mapping at a later address mapped with a numerically higher level mapping. Instead it's the non-leaf page tables for that specific address which determine the effective protection for any particular mapping. To take an example, suppose the first present leaf page is found at level 4. st->prot_levels[] will be all zero at this time, from which it follows that new_eff will be zero then, too. I don't think the intended effect can be achieved without either retaining the original behavior of passing the effective protection into note_page(), or calling note_page() also for non-leaf pages (indicating to it which case it is, and adjusting it accordingly). Am I overlooking something? Additionally I'd like to note that note_page()'s "unsigned long val" parameter isn't wide enough for 32-bit PAE PTEs, and hence the NX flag will always be seen as clear in new_prot in such configs. Jan