From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by gnuweeb.org (Postfix) with ESMTPS id 4530B81885 for ; Sun, 11 Dec 2022 18:33:31 +0000 (UTC) Authentication-Results: gnuweeb.org; dkim=pass (1024-bit key; unprotected) header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=google header.b=MGBmNEXQ; dkim-atps=neutral Received: by mail-pj1-f49.google.com with SMTP id o1-20020a17090a678100b00219cf69e5f0so13317534pjj.2 for ; Sun, 11 Dec 2022 10:33:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=VcIjNZvmXhwLlIH4qzTb3os7YT1CTCX89zz+g7s11S8=; b=MGBmNEXQ9KDFHMWkhfA16f3WXE9+n6bQWGbQ/WBcrwvvD7XGUxNJ4lULAQ4bF52hyX I45Gmp4HDqpBwWuXX3l+4nvpELR0hLZgp15u/sM1JcfxMioNWKmTXOmZ3q/OnbB9HyzY NTeZGgpA0T0hHbjbfhGwL2uIoepMHlEZ6wf+E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=VcIjNZvmXhwLlIH4qzTb3os7YT1CTCX89zz+g7s11S8=; b=fcGcQeUURBqmno/NibQaoZ7y8DtvJpnrZZnw1+1lrbREUVwcT4rMueOzGjEOst3E/C rRljECb0CPAvCwVpdIhyByTaJns5y0FNnLK2WcBtrEiG2k/tANi8nTIMXxkKEwT29ZV9 JINeT6igflFMpwMD4+9Yi6vo52zbjMxKoYZxbRiWtOS+BMhmv1SBK3qZ+Di5FlXWBua+ bIK4teHQOnAXwduAVYt36SvoyTTpCNlc8Cp9eHJt0CZLWedsIwErTnADwV9VVxpGiQAm JXH7huv+1DMHyxLQdlzR5hnOim1y7KahoVWLJzgVEjQ4X8sq0PmlYWZjMI9dLIpOJ0M5 PdJQ== X-Gm-Message-State: ANoB5pl/cDIuAZdsqE0pZsb3dp+SDMavOZChYpq6PiAyjkLxiVRKiH2e RoAbQtx2pBr0KRb0QVBG/eOOCuxlGc4KgZkH X-Google-Smtp-Source: AA0mqf4a1Ay3f4nUBcLiUhu/9zhezCiMtk7vPJBcj/6VNScRUHMyQhMynDvfzh2SWf59Kx0JUzPf7A== X-Received: by 2002:a17:90a:71c3:b0:218:9f7b:4818 with SMTP id m3-20020a17090a71c300b002189f7b4818mr13652593pjs.36.1670783610321; Sun, 11 Dec 2022 10:33:30 -0800 (PST) Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com. [209.85.214.179]) by smtp.gmail.com with ESMTPSA id gq10-20020a17090b104a00b0020dc318a43esm4025018pjb.25.2022.12.11.10.33.30 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 11 Dec 2022 10:33:30 -0800 (PST) Received: by mail-pl1-f179.google.com with SMTP id g10so9856032plo.11 for ; Sun, 11 Dec 2022 10:33:30 -0800 (PST) X-Received: by 2002:ad4:4101:0:b0:4b1:856b:4277 with SMTP id i1-20020ad44101000000b004b1856b4277mr70224982qvp.129.1670783284766; Sun, 11 Dec 2022 10:28:04 -0800 (PST) MIME-Version: 1.0 References: <202212112131.994277de-oliver.sang@intel.com> In-Reply-To: <202212112131.994277de-oliver.sang@intel.com> From: Linus Torvalds Date: Sun, 11 Dec 2022 10:27:48 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [ammarfaizi2-block:dhowells/linux-fs/fscache-fixes] [mm, netfs, fscache] 6919cda8e0: canonical_address#:#[##] To: kernel test robot Cc: David Howells , oe-lkp@lists.linux.dev, lkp@intel.com, Rohith Surabattula , Matthew Wilcox , Steve French , Shyam Prasad N , Dave Wysochanski , Dominique Martinet , Ilya Dryomov , Ammar Faizi , "GNU/Weeb Mailing List" , v9fs-developer@lists.sourceforge.net, linux-afs@lists.infradead.org, linux-cachefs@redhat.com, ceph-devel@vger.kernel.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" List-Id: The disassembly isn't great, because the test robot doesn't try to find where the instructions start, but before that > 4: 48 8b 57 18 mov 0x18(%rdi),%rdx instruction we also had a mov (%rdi),%rax and it looks like this is the very top of 'filemap_release_folio()', so '%rdi' contains the folio pointer coming into this. End result: On Sun, Dec 11, 2022 at 6:27 AM kernel test robot wrote: > > 4: 48 8b 57 18 mov 0x18(%rdi),%rdx > 8: 83 e0 01 and $0x1,%eax > b: 74 59 je 0x66 The and $0x1,%eax je 0x66 above is the test for BUG_ON(!folio_test_locked(folio)); where it's jumping out to the 'ud2' in case the lock bit (bit #0) isn't set. Then we have this: > d: 48 f7 07 00 60 00 00 testq $0x6000,(%rdi) > 14: 74 22 je 0x38 Which is testing PG_private | PG_private2, and jumping out (which we also don't do) if neither is set. And then we have: > 16: 48 8b 07 mov (%rdi),%rax > 19: f6 c4 80 test $0x80,%ah > 1c: 75 32 jne 0x50 Which is checking for PG_writeback. So then we get to if (mapping && mapping->a_ops->release_folio) return mapping->a_ops->release_folio(folio, gfp); which is this: > 1e: 48 85 d2 test %rdx,%rdx > 21: 74 34 je 0x57 This %rdx value is the early load from the top of the function, it's checking 'mapping' for NULL. It's not NULL, but it's some odd value according to the oops report: RDX: ffff889f03987f71 which doesn't look like it's valid (well, it's a valid kernel pointer, but it's not aligned like a 'mapping' pointer should be. So now when we're going to load 'a_ops' from there, we load another garbage value: > 23: 48 8b 82 90 00 00 00 mov 0x90(%rdx),%rax and we now have RAX: b000000000000000 and then the 'a_ops->release_folio' access will trap: > 2a:* 48 8b 40 48 mov 0x48(%rax),%rax <-- trapping instruction > 2e: 48 85 c0 test %rax,%rax > 31: 74 24 je 0x57 The above is the "load a_ops->release_folio and test it for NULL", but the load took a page fault because RAX was garbage. But RAX was garbage because we already had a bogus "mapping" pointer earlier. Now, why 'mapping' was bogus, I don't know. Maybe that page wasn't a page cache page at all? The mapping field is in a union and can contain other things. So I have no explanation for the oops, but I thought I'd just post the decoding of the instruction stream in case that helps somebody else to figure it out. Linus