Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp5681117imd; Tue, 30 Oct 2018 23:48:02 -0700 (PDT) X-Google-Smtp-Source: AJdET5cerKSxqCJoBJa5N9wZC81Ik7kdyuSNE0k+R/rKAtJLVr/NjP2N89nDC0TgLuYnXaykJYQK X-Received: by 2002:aa7:87d0:: with SMTP id i16-v6mr2093392pfo.20.1540968482777; Tue, 30 Oct 2018 23:48:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540968482; cv=none; d=google.com; s=arc-20160816; b=nav1Y5Crp0VRwoR/zgat0hbkMexY8hnPHESMgQjR7ZtNWa+n/ldVDtwFrfcqD/HYp8 pR0Nzn2hXjBfVnBYFf8MAXSgHcbSUjeHQiDpJwzMDVIpGIv7KX6ovKZxKsYH6goWs5mR lIrhv8oF5CwgeRvJwPHs3lDa0vHPiREnwl1SSkHtyOWCAITPBLEz9wiIhYs9vqTrGc09 7FzbA2L/NUtLlcG/e+H4GPrgfaECyIKuHzse9BelvG9M0mlX83e4xnrl4PYTu5IaGAh8 4qh/KMSJTK6UcHehyy0p4NqL8RdtGKk1wNRHdCDBBYif5I0wGJM1mxYUxjpljI9tLyRn Padg== 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:message-id :mime-version:references:in-reply-to:subject:cc:to:from:date; bh=8z5MaoGSEDOQBrpWXe55L37f2wr0bjXswCrA5Qa7hNs=; b=I8Hi16SDMEvVVJK8Hf6WAFIIyyBwDeMbXPnQ9lVI01n6fQW33b9X5F5nKsonUQxNxL vEtTCKZrZ4Uprq9PezLtQUfbIHtVzTGUe2oW8n0ClF4FKfWA9cScuXVOFfpo9aHf15mo oDTJ/tXO1jxVhKVcVAOZ/Hgy+jK8MxWCBoRXBUc4ptpFU9VKL+dWDC2emRDAofNZTlPC TSXBOaOEKVdsnN1I0oIXd5Leo+9K93uvziMANfTdA+c7pKRA0lVgQpSQAfu42jcsRrFS kCcusoGfj0nK4KkxqRVv3RGjnsNeUhYAOLVE7Akax6/v32/x5Dc2G2Ll5dJlmJwwHZCL LWNw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o4-v6si5590004pgj.306.2018.10.30.23.47.48; Tue, 30 Oct 2018 23:48:02 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728800AbeJaPnn (ORCPT + 99 others); Wed, 31 Oct 2018 11:43:43 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:55786 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725955AbeJaPnn (ORCPT ); Wed, 31 Oct 2018 11:43:43 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w9V6i9bb062278 for ; Wed, 31 Oct 2018 02:46:55 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2nf3mb7qpf-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 31 Oct 2018 02:46:54 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 31 Oct 2018 06:46:52 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 31 Oct 2018 06:46:50 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w9V6knhe46530652 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 31 Oct 2018 06:46:49 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 214044C040; Wed, 31 Oct 2018 06:46:49 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B157E4C04A; Wed, 31 Oct 2018 06:46:48 +0000 (GMT) Received: from mschwideX1 (unknown [9.145.41.78]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 31 Oct 2018 06:46:48 +0000 (GMT) Date: Wed, 31 Oct 2018 07:46:47 +0100 From: Martin Schwidefsky To: Li Wang Cc: Guenter Roeck , Janosch Frank , "Kirill A. Shutemov" , Heiko Carstens , linux-kernel , Linux-MM Subject: Re: [PATCH 3/3] s390/mm: fix mis-accounting of pgtable_bytes In-Reply-To: References: <1539621759-5967-1-git-send-email-schwidefsky@de.ibm.com> <1539621759-5967-4-git-send-email-schwidefsky@de.ibm.com> <20181031073149.55ddc085@mschwideX1> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 18103106-0008-0000-0000-00000288D1A4 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18103106-0009-0000-0000-000021F2F146 Message-Id: <20181031074647.32c6e0d7@mschwideX1> Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-10-31_02:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810310057 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 31 Oct 2018 14:43:38 +0800 Li Wang wrote: > On Wed, Oct 31, 2018 at 2:31 PM, Martin Schwidefsky > wrote: > > > On Wed, 31 Oct 2018 14:18:33 +0800 > > Li Wang wrote: > > > > > On Tue, Oct 16, 2018 at 12:42 AM, Martin Schwidefsky < > > schwidefsky@de.ibm.com > > > > wrote: > > > > > > > In case a fork or a clone system fails in copy_process and the error > > > > handling does the mmput() at the bad_fork_cleanup_mm label, the > > > > following warning messages will appear on the console: > > > > > > > > BUG: non-zero pgtables_bytes on freeing mm: 16384 > > > > > > > > The reason for that is the tricks we play with mm_inc_nr_puds() and > > > > mm_inc_nr_pmds() in init_new_context(). > > > > > > > > A normal 64-bit process has 3 levels of page table, the p4d level and > > > > the pud level are folded. On process termination the free_pud_range() > > > > function in mm/memory.c will subtract 16KB from pgtable_bytes with a > > > > mm_dec_nr_puds() call, but there actually is not really a pud table. > > > > > > > > One issue with this is the fact that pgtable_bytes is usually off > > > > by a few kilobytes, but the more severe problem is that for a failed > > > > fork or clone the free_pgtables() function is not called. In this case > > > > there is no mm_dec_nr_puds() or mm_dec_nr_pmds() that go together with > > > > the mm_inc_nr_puds() and mm_inc_nr_pmds in init_new_context(). > > > > The pgtable_bytes will be off by 16384 or 32768 bytes and we get the > > > > BUG message. The message itself is purely cosmetic, but annoying. > > > > > > > > To fix this override the mm_pmd_folded, mm_pud_folded and mm_p4d_folded > > > > function to check for the true size of the address space. > > > > > > > > > > I can confirm that it works to the problem, the warning message is gone > > > after applying this patch on s390x. And I also done ltp syscalls/cve test > > > for the patch set on x86_64 arch, there has no new regression. > > > > > > Tested-by: Li Wang > > > > Thanks for testing. Unfortunately Heiko reported another issue yesterday > > with the patch applied. This time the other way around: > > > > BUG: non-zero pgtables_bytes on freeing mm: -16384 > > > > Okay, the problem is still triggered by LTP/cve-2017-17052.c? No, unfortunately we do not have a simple testcase to trigger this new bug. It happened once with one of our test kernels, the path that leads to this is completely unclear. -- blue skies, Martin. "Reality continues to ruin my life." - Calvin.