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: <20200120153355.GC43842@lakrids.cambridge.arm.com>
Date:   Mon, 20 Jan 2020 15:33:56 +0000
From:   Mark Rutland <mark.rutland@....com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     James Clark <James.Clark@....com>, Will Deacon <will@...nel.org>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>, nd <nd@....com>,
        Ingo Molnar <mingo@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...hat.com>,
        Tan Xiaojun <tanxiaojun@...wei.com>,
        Al Grant <Al.Grant@....com>,
        Namhyung Kim <namhyung@...nel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/1] Return EINVAL when precise_ip perf events are
 requested on Arm

On Fri, Jan 17, 2020 at 04:16:58PM +0100, Peter Zijlstra wrote:
> On Fri, Jan 17, 2020 at 03:00:37PM +0000, James Clark wrote:
> > Hi Peter,
> > 
> > Do you mean something like this?
> 
> Yes.
> 
> > diff --git a/kernel/events/core.c b/kernel/events/core.c
> > index 43d1d4945433..f74acd085bea 100644
> > --- a/kernel/events/core.c
> > +++ b/kernel/events/core.c
> > @@ -10812,6 +10812,12 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu,
> >                 goto err_pmu;
> >         }
> >  
> > +       if (event->attr.precise_ip &&
> > +               !(pmu->capabilities & PERF_PMU_CAP_PRECISE_IP)) {
> > +               err = -EOPNOTSUPP;
> > +               goto err_pmu;
> > +       }
> > +
> >         err = exclusive_event_init(event);
> >         if (err)
> >                 goto err_pmu;
> > 
> > 
> > Or should it only be done via sysfs to not break userspace?
> 
> So we've added checks like this in the past and gotten away with it. Do
> you already know of some userspace that will break due to it?
> 
> An alternative approach is adding a sysctl like kernel.perf_nostrict
> which would disable this or something, that way 'old' userspace has a
> chicken bit.

Could we allocate a "strict" bit from perf_event_attr::__reserved_1, and
update drivers to expose a whitelist of fields they support?

Then the core could do something like:

	if (attr->strict && !pmu_check_whitelist(pmu, attr))
		return -EOPNOTSUPP;

... and we could also expose the whitelist somewhere in sysfs.

Thanks,
Mark,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ