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 782FAC433F5 for ; Mon, 4 Apr 2022 15:19:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 13DA86B0073; Mon, 4 Apr 2022 11:19:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0ED9F6B0074; Mon, 4 Apr 2022 11:19:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EF5AA6B0075; Mon, 4 Apr 2022 11:19:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0195.hostedemail.com [216.40.44.195]) by kanga.kvack.org (Postfix) with ESMTP id E10296B0073 for ; Mon, 4 Apr 2022 11:19:03 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id A50E2183D9830 for ; Mon, 4 Apr 2022 15:18:53 +0000 (UTC) X-FDA: 79319554146.26.DF77FB0 Received: from mail-yb1-f178.google.com (mail-yb1-f178.google.com [209.85.219.178]) by imf13.hostedemail.com (Postfix) with ESMTP id 3F07120027 for ; Mon, 4 Apr 2022 15:18:53 +0000 (UTC) Received: by mail-yb1-f178.google.com with SMTP id o62so3181623ybo.2 for ; Mon, 04 Apr 2022 08:18:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2VxKE2AF5CaxNXJB6azVDEKw7atOLqH2N7X5sbmlz7w=; b=qgvOKqP7mwT72Kdyn1pQiRXBm1hg7vV8g9aRSrPJRBem1N/PNdhCbaZFMjvQba3l0m /ejLnk37Q8AR/Pnqvv2j6S40dC7+fktYVmQKnKDpvE095ZhaFtR/Ln4k4zV1BYEQp1FE OZSrDzRnpm4Ms5Rel+ZWDk5KLGuh82BzzgPhMvDH9YW4b7fKg/DCWeCR47z2kOP82KaG O5Fx8Im2o/doRmeONC+aSTvCWD7ASBDNGD4gu+WFNXR3BJuWGnfGHxQOApZuMDNmNaN0 0GDpG8i5CkGswIxCzYAx/yZxs/2HBqXQ+CX6ay/OP1Qig0XkLHQHm4Lzc5B4eqRNK87L OtVg== 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:cc; bh=2VxKE2AF5CaxNXJB6azVDEKw7atOLqH2N7X5sbmlz7w=; b=5QiwiYAOTJe4GkD0pknqPdUfLyaLGcd9VJJ5dUMhA6MNqS9X9RzxHx4j8rPqiLBRqs frvdQU4uXYYhFARcYxyq8TgatHWaU/RyQcguavVEnUHx0m4R4wp+vjI3scrb1UFSQ5QZ YYQ6U98j+iapRePGVLAzqn6WXX28iKO1Qv1qeWmAvxfpfrjHBzbvA4YoXCP3swgXtMen hi6AHWxZ8QnFZzTUULP9h4dhEPrmRXs4EIF4dHLxDt/WzB2idVNmYby/SoGsbmuCC1qu gEP9n6N+IE6+q/MmOSfMfoWTwK7Ft09hU/NXeTckHiBdCeX5AxS0G/9WO5o+NVgy6Lff sT4Q== X-Gm-Message-State: AOAM531Jst2egROisJuZFn/SrNkC8iF2uSY1oYLKa+BQ0PyO4npAgLZb NapX3VBPNqH+qh+BswfhvOoKBoA5xx/bwkMNB4gbqw== X-Google-Smtp-Source: ABdhPJwf6GddFAzNwff1T7O2bqehRsev2EcIU/mkMhEyZkZKubk/JJpVqk9zSQE96tAMKHwTLfyuokDLG3uiAHKMnOE= X-Received: by 2002:a25:9b85:0:b0:63d:ad6c:aae8 with SMTP id v5-20020a259b85000000b0063dad6caae8mr223324ybo.609.1649085532340; Mon, 04 Apr 2022 08:18:52 -0700 (PDT) MIME-Version: 1.0 References: <20220323090520.GG16885@xsang-OptiPlex-9020> <20220324095218.GA2108184@odroid> <8368021e-86c3-a93f-b29d-efed02135c41@suse.cz> In-Reply-To: <8368021e-86c3-a93f-b29d-efed02135c41@suse.cz> From: Marco Elver Date: Mon, 4 Apr 2022 17:18:16 +0200 Message-ID: Subject: Re: [mm/slub] 555b8c8cb3: WARNING:at_lib/stackdepot.c:#stack_depot_fetch To: Vlastimil Babka Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>, kernel test robot , Oliver Glitta , lkp@lists.01.org, lkp@intel.com, LKML , Imran Khan , Andrey Konovalov , Zhen Lei , Zqiang , linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 3F07120027 X-Rspam-User: Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=qgvOKqP7; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf13.hostedemail.com: domain of elver@google.com designates 209.85.219.178 as permitted sender) smtp.mailfrom=elver@google.com X-Stat-Signature: brcjhwdmje5jbmkuex7p5imi46p57wpj X-HE-Tag: 1649085533-181150 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 Mon, 4 Apr 2022 at 16:20, Vlastimil Babka wrote: > > On 4/4/22 10:10, Marco Elver wrote: > > On Mon, Apr 04, 2022 at 12:05PM +0900, Hyeonggon Yoo wrote: > > (Maybe CONFIG_KCSAN_STRICT=y is going to yield something? I still doubt > > it thought, this bug is related to corrupted stackdepot handle > > somewhere...) > > > >> I noticed that it is not reproduced when KASAN=y and KFENCE=n (reproduced 0 of 181). > >> and it was reproduced 56 of 196 when KASAN=n and KFENCE=y > >> > >> maybe this issue is related to kfence? > > Hmm kfence seems to be a good lead. If I understand kfence_guarded_alloc() > correctly, it tries to set up something that really looks like a normal slab > page? Especially the part with comment /* Set required slab fields. */ > But it doesn't seem to cover the debugging parts that SLUB sets up with > alloc_debug_processing(). This includes alloc stack saving, thus, after > commit 555b8c8cb3, a stackdepot handle setting. It probably normally doesn't > matter as is_kfence_address() redirects processing of kfence-allocated > objects so we don't hit any slub code that expects the debugging parts to be > properly initialized. > > But here we are in mem_dump_obj() -> kmem_dump_obj() -> kmem_obj_info(). > Because kmem_valid_obj() returned true, fooled by folio_test_slab() > returning true because of the /* Set required slab fields. */ code. > Yet the illusion is not perfect and we read garbage instead of a valid > stackdepot handle. > > IMHO we should e.g. add the appropriate is_kfence_address() test into > kmem_valid_obj(), to exclude kfence-allocated objects? Sounds much simpler > than trying to extend the illusion further to make kmem_dump_obj() work? > Instead kfence could add its own specific handler to mem_dump_obj() to print > its debugging data? I think this explanation makes sense! Indeed, KFENCE already records allocation stacks internally anyway, so it should be straightforward to convince it to just print that. Thanks, -- Marco