Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5238488pxj; Wed, 26 May 2021 06:11:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyG9hUmUvrD+e7PSyn6WX14H9PsC27+GOUPQ467RKgQD6MqAUDwdiDHx+Ik2hPuWg3D9K0P X-Received: by 2002:a5e:8a08:: with SMTP id d8mr25956570iok.192.1622034694450; Wed, 26 May 2021 06:11:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622034694; cv=none; d=google.com; s=arc-20160816; b=yQKtmSWklqbwpXkH9RBA68qmW6JYqwSZkXY0oTNRwbxNBuwyc8MTA3dqsq5+oZQk1Y 4eF/Cnmk/7RDTVOPjvsR9De0Lasl3CTVY8WPXkS7CtGgKw+M63OD8n4xB7lOYAyZefT8 PFXhQG19y/uYySdEiKlrcbbLEGfTSUU8g5s1QGe4zs0xfjNiKOfCK2q424IUSFFrfjWy PGx5kVoGpiEpg+lriTG5joLK/G3/aTlDkP75S3ZO53zPFAGSzdnyXk4AR/Cu+8bx3S0E ODJasnp99anbgL7qhITIBjAuOpaejTb7lKEIIyHx8iz7xHLBS5ebGuQMkc/Na/3ELrmd SpmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=t+9p0bOBfyiXdii966/wlPCUuMKmg2KYhS4HRQXUrYw=; b=GYSY9uXfDLGm0QvUCNTfPBNAaQWrjAy5tFPWZki7nd/iSq2WvNNbayM7MKeDGl5Rtt psRJK56z3nCzMUo7DSvf6dbB7wPxyYnSKV+KxpXQ751FtpbBYeZ0smEkUZw6r2y/tyqL 0huQFtBo64BD5NlLR8c0/Tjh7inuKr5NzbgRZPzLAo5BJj9OFW0auDxxwlhuo3ynyYpL XGdJQtbrJyUnFe0JrmroJlLUZc/wWYWlUhWG07bQy6mshcnmj8epgEWUFEvdQ3UhQ82V 29hWiU0LQ6I0lcUftDFSvjUyKnF+KRn1wqHrnchEEIjw3GR0GL3szYRfU1WGle0dqQ5I fF0w== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i26si329911ion.51.2021.05.26.06.11.20; Wed, 26 May 2021 06:11:34 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233429AbhEZMhS (ORCPT + 99 others); Wed, 26 May 2021 08:37:18 -0400 Received: from foss.arm.com ([217.140.110.172]:43918 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233221AbhEZMhR (ORCPT ); Wed, 26 May 2021 08:37:17 -0400 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 ?