Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2537441pxb; Tue, 13 Apr 2021 04:30:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJdMRv+Xe3f+3Z6yrAho8SnDXr6k5dHxplolKLDoedADmlsdJHPsLO8jn+gJtzL7fyMLM6 X-Received: by 2002:a17:90b:1198:: with SMTP id gk24mr4406545pjb.84.1618313456661; Tue, 13 Apr 2021 04:30:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618313456; cv=none; d=google.com; s=arc-20160816; b=mEysoyUf+EwInVsTK60h2WUkdN0axD7I3UboL22pWs+4PX0vfYJyj+MXNHUewr9Ba3 mCIG3GZSRBqlpOBPmr2XUUYfQUkN98jl1xOre3p22z1R0EDhpFD5JP3/eKzHYqG1Ea/P YvS1RdukPQUgn3U0VUKYisWBWRNAuamK5TkPFOV+5xARcnVT+Dxn5XxsyJe22IAWwK3i CiBUHbRE7P5a8dqHuXdLqTZ6L7tg49W6Tcsw7og7c+HY6ylEgcLkbPgeKYrenS+uqR8M I4vLWBvAmZGEppsFvvjRCvywyzd0ectXjpKPh+fwLpADyyeMhw/9cCrvoyqxIuW8OY2G Colg== 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=Qc1fPa7IFlg3yRWwAkYq3ylbLTApOWrjJOqQ54RWd64=; b=uLgmHNljcpKakBJDYVH7jyl/DIxfcD3K37pUzwm+uycr8ngpWOsruXlqygbIeb/TZ2 RF3skezlqvN1UDldrBrnXT9e/UdSX/n6YX50ABgb0a0r6vzzNEWFeqEMWqDJ1lYuxrU+ eEV3ZyclXcEGdSyM2ukmivM0VAFAgH9da8pBEgr66fivhua1K484p1OREd7Bn9Ar2RSp YVQWTGVqCVv/gFaaZWWoFz+6XMUuJPlU1RuuM/0Z/+LkMhghDgevSsowUl9Sb/+XEFVM 9IaOyHRNIXpXUt9LCl0t0Xa3L4+VqNrjNakugv8mgADBX56SpY0HV5QimMFWDH2/ZRbW +tTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=oRcZEe1W; 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 s2si12303295pfs.260.2021.04.13.04.30.44; Tue, 13 Apr 2021 04:30:56 -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=oRcZEe1W; 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 S245050AbhDLVXL (ORCPT + 99 others); Mon, 12 Apr 2021 17:23:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242802AbhDLVXL (ORCPT ); Mon, 12 Apr 2021 17:23:11 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDD45C061574 for ; Mon, 12 Apr 2021 14:22:52 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id r13so3559429pjf.2 for ; Mon, 12 Apr 2021 14:22:52 -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=Qc1fPa7IFlg3yRWwAkYq3ylbLTApOWrjJOqQ54RWd64=; b=oRcZEe1WWNR1b4O5hgurPbe4eU1XlF0/6k+/lee5xmuEQz9haKqfpVbXUwQLJ+q99F xGABAeYVJupFfeLVp06b173aCjez+JAwmN/0QnIentA3ksTYcwVW8nSv4woTx3kVI9ga IwNbPLl6CRbX1Xdbb1q4Py/k8+sJs9vSxJi4Fp9KcPbwvAdfMB0aECppQNyjgPTwmrCc f4hUZZrpwQNA2dUPq6dKB8PjmgLLbgPjCEjaEjZlrFm3p7Y7/P+4quqJ40SmXZ51d3um 3GqKGShj0rdvCtrlYbocN7TpsZwmumXXyIar1lnFR9Mn2z6pZFEMwagGjMgxFpxle+hP Kp7g== 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=Qc1fPa7IFlg3yRWwAkYq3ylbLTApOWrjJOqQ54RWd64=; b=RhfyCmRk8nMoc+nGqpqFkBbh/EUdTJJETWob9c5ZwAKhOW2y6Y6LSvqVBdX5HFQh3K km1nJVPPoXYcNBC7JFm7AM/4nq7ovLH3wm+vCLxXSLTdLiSBf1lIUN+K5+21rKiqBMKa FyjbaDTCJiY9DdUPxDPqg7F7kcuHQ4vItLoUFfzkYfMcg2n/7r4lf+fdjTW+ojAzaV/b 1T/7Ijn2Vdsw+0/N0SdzGlxFumMvev5qw9UAY8icuh0BYUtOriHjyXlZayo1g6GKK8MO arHb6xVIHo0NcTon5xp6jWnIgKyKKXHy0GqAo7qSuT8vhZFjZu0aUlTInlKCwGKl2vBr ZS+Q== X-Gm-Message-State: AOAM530fJMVQ6cRE/8ZjSxIQalVehBdinUlN03pes4t4n/NanBk2Wejb p9TBA7MVUJ0CQcD6KlFYmCWHspBa+tJdO6OeqCaJqA== X-Received: by 2002:a17:90a:c7d5:: with SMTP id gf21mr1196970pjb.80.1618262572057; Mon, 12 Apr 2021 14:22:52 -0700 (PDT) MIME-Version: 1.0 References: <20210410070529.4113432-1-davidgow@google.com> In-Reply-To: From: Brendan Higgins Date: Mon, 12 Apr 2021 14:22:40 -0700 Message-ID: Subject: Re: [PATCH] Documentation: dev-tools: Add Testing Overview To: Marco Elver Cc: Daniel Latypov , David Gow , Jonathan Corbet , Shuah Khan , Andrew Morton , Dmitry Vyukov , "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 Mon, Apr 12, 2021 at 3:43 AM Marco Elver wrote: > > 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 Good point Marco, and we (KUnit - myself, Daniel, and David) gave a talk on KUnit at LF. Also, I think Shuah is/has given one (soon)? Might be a good idea to link those here?