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: <CALZQ+UOvBe9352td44g3+qCqGGmLLq3=ObRyfQ=JXucY-MX9Gg@mail.gmail.com>
Date:   Sat, 2 Sep 2023 16:14:40 +0800
From:   Leo Yan <leo.yan@...aro.org>
To:     Namhyung Kim <namhyung@...nel.org>
Cc:     Jonathan Corbet <corbet@....net>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Ian Rogers <irogers@...gle.com>,
        Thomas Richter <tmricht@...ux.ibm.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Jiri Olsa <jolsa@...nel.org>, linux-doc@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org
Subject: Re: [PATCH v6] Documentation: userspace-api: Document perf ring
 buffer mechanism

Hi Namhyung,

On Sat, Aug 26, 2023 at 07:45:15AM -0700, Namhyung Kim wrote:

[...]

> > > >   The combination is supported in perf tool:
> > > >
> > > >   ---+------------+-----------
> > > >      |  Forward   | Backward
> > > >   ---+------------+-----------
> > > >   rw |  Yes       |   No
> > > >   ---+------------+-----------
> > > >   ro |  X         |   Yes
> > > >   ---+------------+-----------
> > > >
> > > >   Yes: is supported
> > > >   No: is not supported
> > > >   X: is not feasible
> > >
> > > I think they are all supported.  You can use rw mode with backward
> > > direction but it's just not intuitive.  Also ro mode with forward direction
> > > is working but there's a chance to miss the start position of the
> > > previous event.
> >
> > I am a bit confused for the all four modes are supported.
> >
> > From the code [1], we can see there have only two combinations:
> >
> > - overwrite + read-only mode (PROT_READ);
> > - no-overwrite + read-write mode (PROT_READ | PROT_WRITE);
> >
> > And I think perf tool must use the backward writing for "overwrite",
> > and use the forward writing for "non-overwrite" mode.  I think the
> > code [2] can help us to conclude this.
>
> I mean the kernel supports all the combinations but perf tool uses
> the selected two.  IIUC you are describing the kernel behavior, right?

You are right.  I read the kernel code again and get the same conclusion
with you.

The kernel code is general enough, which supports forward and backward
writing directions and doesn't assume the direction is bound to any
specific ring buffer mode.  On the other hand, the perf tool selects
the combinations of the direction and mapping property for two modes:
one is the non-overwrite mode and another is the overwritable mode.

In the next spin, I'd like to add a subsection "Ring buffer modes" to
describe the implementation in the kernel and userspace respectively,
hope this can avoid confusion.

Thanks a lot for suggestion!


Leo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ