Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp6253352imm; Mon, 23 Jul 2018 14:27:05 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdv7uhs5nizqjVPWVRB9sjm026WC58SdJGYxmJx6yTvqpqE/Ai0h76BkQRBx4dPad6kt50k X-Received: by 2002:a17:902:8f93:: with SMTP id z19-v6mr13525205plo.241.1532381225285; Mon, 23 Jul 2018 14:27:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532381225; cv=none; d=google.com; s=arc-20160816; b=UsDwhuO8J8JoJP5mIUZlZ+r2qB+IQt8lznSHRtasiy+7DH+pIUE7IHNSKV9NUAgrur rlSkwj6/99VCmyveTOnLg8yLJ8hC0ln6yavb+/zVj1NrJTldQ7qCBjai2kzqSeBNrwAw DP4eo5VYoVxbLHLhzXTDrHJCvXBSXCylYi7+DOcHpHGHNf96Fom2XVRwLk2H1DgGS6Uy Y7e153O9jtCC9mvA50x5bw1UGHCYonw85XQ9rqjWIOKA1iXIAI8KLOHXoHP/UhvLf+CM LvZqPg8KK3PzNOC6+y9t1JLMqI0B2F/JvqFvEkXlms+zDZ7M7ZMNI6GeL6NSQt8STSZS UPVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=hlCo+jEla7bCsy6IQBxQSeY02tTrx2HhS4JSBi4ALWU=; b=uhImONoQrEDpogqw8EPUFC1RnRa1Q+9kxPEqzuoTwUla2QKnbgJwbMK6h9GFuDtp6h Rwru+ioWOfyP5Sj0GngMovkP4I17BZLDlFmE8XFwIEwBfuNucBdLMnVHDDEJhLjCyOnB NkDxvaS29r1+UAdHXKjSY5+rrrE5MMDKhLxRSqdi0at6T+XWpACHm1nt+wq8056tM3+6 HI4Ev6608EEoJvswEt49e8wYM/QV4QkzaYmu67KAgqvPR2LZpTVIzydMV4Ki/kSBGyjG R5Jfcgpi88wKRSIMRMeVAXviXlQNYp5v//hVD1gSGEc/Y6SwNhF82+tlt1yTx/v9Ht1O Ko1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=MO+TauK7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d6-v6si9580579pgh.569.2018.07.23.14.26.50; Mon, 23 Jul 2018 14:27:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=MO+TauK7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388161AbeGWW2q (ORCPT + 99 others); Mon, 23 Jul 2018 18:28:46 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:34013 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388105AbeGWW2q (ORCPT ); Mon, 23 Jul 2018 18:28:46 -0400 Received: by mail-pf1-f193.google.com with SMTP id k19-v6so341453pfi.1 for ; Mon, 23 Jul 2018 14:25:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=from:to:cc:subject:date:message-id; bh=hlCo+jEla7bCsy6IQBxQSeY02tTrx2HhS4JSBi4ALWU=; b=MO+TauK7LDH6jkMX1l6m+7wf+mQsguuP8Mf2VyUnuvbXCNJuhqTuSvhb6j6xDrwGjP UzSHiuSTXORCoLIMTUS6ypC9b9GefAWYE2vmxT28tFLUy7VOSUbR8BcfR/cD74E0xoJM S+QCp96ryqtpufM3kdYSG1ue3w9bPttSZuBWM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=hlCo+jEla7bCsy6IQBxQSeY02tTrx2HhS4JSBi4ALWU=; b=XgpfZKuBAssRfSix+gG5vHTernHhDOLLcpNfE4tgV8J21rEs1MZ4XxI0VO/emKokV+ 5i+XKfd96sJsb6pffAQhZh0krYig5Jjrt18PPhfmiSWhRAKWYo1VEHAr9Ftsnvy/oTri v5j9+sIVVgGUXrnWxtDzAVtR9BIINlFbh/qLejdvkFDbU/+beqVeGwpzt5GYSS5fgPLe K0yO1ctPTAXwt3kas8ofcxtqc7ax9oPsClnr4DIGi+J27g9JH1E2MfI8Frpfz6bswAwx sGkmouHpo9UyJfljAZcq6RIUi3OLjXwadkQ+jlc9S4qZlzpQbeCsRYDzjNawN7C4vnOG tCGA== X-Gm-Message-State: AOUpUlHFHnboLPO526QbUjT4xFteuY04Mcg2AQo0t6PGAXDCFEkW48uB UZ8HOES1kJcxxfzgnmKJxOZXbqdgik4= X-Received: by 2002:a62:129a:: with SMTP id 26-v6mr14889103pfs.102.1532381140559; Mon, 23 Jul 2018 14:25:40 -0700 (PDT) Received: from joelaf.mtv.corp.google.com ([2620:0:1000:1600:3122:ea9c:d178:eb]) by smtp.gmail.com with ESMTPSA id y33-v6sm13611453pga.41.2018.07.23.14.25.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Jul 2018 14:25:40 -0700 (PDT) From: Joel Fernandes To: linux-kernel@vger.kernel.org Cc: kernel-team@android.com, "Joel Fernandes (Google)" , Thomas Gleixner , Yang Shi , Waiman Long , Arnd Bergmann , astrachan@google.com Subject: [PATCH RFC] debugobjects: Make stack check warning more informative Date: Mon, 23 Jul 2018 14:25:31 -0700 Message-Id: <20180723212531.202328-1-joel@joelfernandes.org> X-Mailer: git-send-email 2.18.0.233.g985f88cf7e-goog Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Joel Fernandes (Google)" Recently we debugged an issue where debugobject tracking was telling us of an annotation issue. Turns out the issue was due to the object in concern being on a different stack which was due to another issue. Discussing with tglx, he suggested printing the pointers and the location of the stack for the currently running task. This helped find the object was on the wrong stack. I turned the resulting patch into something upstreamable, so that the error message is more informative and can help in debugging for similar issues in the future. Signed-off-by: Joel Fernandes (Google) --- lib/debugobjects.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/debugobjects.c b/lib/debugobjects.c index 994be4805cec..24c1df0d7466 100644 --- a/lib/debugobjects.c +++ b/lib/debugobjects.c @@ -360,9 +360,12 @@ static void debug_object_is_on_stack(void *addr, int onstack) limit++; if (is_on_stack) - pr_warn("object is on stack, but not annotated\n"); + pr_warn("object %p is on stack %p, but NOT annotated.\n", addr, + task_stack_page(current)); else - pr_warn("object is not on stack, but annotated\n"); + pr_warn("object %p is NOT on stack %p, but annotated.\n", addr, + task_stack_page(current)); + WARN_ON(1); } -- 2.18.0.233.g985f88cf7e-goog