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] [day] [month] [year] [list]
Message-ID: <Y1Z3RfP7sVltTfyF@kernel.org>
Date:   Mon, 24 Oct 2022 08:30:13 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Leo Yan <leo.yan@...aro.org>
Cc:     Ian Rogers <irogers@...gle.com>, Greg Thelen <gthelen@...gle.com>,
        Anand K Mistry <amistry@...gle.com>,
        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>,
        linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
        Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH v1] perf record: Fix event fd races

Em Mon, Oct 24, 2022 at 05:16:56PM +0800, Leo Yan escreveu:
> On Sun, Oct 23, 2022 at 10:33:30PM -0700, Ian Rogers wrote:
> 
> [...]
> 
> > > > +static volatile int done_fd = -1;
> > >
> > > Here is a bit suspecious for adding volatile qualifier.  See the
> > > document: process/volatile-considered-harmful.rst.
> > >
> > > I know the document is mainly for kernel programming, but seems to me
> > > it's also valid for C programming in userspace.
> > >
> > > I not sure what's the purpose for adding volatile for done_fd, if we
> > > really have concern for reading any stale value for done_fd, should we
> > > use WRITE_ONCE/READ_ONCE?
> > 
> > We could just switch to C11 and stdatomic. The volatile is consistent
> > with the code above and more consistent with the expectation of
> > writing to a variable that is read in a signal handler.
> 
> Thanks for the info for C11 and stdatomic.h.  The documentation [1] says
> the safe way is for accessing shared data in signal handler is:
> 
>   static volatile sig_atomic_t done_fd = -1;
> 
> It's fine if you want to use another patch to address this issue, this
> patch for fixing errno is fine for me:
> 
> Reviewed-by: Leo Yan <leo.yan@...aro.org>



Thanks, applied.

- Arnaldo

 
> [1] https://wiki.sei.cmu.edu/confluence/display/c/SIG31-C.+Do+not+access+shared+objects+in+signal+handlers

-- 

- Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ