Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4457085pxf; Tue, 16 Mar 2021 14:07:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgfDyGyBFWN+ka6/fMXMHptM0sQc9Onlv37or7+wJnjOFhBA9rITRcQGchSC8ghHcBbqw+ X-Received: by 2002:a17:907:3e92:: with SMTP id hs18mr31128544ejc.396.1615928822971; Tue, 16 Mar 2021 14:07:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615928822; cv=none; d=google.com; s=arc-20160816; b=fN+EuZ+rIzTBhLHCb8HY/LHYrpXIHz2LX8jgy1syktxPBcuR9dkuPdfAZ3419Azcix f1EYEWuSK0rpoQQ+L0GAyA6F2+a80HUEoiuE2wYD51X3gXqTmFVL62q7yaS2R5CN9rF9 cEFh9s1i/yERC/V/lDBZYKUjDrHAoKN4FALmMpYtC620e2nEI6SALZ6YTLbcof+QCHSu LWCw1B73FEt4fB6VbwmLfBVmbIGu/j1V6foIh0ijnvmgDaqdfgLF5mtXUEbPLlMiLuvn szmdUkX3yBNpEDJNU+AWBNtsALhvXQEqfpT964Ud3Z5e2QvOEHHOQNIvMu+tHWeR/gaY IZ5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=zgzLh55DAmWA/GfmPuORdH4VvlXb9rglZIg/BnJ+bFk=; b=UvBCZhSnHSC69/PcDG/cQnd01OYiwSDW/ObtSd62cfI8Z4malNoOnmR2qikejhmPch lVyYKvuIrvT+PaNqT6YLGBur+iF4oeZ01xkK/NPJKWf0j7LiYiLI8EUotSytdhi4NRew X8IzxH2vpujrq8gEYbyxVHA8kX3EFX4bP7Wyqn9jdZhOAwpLWS7eBQZoaHcVypPwK3x/ ZUR3MUG7Z/yE/jJR5LQMVGF8rM4R8Jesls3QeUNvXobzFJUMF23VguDDRtD2gKoIrUzV xCw4I5RpZJqpPdhK5of5hLhJAn+72bTaB7t/RFOJDBbhAUEVVtwbZ4IpTEoV/Ph5tgZD urDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RfJlUe04; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cb21si14390904ejb.170.2021.03.16.14.06.40; Tue, 16 Mar 2021 14:07:02 -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=@kernel.org header.s=k20201202 header.b=RfJlUe04; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229955AbhCPRol (ORCPT + 99 others); Tue, 16 Mar 2021 13:44:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:38792 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231978AbhCPRob (ORCPT ); Tue, 16 Mar 2021 13:44:31 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 768546511D; Tue, 16 Mar 2021 17:44:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1615916671; bh=70urjVlzuIkBAAt6z/A7aEgLJGDaoFtxXpjtZaip/+I=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=RfJlUe04rO0XegYU6UvIVXzCZTbC5LlaWuudIWIYH50c1pgyq4U5a3vutog1RttNx uRcmoqxQeEjCc2raxL4arPFYnhaSQqS/lwLLDrf74yhqjbCg0kDjLqUuL9rCMlHj6S Y6LO5SAQfiSR+ThRrKq4A78hZQHl1VEaWZT+K3Ag0Hc9YgLGIm81CAz8vVl/VhTBM2 pxczDjGsHE95fM072hLdrb30mEB+jKxKuA8phptAv2uHTw+ISLr7RDtZXfTD4euFvn kwnvgkuk/T9wPBKgQCg/L9hNhAW351k4tEtDnjKsCMFkkZ8cwqQYq+DJWSoPDM+RkQ WYkPtLQfpoN9Q== Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id 42827352262D; Tue, 16 Mar 2021 10:44:31 -0700 (PDT) Date: Tue, 16 Mar 2021 10:44:31 -0700 From: "Paul E. McKenney" To: Maninder Singh Cc: linux@armlinux.org.uk, cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, vbabka@suse.cz, 0x7f454c46@gmail.com, viro@zeniv.linux.org.uk, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, a.sahrawat@samsung.com, Vaneet Narang Subject: Re: [PATCH 1/3] mm/slub: fixing backtrace of objects because of redzone adjustment Message-ID: <20210316174431.GX2696@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <1615891032-29160-1-git-send-email-maninder1.s@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1615891032-29160-1-git-send-email-maninder1.s@samsung.com> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 16, 2021 at 04:07:10PM +0530, Maninder Singh wrote: > fixing commit 8e7f37f2aaa5 ("mm: Add mem_dump_obj() to print source > of memory block") > > with current code, Backtrace of allocated object is coming wrong: > / # cat /proc/meminfo > [ 14.969843] slab kmalloc-64 start c8ab0140 data offset 64 pointer offset 0 size 64 allocated at 0x6b6b6b6b > [ 14.970635] 0x6b6b6b6b > [ 14.970794] 0x6b6b6b6b > [ 14.970932] 0x6b6b6b6b > [ 14.971077] 0x6b6b6b6b > [ 14.971202] 0x6b6b6b6b > [ 14.971317] 0x6b6b6b6b > [ 14.971423] 0x6b6b6b6b > [ 14.971635] 0x6b6b6b6b > [ 14.971740] 0x6b6b6b6b > [ 14.971871] 0x6b6b6b6b > [ 14.972229] 0x6b6b6b6b > [ 14.972363] 0x6b6b6b6b > [ 14.972505] 0xa56b6b6b > [ 14.972631] 0xbbbbbbbb > [ 14.972734] 0xc8ab0400 > [ 14.972891] meminfo_proc_show+0x40/0x4fc > > And reason is red zone was not adjusted from object address. > after adding fixup for redzone, backtrace is coming correct: > / # cat /proc/meminfo > [ 14.870782] slab kmalloc-64 start c8ab0140 data offset 64 pointer offset 128 size 64 allocated at meminfo_proc_show+0x40/0x4f4 > [ 14.871817] meminfo_proc_show+0x40/0x4f4 > [ 14.872035] seq_read_iter+0x18c/0x4c4 > [ 14.872229] proc_reg_read_iter+0x84/0xac > [ 14.872433] generic_file_splice_read+0xe8/0x17c > [ 14.872621] splice_direct_to_actor+0xb8/0x290 > [ 14.872747] do_splice_direct+0xa0/0xe0 > [ 14.872896] do_sendfile+0x2d0/0x438 > [ 14.873044] sys_sendfile64+0x12c/0x140 > [ 14.873229] ret_fast_syscall+0x0/0x58 > [ 14.873372] 0xbe861de4 > > Signed-off-by: Vaneet Narang > Signed-off-by: Maninder Singh Good catch, thank you! For the series: Acked-by: Paul E. McKenney On the other hand, if you would like me to take these, we need to get a maintainer ack. Thanx, Paul > --- > mm/slub.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/mm/slub.c b/mm/slub.c > index 1912c4614248..9d13f0117ae6 100644 > --- a/mm/slub.c > +++ b/mm/slub.c > @@ -4052,6 +4052,7 @@ void kmem_obj_info(struct kmem_obj_info *kpp, void *object, struct page *page) > !(s->flags & SLAB_STORE_USER)) > return; > #ifdef CONFIG_SLUB_DEBUG > + objp = fixup_red_left(s, objp); > trackp = get_track(s, objp, TRACK_ALLOC); > kpp->kp_ret = (void *)trackp->addr; > #ifdef CONFIG_STACKTRACE > -- > 2.17.1 >