Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2173866pxb; Mon, 12 Apr 2021 16:54:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4RmczpuooVP1mPIMREENJnOVYl0gYyixOPiQac/pD2E9Gvy+dXZpjELv06u4FlBJaCt8w X-Received: by 2002:a05:6402:5189:: with SMTP id q9mr31599316edd.168.1618271677325; Mon, 12 Apr 2021 16:54:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618271677; cv=none; d=google.com; s=arc-20160816; b=kdr2eg1Bhxi6XKH6zm6q0HtmDy/Sa//Ryj31f3mGP2UR4l+VSTlccduFWE2KM9j2tS T1ZiC/uLHNTBYAGy8nGbCRvgm71rSdw8gAr7BQTu9V31JgknpnUvPQtpo92Hbtk+QLPG 8/41XgzTQFOKpA3xlBUSQ+h12a3x8HNvne5wBM9P0ze19VIOn3irc/C+UJNnuObN832y TDzC/whttgkJllkhwzIj9uo3L93E0xZ73cG7DOmxnPGOPbKanThSYx4oBZbteGbZF/Cb gnfSKYR83ZN2KnnFH50hPMrWGOWFipfAVAdBS2mtxi+Po6C4aBR1rWY9OiLCkhOgC+RY n4CA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=3AZsdL8BfabydD2z1Twp1UQ1k08lBxkT8Hc0KzFCdr0=; b=zGB5t3ln6T/DENPrV+vU2amMpmc7KsSRS2hLmE8RThkjEXsYavdpTfVuzVGBThqJeS FFNGo77Gb0RJgZHuefHvnPEWe3VOG/LYr6K7HQ8QX3n100GKQUSh5OD535fIzUdwJYP3 OWZE3w0MYNdrrmtZLMP/ZZegvL0XrxAr5SDzR/czVOPuGUanTO12OjOc4yoER1Vl6ckU 4g4cdpq8eMmG1hQfqW+jL4hOTCutwejCYUSt0cOC22c13aS0fojtBUVNrlyEiJMW4l5O rTCJfNvcSRqYX1eXDXEemcykxKGFlhyTh9BsFF3vfEvy9YIYXiytNBQKgUFvgKy2bJbR +f3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=vOkHMvJJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a25si8529059edx.289.2021.04.12.16.54.14; Mon, 12 Apr 2021 16:54:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=vOkHMvJJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238334AbhDLKnl (ORCPT + 99 others); Mon, 12 Apr 2021 06:43:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239522AbhDLKnk (ORCPT ); Mon, 12 Apr 2021 06:43:40 -0400 Received: from mail-ot1-x329.google.com (mail-ot1-x329.google.com [IPv6:2607:f8b0:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E720C061574 for ; Mon, 12 Apr 2021 03:43:22 -0700 (PDT) Received: by mail-ot1-x329.google.com with SMTP id w21-20020a9d63950000b02901ce7b8c45b4so12345456otk.5 for ; Mon, 12 Apr 2021 03:43:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3AZsdL8BfabydD2z1Twp1UQ1k08lBxkT8Hc0KzFCdr0=; b=vOkHMvJJPaTur8H2lzlJi72gN4t1tzLS5yeur+DgK05GqMBGztx+c32SBlK+Rk3PkY Mruo096+7nm4BPF9gK2MEMkn2zPsGGBff3D6oYb8XKjR3Uqu56Fodz+1bENCHe/bVTu7 gLwfKyi8WIujCvNRjmhN59qAPqNCOgaqNTmZRPWQMVdgcFbY9NC+CfugrCtdwBGFMfcQ vxbFBfZtxrjSPWpwf1Aj3dpW81kpGGj+Npql8c6TqlAmxiPPAwDCgj640ihot1DuBagl zrJWEJhLegGW3aJsfCHvj45TIzL2bqBqxTswgCiS4OqEWDuPvxkuTOkfakOodsTIaabs UXkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3AZsdL8BfabydD2z1Twp1UQ1k08lBxkT8Hc0KzFCdr0=; b=Nyxk7XeKHM0KUTk9I/XFsfxTp1g+MEiN8oUk07kxq9AG168PSB/CdUs6LzTAGuyLIu /mdy0Ppb0FLqmEmfq+pcch83y9kwD4EZ8kWoXPYEikH97l0caI+wbhwadA7HYBbpj07g czfWwnnNS4SfSyb08Z+DeTIh1mPWzt3YebtFUYMOrV9W84JEkqZKHEEyHmdZ7fYK04Yt BxY428fqM8vMQqcFGNYSjsL2f3gdXUuBrHFqsfUssT2+aIdU34RiYVoig5UkATDUXiKR NDvBwSuqxB2iRdmkj+iCnH+i4WNnCF+g7bmNZmv1kQRRN8XIwkHQZdXjP5behnx0vbhR rLJw== X-Gm-Message-State: AOAM532zvhSKiKcaLyDOBbaPwBnTEJT6pUM/AWfHLX1hmvLzqZ6o9Qwe UX0fl5746xg/jS/bjLDRVRT6SX1Jp3KnUu3a9SUJGQ== X-Received: by 2002:a05:6830:148c:: with SMTP id s12mr24133633otq.251.1618224201740; Mon, 12 Apr 2021 03:43:21 -0700 (PDT) MIME-Version: 1.0 References: <20210410070529.4113432-1-davidgow@google.com> In-Reply-To: From: Marco Elver Date: Mon, 12 Apr 2021 12:43:09 +0200 Message-ID: Subject: Re: [PATCH] Documentation: dev-tools: Add Testing Overview To: Daniel Latypov Cc: David Gow , Jonathan Corbet , Shuah Khan , Andrew Morton , Dmitry Vyukov , Brendan Higgins , "open list:DOCUMENTATION" , KUnit Development , "open list:KERNEL SELFTEST FRAMEWORK" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 10 Apr 2021 at 13:53, Daniel Latypov wrote: > On Sat, Apr 10, 2021 at 12:05 AM David Gow wrote: [...] > > + > > + > > +Sanitizers > > +========== > > + The "sanitizers" have originally been a group of tools that relied on compiler instrumentation to perform various dynamic analysis (initially ASan, TSan, MSan for user space). The term "sanitizer" has since been broadened to include a few non-compiler based tools such as GWP-ASan in user space, of which KFENCE is its kernel cousin but it doesn't have "sanitizer" in its name (because we felt GWP-KASAN was pushing it with the acronyms ;-)). Also, these days we have HW_TAGS based KASAN, which doesn't rely on compiler instrumentation but instead on MTE in Arm64. Things like kmemleak have never really been called a sanitizer, but they _are_ dynamic analysis tools. So to avoid confusion, in particular avoid establishing "sanitizers" to be synonymous with "dynamic analysis" ("all sanitizers are dynamic analysis tools, but not all dynamic analysis tools are sanitizers"), the section here should not be called "Sanitizers" but "Dynamic Analysis Tools". We could have a subsection "Sanitizers", but I think it's not necessary. > > +The kernel also supports a number of sanitizers, which attempt to detect > > +classes of issues when the occur in a running kernel. These typically > > *they occur > > > +look for undefined behaviour of some kind, such as invalid memory accesses, > > +concurrency issues such as data races, or other undefined behaviour like > > +integer overflows. > > + > > +* :doc:`kmemleak` (Kmemleak) detects possible memory leaks. > > +* :doc:`kasan` detects invalid memory accesses such as out-of-bounds and > > + use-after-free errors. > > +* :doc:`ubsan` detects behaviour that is undefined by the C standard, like > > + integer overflows. > > +* :doc:`kcsan` detects data races. > > +* :doc:`kfence` is a low-overhead detector of memory issues, which is much > > + faster than KASAN and can be used in production. > > Hmm, it lives elsewhere, but would also calling out lockdep here be useful? > I've also not heard anyone call it a sanitizer before, but it fits the > definition you've given. > > Now that I think about it, I've never looked for documentation on it, > is this the best page? > https://www.kernel.org/doc/html/latest/locking/lockdep-design.html Not a "sanitizer" but our sanitizers are all dynamic analysis tools, and lockdep is also a dynamic analysis tool. If we want to be pedantic, the kernel has numerous options to add "instrumentation" (compiler based or explicit) that will detect some kind of error at runtime. Most of them live in lib/Kconfig.debug. I think mentioning something like that is in scope of this document, but we certainly can't mention all debug tools the kernel has to offer. Mentioning the big ones like above and then referring to lib/Kconfig.debug is probably fine. Dmitry recently gave an excellent talk on some of this: https://www.youtube.com/watch?v=ufcyOkgFZ2Q Thanks, -- Marco