Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2141418yba; Fri, 17 May 2019 11:09:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqzpheIWHBtgf0gWg7A+weAgrjbHdSu7+azCkfm/7toaw/LBcNNYSyCdSa2pIoi9cDLvZCje X-Received: by 2002:a63:c02:: with SMTP id b2mr41565305pgl.5.1558116594284; Fri, 17 May 2019 11:09:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558116594; cv=none; d=google.com; s=arc-20160816; b=n+0mf4GjS70yE//kht4XHa6Fi0rSLW4zitc2tDUR6gic8ZQePsFzaXdhSQR6RlxIJd KY6dQUhAFRLEGeh0C9dtFPowdzIsj5t4X+8k8VQgASMQJW9zAgUVsUk/k73wXmdJcTVs bDmX8I/In2uAIZy8CYey6W4iM0i4QQl747yhbZPuC2EBJdpiAosQBpnKT38a4fTEkK9a NO6xl5Rx0tM3agP4sWD7ORjkcprr6dLDtgd6tLhdR+NLxqSOVnBXacbiBZJzXyJFn6O7 JUhX10F1Ajdc041tsKpMwEgzE2bQFuCIAkJFKy8lSs20pxdBnFGn+1fAtC4cols+GbeO KAjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=naBDVzNGnuVxSb0pTsKKkPbTR5+S/nyhRezxbIQImGI=; b=ULN+rqCGO3rb4vLDIaANifl/Yz0n/hnplQncNxNXvJsxl24EvOw/W++1cPfhDO0A5U 3J77kbJo5MD8HxfI6qIm/S6tKjxdcbOiqOEUoNFeUUXlJuKSU+Wo1db95nnYYtolEdPX WlcnHV7r+m3pmljBOWk/iKhzFq/5mvXE970PlmPRV6GcyjDfS12VypOTqIwFu2akWceM Oszdnr6Jl72GVbpZ4y6juIRj0FDTNFn5/mhLPIXoDEvTB6SSqvgBe5t5GtPz8pToDWQ+ 5Vdz4UesMwvaxxvsBHm0SVnmrXsW8XhG/bWt0AzwBWbksg8R2KEPnK0fWG5ZKzTPFubb +Ycg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=NxDO9Mih; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y125si10065629pfb.115.2019.05.17.11.09.38; Fri, 17 May 2019 11:09:54 -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=@gmail.com header.s=20161025 header.b=NxDO9Mih; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728100AbfEQRPO (ORCPT + 99 others); Fri, 17 May 2019 13:15:14 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:45972 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728073AbfEQRPO (ORCPT ); Fri, 17 May 2019 13:15:14 -0400 Received: by mail-wr1-f65.google.com with SMTP id b18so7878394wrq.12 for ; Fri, 17 May 2019 10:15:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=naBDVzNGnuVxSb0pTsKKkPbTR5+S/nyhRezxbIQImGI=; b=NxDO9Mihh7z44KOHGLa6bSIJFZtx6H541W8inGiEpi2KcfUSXgBzbBn7f4uVmM+pG+ 7ta8+rCgV7E7zl2TLDmSa5qDNQMoBpBX1OvnmCWObWviXUBH0VEB9RhQOXaHUx7PbMuD aHeglqmIiT3aO1d85gHDKdLdPsb3QNfy58Rgwv4x5nvw3mUySlxt7fNF69QdyzULLJJn MiYwTrxydOHyxxcDd894x9LkF9si91JZBvx67YHxBf70PQCI19ohuVVMPdXQaBDD423n jBTzHlrTPaaC1tURHSGQuPVfAktXZcNxm9Fg/F6K0dW0OAcbQxZKGuweqf80DDJlY2ju mJ7w== 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:mime-version :content-transfer-encoding; bh=naBDVzNGnuVxSb0pTsKKkPbTR5+S/nyhRezxbIQImGI=; b=fedRwm3lcq7KpjcpZJAW37ovKPwxYs6fVyXuoxCbTsB6fT5/mtpmlhyCqwvWpLXDdT xXxOfg0kiR2LKr0XLfhDGPCRdgV8Q3xhHOIW0VhWS/nWT+9ZqYelbMI2Wp7fOoAWzSFA HVDUU1tIeJZXil0V5P3CxUuV8ljDtvQpp2G8wzxtvQzQTO71CrNQa1GSeMGi1Ql1K7Gz K8XtvHnK7dsYfOtxBD7Yhdwv8hRaF2SYQa0vWphaTV/1J57Loxmywez4MF/R8V8eimfU X1kLQxuzYK65J5LsgAxgTE5P1vJgoi/kl+if+uYRwvwxwpS2dkZwxPsPzFiKz4rRt8bl S8TQ== X-Gm-Message-State: APjAAAX2iKrDMhzwInn4jP89gu+q8m7QZT74+j/fkigwdv2bmK/EY1ch SENJPsl+nBEVIAyUsppSZyU= X-Received: by 2002:a5d:5506:: with SMTP id b6mr33951846wrv.221.1558113312505; Fri, 17 May 2019 10:15:12 -0700 (PDT) Received: from dvyukov-desk.muc.corp.google.com ([2a00:79e0:15:13:4c1a:d2d1:436c:979b]) by smtp.gmail.com with ESMTPSA id r2sm17816331wrr.65.2019.05.17.10.15.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 May 2019 10:15:11 -0700 (PDT) From: Dmitry Vyukov To: catalin.marinas@arm.com, akpm@linux-foundation.org Cc: Dmitry Vyukov , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] kmemleak: fix check for softirq context Date: Fri, 17 May 2019 19:15:07 +0200 Message-Id: <20190517171507.96046-1-dvyukov@gmail.com> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(). Signed-off-by: Dmitry Vyukov Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org --- mm/kmemleak.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/kmemleak.c b/mm/kmemleak.c index e57bf810f7983..6584ff9778895 100644 --- 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 { -- 2.21.0.1020.gf2820cf01a-goog