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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56630C6FA83 for ; Thu, 8 Sep 2022 06:15:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7B2E18D0002; Thu, 8 Sep 2022 02:15:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 761A56B0073; Thu, 8 Sep 2022 02:15:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 602588D0002; Thu, 8 Sep 2022 02:15:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 515596B0072 for ; Thu, 8 Sep 2022 02:15:02 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 29E2240838 for ; Thu, 8 Sep 2022 06:15:02 +0000 (UTC) X-FDA: 79887905244.25.6CDE713 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf13.hostedemail.com (Postfix) with ESMTP id 9210F20078 for ; Thu, 8 Sep 2022 06:15:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662617701; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YGoqPEfZEu/WR7wqX4sT3MU/b6AK4ZTAeAI8OgjLKiU=; b=RUhWSPRI/Htf7KBgbO4UVpPE13UVf9u/nOYrthPWIRHnDQ084uv/qhruTEVUEHdExFMkZq mRWRqZaXpIywilIqVCvVRYVcFAgKrdIscMgRe8mWu3lOEIPkFZZzWytNhST/J6HUWrtx2b 8Af1uQLxMf8A1577jlU66Mwp/s+Bxec= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-489-H1OL9cy_NdWrRZ5K4cyeIA-1; Thu, 08 Sep 2022 02:14:59 -0400 X-MC-Unique: H1OL9cy_NdWrRZ5K4cyeIA-1 Received: by mail-wm1-f71.google.com with SMTP id v21-20020a05600c215500b003a83c910d83so150145wml.3 for ; Wed, 07 Sep 2022 23:14:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:subject:organization:from :references:cc:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date; bh=YGoqPEfZEu/WR7wqX4sT3MU/b6AK4ZTAeAI8OgjLKiU=; b=HcjSxRHgqSQoxkfkk685OTFVUELf8i8aeqnFMoFavU7G+Tavslh2/CciJhMYBLA46N VuDbsUP7hHVRUZa9HnGLqTWRmn67XyndAWrHmzazn0Yh0UiQufBQiTqzs0B09odAVVTG pxpO2wriGM4j/mEkr0R/AKX5lMnvb/Cek1D4e9g7P9XY9uDvzTwYZJxgCaDW7pa7MFtc w2Cv4U1PT37NvGUtKjTdv+WKOwnB97Jhs7qVjmB8no3EpubaJum27uI7mtxS596AzO05 N4DSmtktnC9MELRVv+e7yT18w3MCiZAhB5PswcXcR2LBm9Pe/9360OC0lAuwGbaiuDTF pdhw== X-Gm-Message-State: ACgBeo2vEykcmNhBNSb6JjPNXqN1k5oIWtQgvml6V630CoTsqu1EJMZE OX7mEHlLRorlkak6gtA6xuwsvZmA8kSNpnuafRJ5N7s5J6U1gnbmvkFroVAZ/tsh2VlpRscQs7a hggqMHeEBEn0= X-Received: by 2002:a7b:ce11:0:b0:3a6:1e4d:8d7b with SMTP id m17-20020a7bce11000000b003a61e4d8d7bmr1013024wmc.101.1662617698589; Wed, 07 Sep 2022 23:14:58 -0700 (PDT) X-Google-Smtp-Source: AA6agR60O3vdOIzosOVpZTLRBGcvb/6r9P+qUDsjBA4sdFGUE1iR6HJ6YcKVmk30z2n8Cy46BUNISg== X-Received: by 2002:a7b:ce11:0:b0:3a6:1e4d:8d7b with SMTP id m17-20020a7bce11000000b003a61e4d8d7bmr1013009wmc.101.1662617698335; Wed, 07 Sep 2022 23:14:58 -0700 (PDT) Received: from ?IPV6:2003:d8:2f0d:ba00:c951:31d7:b2b0:8ba0? (p200300d82f0dba00c95131d7b2b08ba0.dip0.t-ipconnect.de. [2003:d8:2f0d:ba00:c951:31d7:b2b0:8ba0]) by smtp.gmail.com with ESMTPSA id bz9-20020a056000090900b0022584c82c80sm20574434wrb.19.2022.09.07.23.14.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 07 Sep 2022 23:14:57 -0700 (PDT) Message-ID: Date: Thu, 8 Sep 2022 08:14:57 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.0 To: =?UTF-8?B?SE9SSUdVQ0hJIE5BT1lBKOWggOWPoyDnm7TkuZ8p?= , Andrew Morton Cc: Naoya Horiguchi , "linux-mm@kvack.org" , Muchun Song , Miaohe Lin , Matthew Wilcox , Michal Hocko , Yang Shi References: <20220907100855.GA2894785@ik1-406-35019.vs.sakura.ne.jp> <1481ce19-0a64-d1dc-4d89-4db71d6f7eb3@redhat.com> <20220907121157.GA2954283@ik1-406-35019.vs.sakura.ne.jp> <20220907135745.cda0d84b5a3f9f6df39b9884@linux-foundation.org> <20220908024728.GB1491221@hori.linux.bs1.fc.nec.co.jp> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH] mm/huge_memory: use pfn_to_online_page() in split_huge_pages_all() In-Reply-To: <20220908024728.GB1491221@hori.linux.bs1.fc.nec.co.jp> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662617701; a=rsa-sha256; cv=none; b=hAShDxtb3xWcUPq2y1lId3doGypESOUFmUYO0bZCNrNUBdUkCyc4VqGW2xDlpOp51w73qs 68wOY0M1vSytWUuLd6PqcpqXQASId5w2GzHsIb54RxUir/VjdgFJDtT5yR4XmP+do+eYqu 674EIduvWkCqqofW1IQqNFJXK1lrTpk= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=RUhWSPRI; spf=pass (imf13.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662617701; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=YGoqPEfZEu/WR7wqX4sT3MU/b6AK4ZTAeAI8OgjLKiU=; b=7+jMoJkTX5i7ABkcjLPUBIUfUu16rlcTeWeDP3mDu6ccxLZPdrdJetNjZ+ZHPLOEMcssft LvuKpPvWIe6L3YNMpWHWQY+e/lZ4+Z3eoOabrExdhXusvyd9VhjaQWvgHvufLq5Mk53LZn 1CEudIIDv7sb8VveIUUKI9rQKZ8ctlI= X-Stat-Signature: 8a9oggwootupzzwr73z5sty74mjh83yg X-Rspam-User: X-Rspamd-Queue-Id: 9210F20078 X-Rspamd-Server: rspam07 Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=RUhWSPRI; spf=pass (imf13.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-HE-Tag: 1662617701-729237 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 08.09.22 04:47, HORIGUCHI NAOYA(堀口 直也) wrote: > On Wed, Sep 07, 2022 at 01:57:45PM -0700, Andrew Morton wrote: >> On Wed, 7 Sep 2022 21:11:57 +0900 Naoya Horiguchi wrote: >> >>> >>> NULL pointer dereference is triggered when calling thp split via debugfs >>> on the system with offlined memory blocks. With debug option enabled, >>> the following kernel messages are printed out: >>> >>> page:00000000467f4890 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x121c000 >>> flags: 0x17fffc00000000(node=0|zone=2|lastcpupid=0x1ffff) >>> raw: 0017fffc00000000 0000000000000000 dead000000000122 0000000000000000 >>> raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000 >>> page dumped because: unmovable page >>> page:000000007d7ab72e is uninitialized and poisoned >>> page dumped because: VM_BUG_ON_PAGE(PagePoisoned(p)) >>> ------------[ cut here ]------------ >>> kernel BUG at include/linux/mm.h:1248! >>> invalid opcode: 0000 [#1] PREEMPT SMP PTI >>> CPU: 16 PID: 20964 Comm: bash Tainted: G I 6.0.0-rc3-foll-numa+ #41 >>> ... >>> RIP: 0010:split_huge_pages_write+0xcf4/0xe30 >>> >>> This shows that page_to_nid() in page_zone() is unexpectedly called for an >>> offlined memmap. >>> >>> Use pfn_to_online_page() to get struct page in PFN walker. >>> >>> Fixes: 49071d436b51 ("thp: add debugfs handle to split all huge pages") >> >> January of 2016! Or was this a long-term bug which was recently >> exposed by some other change? > > Maybe yes, I confirmed that this issue reproduces in kernel 5.10 (released > on Dec 13, 2020, which might not be so "recent"), but does not reproduce in > kernel 5.4. So I think that marking "5.10+" for stable is fine. I fixed plenty of such issues in the past. For example: aad5f69bc161 ("fs/proc/page.c: don't access uninitialized memmaps in fs/proc/page.c") This one just wasn't found so far because it's triggered via a debug interface. The correct fixes tag would be: Fixes: f1dd2cd13c4b ("mm, memory_hotplug: do not associate hotadded memory to zones until online") [visible after d0dc12e86b319] Exposed "recently" -- 2018 ;) -- Thanks, David / dhildenb