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]
Message-ID: <7b0769b35f124869b4e30ddcc20a5985@AcuMS.aculab.com>
Date:   Tue, 25 Oct 2022 10:36:16 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Ian Rogers' <irogers@...gle.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>
CC:     Leo Yan <leo.yan@...aro.org>,
        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>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Alexey Bayduraev <alexey.v.bayduraev@...ux.intel.com>,
        German Gomez <german.gomez@....com>,
        "linux-perf-users@...r.kernel.org" <linux-perf-users@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Stephane Eranian <eranian@...gle.com>
Subject: RE: [PATCH v1 0/8] Update to C11, fix signal undefined behavior

From: Ian Rogers
> Sent: 24 October 2022 19:12
> 
> On Mon, Oct 24, 2022 at 10:59 AM Ian Rogers <irogers@...gle.com> wrote:
> >
> > On Mon, Oct 24, 2022 at 10:51 AM Arnaldo Carvalho de Melo
> > <acme@...nel.org> wrote:
> > >
> > > Em Mon, Oct 24, 2022 at 10:35:15AM -0700, Ian Rogers escreveu:
> > > > The use of C11 is mainstream in the kernel [1]. There was some
> > > > confusion on volatile and signal handlers in [2]. Switch to using
> > > > stdatomic.h (requires C11) and sig_atomic_t as per [3]. Thanks to Leo
> > > > Yan <leo.yan@...aro.org> for the suggestions.
> > > >
> > > > [1] https://lore.kernel.org/lkml/CAHk-=whWbENRz-
> vLY6vpESDLj6kGUTKO3khGtVfipHqwewh2HQ@...l.gmail.com/
> > > > [2] https://lore.kernel.org/lkml/20221024011024.462518-1-irogers@google.com/
> > > > [3] https://wiki.sei.cmu.edu/confluence/display/c/SIG31-
> C.+Do+not+access+shared+objects+in+signal+handlers
> > >
> > > I think I'll apply this to perf/core, i.e. for 6.3, ok?
> >
> > Sounds good to me. 6.3 or 6.2? I suspect there is more cleanup like
> > this and to the iterators (from C11) that can be done.
> >
> > Thanks,
> > Ian
> 
> So I noticed a few changes missing #include-ing stdatomic.h and
> sig_atomic_t is actually in signal.h. I'm not sure we need the C11
> change then, but it seems like the right thing to do anyway. I'll do a
> v2 to drop the unneeded (currently) include of stdatomic.h.

While the C standard requires you use sig_atomic_t (to avoid
wider RMW being done for writes) the kernel very much requires
that volatiles accesses are atomic.
So the compilers used will do that even when the C standard
would allow them to do otherwise.

Pretty much the last mainstream cpu that couldn't do atomic
byte writes was an old alpha.

So for anything that Linux is going to run on these changes
aren't really needed.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ