Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2785463yba; Sat, 18 May 2019 02:57:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqwhN1LS2mtjYuSNb5byE5HduG5ADN10i4LS2GbfTRe3d86VkxJLZmyeVUOlGz1/KVAee5W8 X-Received: by 2002:a65:60cd:: with SMTP id r13mr47269946pgv.58.1558173479414; Sat, 18 May 2019 02:57:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558173479; cv=none; d=google.com; s=arc-20160816; b=iZqgroNnW8r3zShO+10Qu9EaC12cPm7pz//clkRyELiIkjDeWndWcZ/KROw4jtXrf1 gsctOZf/ea7wwtFX/qSlIecOFuvBo04ZU9YS/QLTzUg5Fz5DdTiLnAL4JUVS8rwi3+eC KUPN45SFt+56LxNRaBL2zRAw2aDR40msTWxhHWTLrQ4eh+ZaghdJlI5jokQvydc2vJbE I+dcc/FP0WvgUt+biz3yTAnRC1s0XSOhKP6TT8svl4xPOzYD+sa5ewD7vkQt1PlfhZYX RDMPuEJQ5hFT842slvuXQdMNu8/Oj/7Qde4kGQXrTIOo5s1XoKjT78R+kAv2Q0+vVTmc EUZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=71Z2Z+j4OH7JUdBedNdHvl//zj7ZXton9MM81kWr6SE=; b=r30P0RxYifaeqSCtpUkOn+3t/03utyBrY0GCHK2NARx9DncFhcqXH+wJx2YUDXyKYp d+G4WzpGiUK3FgkMSwcUBMgiLSXmcZRwIJbWe16AWoLTSvmkW4Rp+AYp1WYdgJ7fXErw xqJrvcyzqgq8swylgcmDQIBibNbSQTs/fUt+28oJWY7xiEPYOkO58MMqKhvmAyoC7ZeV 4hLWjibNNGFdzSULaqyOtHT8OYS6OyNUT5nUYsJb43fAs24TUrTxI+I+/GbzIVUrb3sC 3rzQVGSwlBqbvSgmKX9juqr8g9o101eiSUMlPijdXBKtSZ7MdXJPxOJi97W1iQugO7bL NZWw== ARC-Authentication-Results: i=1; mx.google.com; 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 j191si6799544pgd.219.2019.05.18.02.57.44; Sat, 18 May 2019 02:57:59 -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; 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 S1729305AbfERJrZ (ORCPT + 99 others); Sat, 18 May 2019 05:47:25 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:51948 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725468AbfERJrZ (ORCPT ); Sat, 18 May 2019 05:47:25 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9AE37341; Sat, 18 May 2019 02:47:24 -0700 (PDT) Received: from mbp (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6D64A3F703; Sat, 18 May 2019 02:47:23 -0700 (PDT) Date: Sat, 18 May 2019 10:47:20 +0100 From: Catalin Marinas To: Dmitry Vyukov Cc: Andrew Morton , Dmitry Vyukov , Linux-MM , LKML Subject: Re: [PATCH] kmemleak: fix check for softirq context Message-ID: <20190518094719.gyvhbdrwmcv4diax@mbp> References: <20190517171507.96046-1-dvyukov@gmail.com> <20190517143746.2157a759f65b4cbc73321124@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 18, 2019 at 09:10:59AM +0200, Dmitry Vyukov wrote: > On Fri, May 17, 2019 at 11:37 PM Andrew Morton > wrote: > > On Fri, 17 May 2019 19:15:07 +0200 Dmitry Vyukov wrote: > > > > > From: Dmitry Vyukov > > > > > > in_softirq() is a wrong predicate to check if we are in a softirq context. > > > It also returns true if we have BH disabled, so objects are falsely > > > stamped with "softirq" comm. The correct predicate is in_serving_softirq(). > > > > > > ... > > > > > > --- a/mm/kmemleak.c > > > +++ b/mm/kmemleak.c > > > @@ -588,7 +588,7 @@ static struct kmemleak_object *create_object(unsigned long ptr, size_t size, > > > if (in_irq()) { > > > object->pid = 0; > > > strncpy(object->comm, "hardirq", sizeof(object->comm)); > > > - } else if (in_softirq()) { > > > + } else if (in_serving_softirq()) { > > > object->pid = 0; > > > strncpy(object->comm, "softirq", sizeof(object->comm)); > > > } else { > > > > What are the user-visible runtime effects of this change? > > If user does cat from /sys/kernel/debug/kmemleak previously they would > see this, which is clearly wrong, this is system call context (see the > comm): Indeed, with your patch you get the correct output. Acked-by: Catalin Marinas Thanks. -- Catalin