Received: by 10.192.165.148 with SMTP id m20csp4391397imm; Tue, 8 May 2018 07:46:36 -0700 (PDT) X-Google-Smtp-Source: AB8JxZovCJkEGWzPgF/l0emgYhLLXCo58q2N6/1w5Pmw6338+HuSzyZlYdlv4+891gptPfC8zRPD X-Received: by 2002:a65:4d44:: with SMTP id j4-v6mr17033167pgt.344.1525790796119; Tue, 08 May 2018 07:46:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525790796; cv=none; d=google.com; s=arc-20160816; b=QF5807Mm9wVGhDja4uFrle6xFAD1UFZREkDDWyB6Ee2PmKFk38DDYo+Lj16/6pC8ks SH1FpWvz4TyRQF6bT3Zj2avdOQ3yHc1Z/s+nFFrfJu24VfG23P8urvppp3CsqWG06K2S OhI0Gw3yvJ6Y7x2cpwTCSZ3ZSMWs7uGW5esyLiN7oH7OIiJEs30qvNHPMIQbWuB+L/+t Kq+cK0N/LeWPh9N7TAvZvQVpPLR+WHLYEhAqtl4kXIzwsOgF4ud7NVGzL6OpjkyB9Bmn Tf7sWRK/kD9EhkPynuUov61ILoXI1nRxaGre8s6FPvBSuAD8WDbNyhvpE2WihyKrM3L9 qZSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=RPCSXCuOfSV5ZAqXKQ3JD2HjmebeZz+qM+YxPshIO/4=; b=Qc3rnV7srxPDl0EfRpfaCaVgRjL7q8wUwvciCRsQkIVrO2Ef48kr/xq9ic3V+nQE0D 0XoF4r13EP/vIbltF0pzof7S6XOiuIzAwV6QN2sAr4yHFbKfTB7Iak9eZoTW+6HuF5GI fzIv9r1cDVgkv8431Q5Fw7G3yO7V8fGLBDm6roBrUp6DnyadQkR50h+oMUBKK4Pi4w7D 9FuXhdoS/s3ctzqPdhCgA+3dY6sqFF0HVztuDo4iA9WuSnPQwrk/R3dl0gy5fHYNv5EK 4l3IDb9lNAGXimn+3Sbzqv08lbWT7XrLMdOtbYtQQVSZGv7XIYZ/rI8nHYxlY51zV+Rw aaaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=luktzAo3; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g6-v6si20137823pgr.72.2018.05.08.07.46.21; Tue, 08 May 2018 07:46:36 -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; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=luktzAo3; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932678AbeEHOpb (ORCPT + 99 others); Tue, 8 May 2018 10:45:31 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:47016 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932141AbeEHOp3 (ORCPT ); Tue, 8 May 2018 10:45:29 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w48Egnj7066815 for ; Tue, 8 May 2018 14:45:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : references : in-reply-to : from : date : message-id : subject : to : cc : content-type; s=corp-2017-10-26; bh=RPCSXCuOfSV5ZAqXKQ3JD2HjmebeZz+qM+YxPshIO/4=; b=luktzAo3Dvjw8U+jwOs9u+9tkyB3p9qww11RPHVX7zCdg5pDpcMz7LxPPhM1U938NLF5 bAwbtJGLYSYMV3YIbZFeZKlE0L0RBGJZ8u8CU4qcxyIzMOcgGFrX4xud7x96SdIY3qRc XXXRidQ6N51kJM8TIDweEIi2U1JfyWoLgF5o0SdY5mvLpC7bjyrILzipFXJs+yD6hc9/ aQ7WH0D2tC/Vkyaxz3BEZGgBRKheWFWtP2KCpucfmsKzlCSVECsVCKieywUEwH7OT9iz /xDDqR6AIndWL9R8C+NtlThs7iiaIfk4txnymcdPj12jYKLogKKbG7xpgItlyR7s1sML 1g== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2130.oracle.com with ESMTP id 2hs24sh3tw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 08 May 2018 14:45:29 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w48EjRqh010457 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 8 May 2018 14:45:28 GMT Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w48EjRCQ010137 for ; Tue, 8 May 2018 14:45:27 GMT Received: from mail-ot0-f182.google.com (/74.125.82.182) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 08 May 2018 07:45:27 -0700 Received: by mail-ot0-f182.google.com with SMTP id m11-v6so30171979otf.3 for ; Tue, 08 May 2018 07:45:27 -0700 (PDT) X-Gm-Message-State: ALQs6tDjsO6MjepvIYbr3pC78py2dSm1EwB3Q4J0mWXYKuPhmPGUpD4Q 9lHZ2A/gCFBrnSNRArshLTWGyK2OokXv7qJoPho= X-Received: by 2002:a9d:2e47:: with SMTP id c7-v6mr27808373otd.323.1525790726660; Tue, 08 May 2018 07:45:26 -0700 (PDT) MIME-Version: 1.0 References: <20180426202619.2768-1-pasha.tatashin@oracle.com> <20180430162658.598dd5dcdd0c67e36953281c@linux-foundation.org> In-Reply-To: <20180430162658.598dd5dcdd0c67e36953281c@linux-foundation.org> From: Pavel Tatashin Date: Tue, 08 May 2018 14:44:51 +0000 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] mm: access to uninitialized struct page To: Andrew Morton Cc: Steven Sistare , Daniel Jordan , LKML , tglx@linutronix.de, Michal Hocko , Linux Memory Management List , mgorman@techsingularity.net, mingo@kernel.org, peterz@infradead.org, Steven Rostedt , Fengguang Wu , Dennis Zhou Content-Type: text/plain; charset="UTF-8" X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8887 signatures=668698 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=458 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1805080140 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > Gulp. Let's hope that nothing in mm_init() requires that trap_init() > has been run. What happens if something goes wrong during mm_init() > and the architecture attempts to raise a software exception, hits a bus > error, div-by-zero, etc, etc? Might there be hard-to-discover > dependencies in such a case? Hi Andrew, Unfortunately, mm_init() requires trap_init(). And, because trap_init() is arch specific, I do not see a way to simply fix trap_init(). So, we need to find a different fix for the above problem. And, the current fix needs to be removed from mm. BTW, the bug was not introduced by: c9e97a1997fb ("mm: initialize pages on demand during boot") Fengguang Wu, reproduced this bug with builds prior to when this patch was added. So, I think that while my patch may make this problem happen more frequently, the problem itself is older. Basically, it depends on value of KASLR. One way to quickly fix this issue is to disable deferred struct pages when the following combination is true: CONFIG_RANDOMIZE_BASE && CONFIG_SPARSEMEM && !CONFIG_SPARSEMEM_VMEMMAP RANDOMIZE_BASE means we do not know from what PFN struct pages are going to be required before mm_init(). CONFIG_SPARSEMEM && !CONFIG_SPARSEMEM_VMEMMAP means that page_to_pfn() will use information from page->flags to get section number, and thus require accessing "struct pages" Pavel