Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp16491972rwd; Mon, 26 Jun 2023 10:41:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5jz2j+kuIPCEQ5ESOU80xC4V/MwxGbGAbcdB6Ds668brZ1xxCep3d422hoQFnFopT3d4Pc X-Received: by 2002:a17:902:f7c1:b0:1b3:7de7:f83f with SMTP id h1-20020a170902f7c100b001b37de7f83fmr3920310plw.26.1687801296823; Mon, 26 Jun 2023 10:41:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687801296; cv=none; d=google.com; s=arc-20160816; b=vJPic1Xt/0DwhO6v+ER4frS8DE0bNq0ymj8zhsmTqsa4Ki4n3z0cbRTu9sJ2vQ/jlP PU5tZHdPdvtvRlCbpZJrN4O/9w4+BpueIyNqt+e1UhrdLKRg1/nE//6fzDQQsupKgK4y RlWmLIeMsKX8veAaTfFZRN7J70nZPWLE7PYg/hl5qXD+aVhBc68SOp8+W5W0+RbHFUQA 2urLS7PpjygEgbG/dHRoS26dNjqsBpZ8M2FYnJvSEImKnjOKbOzkfDWQPrz+iW6YPtiv c+letnDhVjpO0uWC2U737gvOdO5Ax0C0lPBxcg0VbUF2tm3IBWwiRvkNK/A80ZaLXhjo RNuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=Pb+RURvt6A+w8dCv8RL1qzl/KMJ6kd7FHQTDIWYf1EQ=; fh=uike6P5ABIMC5K3wBz35CEKqIc0guZdZqxmldCBnpHM=; b=aCxtL0n/oxTQaLT6gn9XwVuDyDBZkxA3i9GOH0YH93PL8Z2c+koNscFKxAq6uZlMei LWLYGihKPL/CiWYPgojdPJvJH34Hl6vCjXDnCTtYITFWJ+ExgiIGdatdIAkh3dSJDtJP YbGOndbLakhwmJVH0lZxFDp84iL0Lq7rPQhK4gwdyZl9eWI3tgyNEJb6jPXVJbIb/jXH 7JAvExbjyf5raxzDdUj9lU9BwFOp6xABaBsPHxw7I6E+OqQDFXAzDup4ZfuBuMSwQjD7 97wsgDQnTEO6crrXTKVPu35EfK07UsZtBJrt/1RZuoFAu6IZXfbyUUydjM88t8MHWi6L 10Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=rRzsrh1T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p1-20020a170902f08100b001b5561a5ca6si4902658pla.379.2023.06.26.10.41.01; Mon, 26 Jun 2023 10:41:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=rRzsrh1T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229880AbjFZRZJ (ORCPT + 99 others); Mon, 26 Jun 2023 13:25:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229820AbjFZRZI (ORCPT ); Mon, 26 Jun 2023 13:25:08 -0400 Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2480E8F for ; Mon, 26 Jun 2023 10:25:07 -0700 (PDT) Received: by mail-qt1-x82c.google.com with SMTP id d75a77b69052e-401e0ceb4e6so4233031cf.1 for ; Mon, 26 Jun 2023 10:25:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1687800306; x=1690392306; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Pb+RURvt6A+w8dCv8RL1qzl/KMJ6kd7FHQTDIWYf1EQ=; b=rRzsrh1Tg4LulotQaD7JFdbsAHvoTRNFiEheI4LxAHrGVu0ptoLrfg4xkYIhzBYbvL u/gPrHP9J88IBVImHfSpoxB3838Lr94LMdAbjVPOqOBrVhVg5gJ3lv41uixwqIvpZgmc zjT9wVjzREkcHLusii/9hHDTARwVGOiZ3STfL1ikbVl8YGkoiH++7032DKciCnHZ3EoC wHkvY82XpH1RxB03WAK6fAZTu9IZ/xVLKqvp19+ZHdGsRx9M0i9Q1PDwNcSC8Rp9oKNi 5j3FLW+ppcGEpfT9bYeKP18zpHmhQcS72qq5CQLDmgx/OPGJ3oFy7zb/Xla9zA72Md9c 72uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687800306; x=1690392306; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Pb+RURvt6A+w8dCv8RL1qzl/KMJ6kd7FHQTDIWYf1EQ=; b=iv7w5bmZxEC8kzA22CUWOIAgtjvCU0ZNcEUKjAVbLAGdcus1BbK9ZdRm0NEZ7B3KqV onqgo3uiAjJHxWXt99SL+Xe+7yZ/wQoI/Q/ej8Vwqw3m4aiEh67OVbDAIot67IFJgugn CqHkjh/XAMeNlIYyb9wWT1c/LEtba9rHobCQhk6/37ctYhShyRAMwgsf+4EvVsYrALEd xj9v8jYInsFBUtQZ7g0HpXqiP59vD4XhORRyGQbdPK9wUk+E33ROlmfVqZtETck30kfA Aej6/vq08WBz/ZBAjQ+8m0s/IB6CrZzLDLAOK4IWrJdzQrEERlHSQS34RsBwa4KDYuSq Xd3g== X-Gm-Message-State: AC+VfDw2cJMVIxuH5BN272O3nkiu+vNGQlLDqcGS9Kc8uf5uTgaqiL4a kwqG3vtZY9TChtdryYK3JPJIxcS7fbzjruafCLuqM050Cz+y9iPVf2I= X-Received: by 2002:a05:6214:f2b:b0:62d:f68a:ee2d with SMTP id iw11-20020a0562140f2b00b0062df68aee2dmr5834042qvb.29.1687800306154; Mon, 26 Jun 2023 10:25:06 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Nick Desaulniers Date: Mon, 26 Jun 2023 10:24:55 -0700 Message-ID: Subject: Re: Thread-safety annotations for irq/rcu/atomic contexts To: Dmitry Vyukov Cc: Lukas Bulwahn , LKML , Marco Elver , clang-built-linux Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org (minus old ML, plus new ML) On Mon, Jun 26, 2023 at 10:21=E2=80=AFAM 'Dmitry Vyukov' via Clang Built Li= nux wrote: > > Hi, > > Previous Lukas' attempt to apply clang thread-safety annotations to the k= ernel: > https://clangbuiltlinux.github.io/CBL-meetup-2020-slides/lukas/tsa.pdf > > I am thinking if the annotations can be used to check for functions > that must/must not be called from irq/atomic/rcu_read/etc contexts. > Namely, we create global fake locks that denote these contexts, then > annotate spin_lock_irqsave/irqrestore/etc as taking releasing these > locks, and finally annotate functions are requiring/excluding these > contexts: > > void foo() require(irq_context); > void bar() exclude(irq_context); > void baz() require(rcu_read_context); > > This may help to catch "suspicious RCU usage", "scheduling while > atomic" and similar bug types statically. I suspect it may also be > simpler (?) to do rather than annotating all normal locks. > > Does it make any sense? > > -- > You received this message because you are subscribed to the Google Groups= "Clang Built Linux" group. > To unsubscribe from this group and stop receiving emails from it, send an= email to clang-built-linux+unsubscribe@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgi= d/clang-built-linux/CACT4Y%2Bbif9Wek-g10F5y0aLbH%3DJbCcqryi2nOUAFxGFo0O2B9A= %40mail.gmail.com. --=20 Thanks, ~Nick Desaulniers