[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190517071018.GH2623@hirez.programming.kicks-ass.net>
Date: Fri, 17 May 2019 09:10:18 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Raphael Gault <raphael.gault@....com>
Cc: linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
mingo@...hat.com, catalin.marinas@....com, will.deacon@....com,
acme@...nel.org, mark.rutland@....com
Subject: Re: [PATCH 4/6] arm64: pmu: Add hook to handle pmu-related undefined
instructions
On Thu, May 16, 2019 at 02:21:46PM +0100, Raphael Gault wrote:
> In order to prevent the userspace processes which are trying to access
> the registers from the pmu registers on a big.LITTLE environment we
> introduce a hook to handle undefined instructions.
>
> The goal here is to prevent the process to be interrupted by a signal
> when the error is caused by the task being scheduled while accessing
> a counter, causing the counter access to be invalid. As we are not able
> to know efficiently the number of counters available physically on both
> pmu in that context we consider that any faulting access to a counter
> which is architecturally correct should not cause a SIGILL signal if
> the permissions are set accordingly.
The other approach is using rseq for this; with that you can guarantee
it will never issue the instruction on a wrong CPU.
That said; emulating the thing isn't horrible either.
> + /*
> + * We put 0 in the target register if we
> + * are reading from pmu register. If we are
> + * writing, we do nothing.
> + */
Wait _what_ ?!? userspace can _WRITE_ to these registers?
Powered by blists - more mailing lists