lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 26 Aug 2022 16:13:35 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Ian Rogers <irogers@...gle.com>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Darren Hart <dvhart@...radead.org>,
        Davidlohr Bueso <dave@...olabs.net>,
        André Almeida <andrealmeid@...lia.com>,
        Nathan Chancellor <nathan@...nel.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Tom Rix <trix@...hat.com>, Weiguo Li <liwg06@...mail.com>,
        Athira Rajeev <atrajeev@...ux.vnet.ibm.com>,
        Thomas Richter <tmricht@...ux.ibm.com>,
        Ravi Bangoria <ravi.bangoria@....com>,
        Dario Petrillo <dario.pk1@...il.com>,
        Hewenliang <hewenliang4@...wei.com>,
        yaowenbin <yaowenbin1@...wei.com>,
        Wenyu Liu <liuwenyu7@...wei.com>,
        Song Liu <songliubraving@...com>,
        Andrii Nakryiko <andrii@...nel.org>,
        Dave Marchevsky <davemarchevsky@...com>,
        Leo Yan <leo.yan@...aro.org>,
        Kim Phillips <kim.phillips@....com>,
        Pavithra Gurushankar <gpavithrasha@...il.com>,
        Alexandre Truong <alexandre.truong@....com>,
        Quentin Monnet <quentin@...valent.com>,
        William Cohen <wcohen@...hat.com>,
        Andres Freund <andres@...razel.de>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Martin Liška <mliska@...e.cz>,
        Colin Ian King <colin.king@...el.com>,
        James Clark <james.clark@....com>,
        Fangrui Song <maskray@...gle.com>,
        Stephane Eranian <eranian@...gle.com>,
        Kajol Jain <kjain@...ux.ibm.com>,
        Alexey Bayduraev <alexey.v.bayduraev@...ux.intel.com>,
        Riccardo Mancini <rickyman7@...il.com>,
        Andi Kleen <ak@...ux.intel.com>,
        Masami Hiramatsu <mhiramat@...nel.org>,
        Zechuan Chen <chenzechuan1@...wei.com>,
        Jason Wang <wangborong@...rlc.com>,
        Christophe JAILLET <christophe.jaillet@...adoo.fr>,
        Remi Bernon <rbernon@...eweavers.com>,
        linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org,
        bpf@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH v3 15/18] perf mutex: Add thread safety annotations

Em Fri, Aug 26, 2022 at 10:00:43AM -0700, Ian Rogers escreveu:
> On Fri, Aug 26, 2022 at 9:45 AM Arnaldo Carvalho de Melo
> <acme@...nel.org> wrote:
> >
> > Em Wed, Aug 24, 2022 at 08:38:58AM -0700, Ian Rogers escreveu:
> > > Add thread safety annotations to struct mutex so that when compiled with
> > > clang's -Wthread-safety warnings are generated for erroneous lock
> > > patterns. NO_THREAD_SAFETY_ANALYSIS is needed for
> > > mutex_lock/mutex_unlock as the analysis doesn't under pthread calls.
> >
> > So even having the guards checking if the attribute is available it
> > seems at least clang 11.0 is needed, as the "lockable" arg was
> > introduced there:
> >
> >   37    42.61 fedora:32                     : FAIL clang version 10.0.1 (Fedora 10.0.1-3.fc32)
> >     In file included from /git/perf-6.0.0-rc2/tools/perf/util/../ui/ui.h:5:
> >     /git/perf-6.0.0-rc2/tools/perf/util/../ui/../util/mutex.h:74:8: error: invalid capability name 'lockable'; capability name must be 'mutex' or 'role' [-Werror,-Wthread-safety-attributes]
> >     struct LOCKABLE mutex {
> >            ^
> >     /git/perf-6.0.0-rc2/tools/perf/util/../ui/../util/mutex.h:35:44: note: expanded from macro 'LOCKABLE'
> >     #define LOCKABLE __attribute__((capability("lockable")))
> 
> 
> capability("lockable") can just be lockable, the capability
> generalization came in a later clang release.
> 
> That is change:
> #define LOCKABLE __attribute__((capability("lockable")))
> to:
> #define LOCKABLE __attribute__((lockable))
> 
> and later clangs take the earlier name. Do you want a v5 for this 1 liner?

I did it and I'm now testing, thanks.

- Arnaldo

diff --git a/tools/perf/util/mutex.h b/tools/perf/util/mutex.h
index 48a2d87598f0d725..29b5494b213a3fc9 100644
--- a/tools/perf/util/mutex.h
+++ b/tools/perf/util/mutex.h
@@ -32,7 +32,7 @@
 #define PT_GUARDED_BY(x) __attribute__((pt_guarded_by(x)))
 
 /* Documents if a type is a lockable type. */
-#define LOCKABLE __attribute__((capability("lockable")))
+#define LOCKABLE __attribute__((lockable))
 
 /* Documents functions that acquire a lock in the body of a function, and do not release it. */
 #define EXCLUSIVE_LOCK_FUNCTION(...)  __attribute__((exclusive_lock_function(__VA_ARGS__)))

- Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ