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 X-Spam-Level: X-Spam-Status: No, score=-15.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C42EC2B9F4 for ; Thu, 17 Jun 2021 09:22:58 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BD5A8613DF for ; Thu, 17 Jun 2021 09:22:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BD5A8613DF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3D1646B0070; Thu, 17 Jun 2021 05:22:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 380DA6B0071; Thu, 17 Jun 2021 05:22:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1FC716B0072; Thu, 17 Jun 2021 05:22:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0151.hostedemail.com [216.40.44.151]) by kanga.kvack.org (Postfix) with ESMTP id DF5C86B0070 for ; Thu, 17 Jun 2021 05:22:56 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 76751180AD806 for ; Thu, 17 Jun 2021 09:22:56 +0000 (UTC) X-FDA: 78262676352.19.D7CCD04 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf22.hostedemail.com (Postfix) with ESMTP id 2C03FC00CBD7 for ; Thu, 17 Jun 2021 09:22:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623921775; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=3KysMvllyHPoDyzaTHkhdiOfQlu8vxXEh89IxvBC1IU=; b=E1jvYpUtjq5e56jtHl64G6a2uKd09ldWzHdBdjvQurd3FRvRiHhb+YwZcvN/noBoQeXcPr Em9zSxc4/zOlu91r/iK2dfUKXRZTdqcyFbdad47NTT7EV+W0U/ODJ4aHDVZvCygRH7/wBy Yyp3TjxIPR9ECOFr2v5PzY0MEA5nc3c= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-437-qLMlqpKgOByG1vMcsxi_sA-1; Thu, 17 Jun 2021 05:22:51 -0400 X-MC-Unique: qLMlqpKgOByG1vMcsxi_sA-1 Received: by mail-wm1-f69.google.com with SMTP id l25-20020a1c79190000b02901c7057f03d1so1915546wme.4 for ; Thu, 17 Jun 2021 02:22:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=3KysMvllyHPoDyzaTHkhdiOfQlu8vxXEh89IxvBC1IU=; b=B9z7+78+smKVbQ9YgZ7NQio33rkUzP93pqi/vgGOCtg2fy4wmRsxp7UhJwGHoH++hH S8PDAVbDH3Ta/x6gxEGeFjOQNkQd3U+jcSgltvbeAkTmZYplVNVDN5EYF9oUcRQhTGE/ VK57eFDvyePqFozwU/OU7yBtUfaHqUEmhV245o+0auMzPl/K45qwoKbSIp/9uDQKKrx2 DEdtK9uRxkM14gY5DZRah1SYpeCSZXWXAoFknEIppuklBiefqi6mfzO6Wfps72/mtrZw W5KIQpaQhy9Pulv++9p9unR0Ho4iUnrVYAvBypm6t6AEU8l4dI+ET6gDxw0KpKcWtNSf QFYQ== X-Gm-Message-State: AOAM530KU8s2PuzNjMzDkRYjImZetlL7r+928aB6Y2DldmX/FFoAvIQt 905Y7GI4ZF1xu0Kq3ZcYNFcq+frkY4nMvh/QSslPtqX2GzvKThSLBDHrIta7XEzNaqtiKaPoz5+ t823k657QBQ== X-Received: by 2002:a1c:9dd4:: with SMTP id g203mr3940614wme.132.1623921770695; Thu, 17 Jun 2021 02:22:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtAXwHrTnFjJ33bdE+rVfG/hzys+v4plGgnWztV9/gYM8Kp47+O94Jytb/YjTPw/AXGcVjPw== X-Received: by 2002:a1c:9dd4:: with SMTP id g203mr3940576wme.132.1623921770396; Thu, 17 Jun 2021 02:22:50 -0700 (PDT) Received: from localhost (cpc111743-lutn13-2-0-cust979.9-3.cable.virginm.net. [82.17.115.212]) by smtp.gmail.com with ESMTPSA id f14sm4508599wri.16.2021.06.17.02.22.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 02:22:50 -0700 (PDT) Date: Thu, 17 Jun 2021 10:22:49 +0100 From: Aaron Tomlin To: Georgi Djakov Cc: vbabka@suse.cz, akpm@linux-foundation.org, iamjoonsoo.kim@lge.com, rientjes@google.com, penberg@kernel.org, cl@linux.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, djakov@kernel.org Subject: Re: [PATCH] mm/slub: Add taint after the errors are printed Message-ID: <20210617092249.5v6kh3q6skawkae6@ava.usersys.com> X-PGP-Key: http://pgp.mit.edu/pks/lookup?search=atomlin%40redhat.com X-PGP-Fingerprint: 7906 84EB FA8A 9638 8D1E 6E9B E2DE 9658 19CC 77D6 References: <1623860738-146761-1-git-send-email-quic_c_gdjako@quicinc.com> MIME-Version: 1.0 In-Reply-To: <1623860738-146761-1-git-send-email-quic_c_gdjako@quicinc.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=E1jvYpUt; spf=none (imf22.hostedemail.com: domain of atomlin@redhat.com has no SPF policy when checking 216.205.24.124) smtp.mailfrom=atomlin@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 2C03FC00CBD7 X-Stat-Signature: 3zy5ye6ab6x5f5whnfuorzougnrkim6o X-HE-Tag: 1623921764-495966 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 Wed 2021-06-16 09:25 -0700, Georgi Djakov wrote: > When running the kernel with panic_on_taint, the usual slub debug error > messages are not being printed when object corruption happens. That's > because we panic in add_taint(), which is called before printing the > additional information. This is a bit unfortunate as the error messages > are actually very useful, especially before a panic. Let's fix this by > moving add_taint() after the errors are printed on the console. > > Signed-off-by: Georgi Djakov > --- > mm/slub.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/mm/slub.c b/mm/slub.c > index a8b0daa1a307..ce7b8e4551b5 100644 > --- a/mm/slub.c > +++ b/mm/slub.c > @@ -719,8 +719,6 @@ static void slab_bug(struct kmem_cache *s, char *fmt, ...) > pr_err("=============================================================================\n"); > pr_err("BUG %s (%s): %pV\n", s->name, print_tainted(), &vaf); > pr_err("-----------------------------------------------------------------------------\n\n"); > - > - add_taint(TAINT_BAD_PAGE, LOCKDEP_NOW_UNRELIABLE); > va_end(args); > } > > @@ -801,6 +799,7 @@ void object_err(struct kmem_cache *s, struct page *page, > > slab_bug(s, "%s", reason); > print_trailer(s, page, object); > + add_taint(TAINT_BAD_PAGE, LOCKDEP_NOW_UNRELIABLE); > } > > static __printf(3, 4) void slab_err(struct kmem_cache *s, struct page *page, > @@ -818,6 +817,7 @@ static __printf(3, 4) void slab_err(struct kmem_cache *s, struct page *page, > slab_bug(s, "%s", buf); > print_page_info(page); > dump_stack(); > + add_taint(TAINT_BAD_PAGE, LOCKDEP_NOW_UNRELIABLE); > } > > static void init_object(struct kmem_cache *s, void *object, u8 val) > @@ -869,6 +869,7 @@ static int check_bytes_and_report(struct kmem_cache *s, struct page *page, > fault, end - 1, fault - addr, > fault[0], value); > print_trailer(s, page, object); > + add_taint(TAINT_BAD_PAGE, LOCKDEP_NOW_UNRELIABLE); > > skip_bug_print: > restore_bytes(s, what, value, fault, end); > Good catch. Thanks! Reviewed-by: Aaron Tomlin -- Aaron Tomlin