From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0182C4708B for ; Wed, 26 May 2021 12:35:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6040C61378 for ; Wed, 26 May 2021 12:35:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6040C61378 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8434E6B0036; Wed, 26 May 2021 08:35:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 799C96B006E; Wed, 26 May 2021 08:35:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 356186B0070; Wed, 26 May 2021 08:35:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0050.hostedemail.com [216.40.44.50]) by kanga.kvack.org (Postfix) with ESMTP id E57136B0036 for ; Wed, 26 May 2021 08:35:47 -0400 (EDT) Received: from smtpin39.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 858AA5923C10 for ; Wed, 26 May 2021 12:35:47 +0000 (UTC) X-FDA: 78183328734.39.CDA12A8 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf01.hostedemail.com (Postfix) with ESMTP id E9D7A5001537 for ; Wed, 26 May 2021 12:35:39 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F2C7D1516; Wed, 26 May 2021 05:35:45 -0700 (PDT) Received: from [10.163.81.152] (unknown [10.163.81.152]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 429983F73B; Wed, 26 May 2021 05:35:43 -0700 (PDT) Subject: Re: [PATCH 1/1] mm/debug_vm_pgtable: fix alignment for pmd/pud_advanced_tests() To: Anatoly Pugachev , Gerald Schaefer Cc: Andrew Morton , linux-mm , LKML , linux-arch , linux-sparc , linux-s390 , stable@vger.kernel.org References: <20210525130043.186290-1-gerald.schaefer@linux.ibm.com> <20210525130043.186290-2-gerald.schaefer@linux.ibm.com> From: Anshuman Khandual Message-ID: <3aadc76c-3a8c-d5d6-5ad2-e83c09f08213@arm.com> Date: Wed, 26 May 2021 18:06:25 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Authentication-Results: imf01.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf01.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: E9D7A5001537 X-Stat-Signature: kja6df3aqe98dxaksm8onf81xoupwh8z X-HE-Tag: 1622032539-890020 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 5/26/21 4:57 PM, Anatoly Pugachev wrote: > On Tue, May 25, 2021 at 4:03 PM Gerald Schaefer > wrote: >> >> In pmd/pud_advanced_tests(), the vaddr is aligned up to the next pmd/pud >> entry, and so it does not match the given pmdp/pudp and (aligned down) pfn >> any more. >> >> For s390, this results in memory corruption, because the IDTE instruction >> used e.g. in xxx_get_and_clear() will take the vaddr for some calculations, >> in combination with the given pmdp. It will then end up with a wrong table >> origin, ending on ...ff8, and some of those wrongly set low-order bits will >> also select a wrong pagetable level for the index addition. IDTE could >> therefore invalidate (or 0x20) something outside of the page tables, >> depending on the wrongly picked index, which in turn depends on the random >> vaddr. >> >> As result, we sometimes see "BUG task_struct (Not tainted): Padding >> overwritten" on s390, where one 0x5a padding value got overwritten with >> 0x7a. >> >> Fix this by aligning down, similar to how the pmd/pud_aligned pfns are >> calculated. >> >> Fixes: a5c3b9ffb0f40 ("mm/debug_vm_pgtable: add tests validating advanced arch page table helpers") >> Cc: # v5.9+ >> Signed-off-by: Gerald Schaefer > > boot tested on sparc64 with quick run of stress-ng ( --class memory > --sequential -1 --timeout 10s -v --pathological --oomable > --metrics-brief ) > stress-ng: debug: [371408] system: Linux ttip > 5.13.0-rc3-00043-gad9f25d33860-dirty #218 SMP Wed May 26 11:55:54 MSK > 2021 sparc64 > > Tested-by: Anatoly Pugachev > spac64 does not enable ARCH_HAS_DEBUG_VM_PGTABLE, did you enable it before running the test ? Did the entire test debug_vm_pgtable() run successfully on sparc64 ?