--
You received this message because you are subscribed to the Google Groups "RISC-V SW Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+un...@groups.riscv.org.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/mhng-80c535b2-e797-4d75-bba9-a529a96e43e2%40palmer-ri-x1c9.
If I recall correctly, other architectures don't allow direct access to their cycle counters from userspace for security reasons. Any reason why RISC-V shouldn't follow the same approach?
- PaulOn Thursday, September 1, 2022 at 4:26:51 PM UTC-7 tommy_...@hotmail.com wrote:Sorry, I didn't report the issue and don't have the wherewithal to do any testing.
On Fri, Sep 2, 2022 at 8:49 AM Anup Patel <an...@brainfault.org> wrote:
>
> On Fri, Sep 2, 2022 at 8:14 AM atish patra <atis...@gmail.com> wrote:
> >
> >
> >
> > On Thu, Sep 1, 2022 at 7:36 PM Paul Walmsley <paul.w...@sifive.com> wrote:
> >>
> >> If I recall correctly, other architectures don't allow direct access to their cycle counters from userspace for security reasons. Any reason why RISC-V shouldn't follow the same approach?
> >
> >
> > That was the intention behind disabling the access in the PMU driver. At that time, I didn’t find any users. Obviously I was wrong 😂. But is that a sufficient reason to existing break user space ?
>
> As already pointed out, we can't compromise security by having all
> apps unrestricted access to the cycle counter. We already have the
> Linux perf subsystem for managing counters so apps should always use
> Linux perf syscalls.
>
> IMO, the package "highway" directly accessing the cycle counter should
> be fixed instead of fixing the Linux SBI PMU driver.
>
> Further investigating the highway project
> (https://github.com/google/highway), it seems this project is using
> "rdcycle" to track timer ticks which is totally wrong. Instead the use
> of "rdcycle" should be replaced with "rdtime" in this project.
> (Refer, line 156 of
> https://github.com/google/highway/blob/master/hwy/nanobenchmark.cc)
Pay attention that quite a few projects are using rdcycle in user-space already:
* https://codesearch.debian.net/search?q=%22rdcycle+%250%22
Anyway if you believe rdtime is the right fix, we can fix one project
at a time...
> Regards,
> Anup
>
>
>
> >
> >>
> >>
> >> - Paul
> >> On Thursday, September 1, 2022 at 4:26:51 PM UTC-7 tommy_...@hotmail.com wrote:
> >>>
> >>> Sorry, I didn't report the issue and don't have the wherewithal to do any testing.
> >
> > --
> > Regards,
> > Atish
> >
> > --
> > You received this message because you are subscribed to the Google Groups "RISC-V SW Dev" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+un...@groups.riscv.org.
> > To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/CAELrHRDugBr2k91SQWKCxnxmk7J8Udzcstw2TH8Wyi%2BYysPbBA%40mail.gmail.com.
--
Mathieu
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/CAELrHRAnfopRSQJr%2BvkQp%3DpmkgOiU7tf%2B6N8TqVKp0%2Bup_Dhqg%40mail.gmail.com.