Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2233947pxb; Thu, 4 Nov 2021 16:40:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxnrqD0ZPthU8Kt653F59QHlNHWp9LXcMURGEyTQVxiXqFwj+KKObObzEs9El0I6s1hVtbJ X-Received: by 2002:a17:907:62a5:: with SMTP id nd37mr68680189ejc.114.1636069234717; Thu, 04 Nov 2021 16:40:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636069234; cv=none; d=google.com; s=arc-20160816; b=hamQdAr3NUSE0SuM9mj8FT0Sbj5Q8wmIuf2XnW/+xPMmFHL5ubvkee6TfRa8zppHkM n4sSGIaXeqzoIky+dZuaxTCIvTRdxNdlhRFzD0hSG1FEmnHyNvMrNXFedL/TuILbcUCQ vUJru6ZgDAh1UKf3ftjfEuo258oeavItVZ0s5cqCZE+1PQ+wZ8ah09uV/owlJ7Io2Y9y h9Rlq3wxhyskS96aa0LI3/Y2Ojr7/lq0CO/gopued3MGDC3afbdZNAoAkMwcKmULBYWn I75rJ+lHluJ6YUEV52Agoy0wIlhsYFH6OyxjrTfUnh450h5StHBONTmN3tyDJyEDq+B5 AmsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=3yQZQJXhgX/zkHFD6Mrk/GQBKYWCdh2u+VZfZzPF1EQ=; b=PAoRmW6G9VO6pHMuOLXt7Ljf+dUt9MKS0e6CEj4fZKUu9ojdfq/e3Wr/FR7FyJ0qSu OE1UX+bf6Wgvs0buBthbk3ABxuT+7fUMqKI39+dX95J7GLqHM+4M23BUYRv00YZELJLZ kQVzxRLkFQhUKVU9qimZOFXa1VrDbnkUMDFtX0hIIqtgdMNsxWqZVd2PoDVx/BxNh+xP e4D8rPQDnFQhZRCBA1R6mmdxz2yWqv0rNP2/bwtd7xdmmuN18iBPD47q7s4JXzs+4PWq gi4AbXmki3ZY0e1dwqWHUA7CbahSzyxyKvIZwFy2lHweYJAj/VZmqSiupvPpLX5aSz8m 2kKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=K4+xRIl2; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i1si8978918ejy.363.2021.11.04.16.39.50; Thu, 04 Nov 2021 16:40: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; dkim=pass header.i=@linux-foundation.org header.s=google header.b=K4+xRIl2; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230379AbhKDXkY (ORCPT + 99 others); Thu, 4 Nov 2021 19:40:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229725AbhKDXkY (ORCPT ); Thu, 4 Nov 2021 19:40:24 -0400 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D5A3C061714 for ; Thu, 4 Nov 2021 16:37:45 -0700 (PDT) Received: by mail-lj1-x229.google.com with SMTP id d23so12119431ljj.10 for ; Thu, 04 Nov 2021 16:37:45 -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=k/7ABId1w+SwePxMKe2ECJzfJeP7icSvUD+APyYpSxXJPL1f9VFpr5WjbKNqWLsKYA oV/v9ktydPdIX71rqR2O3/ROqJtQE3fPZIVjJndXpcGXJiDZjnBYux+a9VrtkxFSsyoW HP7qAxGf6GBVRAxttO0trOyGuqS7wtZw+hFKtNFWDulLyS0Gs18ebSXpB7X8UIz6JLDo KiUJ/w2nRDmC4H1rnhwJCDJMLbktB2TfWbKOxAr1rvsOSmqiwijWVdjA5Otqimf06k7Q VyKPqtXvJZwSMFPp+kkCUsg/UZkVcvtkoIxy5aBcQGJXUjFRKdRAb6p9zKtm8i+qSTUv ilrw== X-Gm-Message-State: AOAM532XHvQIzStIh/K9UsPJjWL8Q9lVLXfIglInJlW+Fn6cqQQkBkx2 vB+XyxSJSuW3hBRWRWlugmWIoIECjnD0z+ym X-Received: by 2002:a2e:3009:: with SMTP id w9mr19921470ljw.214.1636069062392; Thu, 04 Nov 2021 16:37:42 -0700 (PDT) Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com. [209.85.208.174]) by smtp.gmail.com with ESMTPSA id k14sm328569lfu.161.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-f174.google.com with SMTP id g3so12125452ljm.8 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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