From patchwork Thu May 25 15:42:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catalin Marinas X-Patchwork-Id: 100515 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp824145qge; Thu, 25 May 2017 08:42:34 -0700 (PDT) X-Received: by 10.98.130.1 with SMTP id w1mr46039336pfd.128.1495726954501; Thu, 25 May 2017 08:42:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495726954; cv=none; d=google.com; s=arc-20160816; b=DLVxQ45+PnuFZYDClDE6vVEmmUZgWgNQisHxPURip7AFOjReu1n+LOqAXdvpkV+/1W Zrb0ywg3X9nkQoS6zJADzb0Fp3dnlLM7YdyPHdaOp+OmLG0Gq0Yx19J4mN71ZzUWSAlN 4GhPJSKLx4rTzxkF3GpKGWrzK8x/KcjVRc8bnJQnUP2CchQu74RVYdOpnGUbJbWSN87g 18JdUuPntLme08H8imhQAuZnG9upC1jmmG/CeALI1Ow0PSbrK4jihrSXIdzBjoWFOtTG AjxHYMIcFxvYFKS4rOdTm6DBT8r0vZDqP5nCFRE2JKYC6N/gUdiM+RqPH7iMty9h88cc oJzA== 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 :arc-authentication-results; bh=l985ltNix0ncPRWoK9kQRv4a/hpHNoJaVr951Nocw0A=; b=yQlc7CNj4vr3GdcBEBXfiO1fe/0HmaoMioX+5rwXUjGkZqUIYvn7jrcK9wDaK8OsIE MDYll26/x8YjQs+SYzoF+vdF4CWRENSPLP2Qd7eWJAS9W8K+zf4jIiu11qIIWlDsCWFx F6IUp8eL72wdVij6uHZL4yBF9caMsB09GhzAJy5KzBPW4hD4RI0iW+Ts8kgtRcJ8t113 3ht/yc9PdiNUr925Q4PnZzzjCOR3FrYmrxx3O9DOD286LUBOO+GG/YbsDjoa2nKrW8// eKDT4GoVAqvbA8XK0D8mHjwE1jqsMt7MKEwBtXpDcgTMYjqk0p6ya0doMx6cq/G037DP O9sw== 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 c2si28431479plb.236.2017.05.25.08.42.34; Thu, 25 May 2017 08:42:34 -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 S942406AbdEYPmb (ORCPT + 25 others); Thu, 25 May 2017 11:42:31 -0400 Received: from foss.arm.com ([217.140.101.70]:51338 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S938726AbdEYPm0 (ORCPT ); Thu, 25 May 2017 11:42:26 -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 3A481344; Thu, 25 May 2017 08:42:25 -0700 (PDT) Received: from e104818-lin.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 01D193F41F; Thu, 25 May 2017 08:42:23 -0700 (PDT) From: Catalin Marinas To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Michal Hocko , Andy Lutomirski , "Luis R. Rodriguez" , Andrew Morton Subject: [PATCH v2 0/3] mm: kmemleak: Improve vmalloc() false positives for thread stack allocation Date: Thu, 25 May 2017 16:42:14 +0100 Message-Id: <1495726937-23557-1-git-send-email-catalin.marinas@arm.com> X-Mailer: git-send-email 2.1.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, This is a follow up from [1] (mm: kmemleak: Treat vm_struct as alternative reference to vmalloc'ed objects). The first two patches are just clean-up and refactoring. The third introduces the kmemleak_vmalloc() API which allows a vmalloc() caller to keep either the returned pointer or a pointer to vm_struct as a reference (see the patch description for the implementation details). The false positives were noticed with alloc_thread_stack_node(), free_thread_stack() and CONFIG_VMAP_STACK where a per-CPU array is used to cache the freed thread stacks as vm_struct pointers. Changes since v1: - Split the patch into three for easier review - Only call update_refs() if !color_gray() on the found object, it avoids an unnecessary function call [1] http://lkml.kernel.org/r/1495474514-24425-1-git-send-email-catalin.marinas@arm.com Catalin Marinas (3): mm: kmemleak: Slightly reduce the size of some structures on 64-bit architectures mm: kmemleak: Factor object reference updating out of scan_block() mm: kmemleak: Treat vm_struct as alternative reference to vmalloc'ed objects Documentation/dev-tools/kmemleak.rst | 1 + include/linux/kmemleak.h | 7 ++ mm/kmemleak.c | 136 +++++++++++++++++++++++++++++------ mm/vmalloc.c | 7 +- 4 files changed, 123 insertions(+), 28 deletions(-)