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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BEACBC433F5 for ; Thu, 4 Nov 2021 23:37:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3E9766108F for ; Thu, 4 Nov 2021 23:37:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3E9766108F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 749D86B0071; Thu, 4 Nov 2021 19:37:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6F888940007; Thu, 4 Nov 2021 19:37:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 616E66B0073; Thu, 4 Nov 2021 19:37:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0073.hostedemail.com [216.40.44.73]) by kanga.kvack.org (Postfix) with ESMTP id 51AB36B0071 for ; Thu, 4 Nov 2021 19:37:45 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 0D19B181CAC6A for ; Thu, 4 Nov 2021 23:37:45 +0000 (UTC) X-FDA: 78772862406.19.5ACD96D Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) by imf30.hostedemail.com (Postfix) with ESMTP id 13173E001989 for ; Thu, 4 Nov 2021 23:37:27 +0000 (UTC) Received: by mail-lf1-f51.google.com with SMTP id g29so1048724lfv.4 for ; Thu, 04 Nov 2021 16:37:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=3yQZQJXhgX/zkHFD6Mrk/GQBKYWCdh2u+VZfZzPF1EQ=; b=K4+xRIl2O3ZxTQ7b9FxffLrwYSFr7hDvs4g8BhAj5vjUGOHZeYX5vOhJaXrAA0/QJF 3D7CXT0mkFrRgedEZ1KwsTkfsZJqTjFdexqZMnQg6Wzpq8vQFaMzynN7PeRDkwtRSKCp dUG+fB5ioYbqCyv/DJ4+YtlEOSpHvSP23UDK8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=3yQZQJXhgX/zkHFD6Mrk/GQBKYWCdh2u+VZfZzPF1EQ=; b=YMfbrQn3S9+zYEelJcTpAvuayq0dZSSHu2FaF6XAiSgWgPYMqm2MI9GCizax+JDQQD M4Nd3ThFiJkyUPtk6TytmGENhRRbvOs8zVfwn+eBD1rxQD389AHKiFSjEMtaoxZCnJbM j2ZgckbIJIOI4nxJAo6Z1pgPmKogLYJbqBMYSbPG21W7gbbr7+ig7k//Jqll7+0sp17i NmoVQotZWpyFhDf9GgymYMsuQjJ7Hub2L+S7884yMt9YfCgOMLy74j/3E+oYudw0qEU8 moyQj6yRH38u2IhWtg8MDh4RD6dpc7e0iINRST3Xo04uSOS/RdrcsdP7/xoz1/NC/wuw 7TYQ== X-Gm-Message-State: AOAM533+oKUOAxpvMZsgB/w/xS+4K5NIRtEvBHh2glNQki3PWz7tvnkJ JqA9niYBjC+FlNRRhtNvSQeEtEPxNQw16hlU X-Google-Smtp-Source: ABdhPJxFlyQusVcRF03GqIK1/9ujelF3ezrhTpnMvSJJkuDSyoZr6Enfm8BLyQfP+e8btOGmiFI1Ug== X-Received: by 2002:ac2:4c56:: with SMTP id o22mr50567225lfk.196.1636069062268; Thu, 04 Nov 2021 16:37:42 -0700 (PDT) Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com. [209.85.208.169]) by smtp.gmail.com with ESMTPSA id bt10sm618093lfb.193.2021.11.04.16.37.41 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 04 Nov 2021 16:37:41 -0700 (PDT) Received: by mail-lj1-f169.google.com with SMTP id a10so4661348ljk.13 for ; Thu, 04 Nov 2021 16:37:41 -0700 (PDT) X-Received: by 2002:a2e:a7d3:: with SMTP id x19mr29514920ljp.68.1636069061422; Thu, 04 Nov 2021 16:37:41 -0700 (PDT) MIME-Version: 1.0 References: <20211104115001.GU20319@twin.jikos.cz> In-Reply-To: From: Linus Torvalds Date: Thu, 4 Nov 2021 16:37:25 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Kmap-related crashes and memory leaks on 32bit arch (5.15+) To: David Sterba , Qu Wenruo , Linux Kernel Mailing List , Linux-MM Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 13173E001989 X-Stat-Signature: 3f4z43qky8qjdzheiqqetn8nryqymw5g Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=google header.b=K4+xRIl2; dmarc=none; spf=pass (imf30.hostedemail.com: domain of torvalds@linuxfoundation.org designates 209.85.167.51 as permitted sender) smtp.mailfrom=torvalds@linuxfoundation.org X-HE-Tag: 1636069047-702802 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 Thu, Nov 4, 2021 at 3:09 PM Linus Torvalds wrote: > > I'm obviously not on my laptop right now, but I did look at the btrfs > lzo code earlier today again, and didn't see anything that looked > remotely suspicious. Ok, back at the laptop, and once again looking at this. I'm stumped. So if I understand correctly, 5.15 + 2cf3f8133bda ("btrfs: fix lzo_decompress_bio() kmap leakage") is fine. Also, 5.15 with the folio merge, plus the fix for that (commit e66435936756: "mm: fix mismerge of folio page flag manipulators") is fine too. I The tested "tip of the day" that was bad was dcd68326d29b ("Merge tag 'devicetree-for-5.16' of git://..."). Since you already tested the folio merge, there really isn't a whole lot of mm changes left in there. Andrew hasn't sent his patch-bombs yet. Doing a gitk 49f8275c7d9247cf..037c50bfbeb33b \ mm/ include/linux/highmem* fs/btrfs/ really doesn't show anything that looks particularly suspicious. There's some sync_bdev() changes, and some polling changes, but they look trivial. The only half-way relevant thing that remains is my merge, which very much had conflicts around kmap/kunmap because of the revert problems. So I continue to think that I must have screwed up, but I still don't see which kmap/kunmap would be wrong. I'll just repeat my suggestion here since the original email didn't go to the lists. > (a) test your side before my merge with your alternate kmap fix > commit (the one you had in the other branch to make it allegedly > easier to resolve)? > > (b) if that works, re-do the merge using that kmap pattern? Your kmap() pattern is slightly different from mine. I tried to avoid an unnecessary "kmap again" in copy_compressed_data_to_page(), so my kmap lifetime is slightly longer over that loop. Having looked at it once more, it still looks "ObviouslyCorrect(tm)" to me, but I suspect I'm just being blind to some obvious bug. > If (a) works, but (b) still fails, then it must be some odd > interaction issue with something else. Which sounds unlikely, since I > don't think we really had anything that should affect kmap or anything > in this area, but who knows... And bisection ends up perhaps somewhat painful, but sounds like the way to go if there's no other path forward. Linus