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] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 26 Jul 2019 19:59:17 +0200
From:   Pavel Machek <pavel@....cz>
To:     pavel@....cz
Cc:     linux-kernel@...r.kernel.org,
        Kan Liang <kan.liang@...ux.intel.com>,
        "Peter Zijlstra (Intel)" <peterz@...radead.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Thomas Gleixner <tglx@...utronix.de>, acme@...nel.org,
        eranian@...gle.com, Ingo Molnar <mingo@...nel.org>,
        Sasha Levin <sashal@...nel.org>
Subject: Re: [PATCH 4.19 078/271] perf/x86/intel/uncore: Handle invalid event
 coding for free-running counter

On Wed 2019-07-24 21:19:07, Greg Kroah-Hartman wrote:

> [ Upstream commit 543ac280b3576c0009e8c0fcd4d6bfc9978d7bd0 ]
> 
> Counting with invalid event coding for free-running counter may cause
> OOPs, e.g. uncore_iio_free_running_0/event=1/.
> 
> Current code only validate the event with free-running event format,
> event=0xff,umask=0xXY. Non-free-running event format never be checked
> for the PMU with free-running counters.
> 
> Add generic hw_config() to check and reject the invalid event coding
> for free-running PMU.

So this is interesting. "static inline", but it is never really inlined because
the only use is for taking pointer.

Best regards,
									Pavel

> +++ b/arch/x86/events/intel/uncore.h
> @@ -402,6 +402,16 @@ static inline bool is_freerunning_event(struct perf_event *event)
>  	       (((cfg >> 8) & 0xff) >= UNCORE_FREERUNNING_UMASK_START);
>  }
>  
> +/* Check and reject invalid config */
> +static inline int uncore_freerunning_hw_config(struct intel_uncore_box *box,
> +					       struct perf_event *event)
> +{
> +	if (is_freerunning_event(event))
> +		return 0;
> +
> +	return -EINVAL;
> +}
> +
>  static inline void uncore_disable_box(struct intel_uncore_box *box)
>  {
>  	if (box->pmu->type->ops->disable_box)
> diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
> index b10e04387f38..8e4e8e423839 100644
> --- a/arch/x86/events/intel/uncore_snbep.c
> +++ b/arch/x86/events/intel/uncore_snbep.c
> @@ -3585,6 +3585,7 @@ static struct uncore_event_desc skx_uncore_iio_freerunning_events[] = {
>  
>  static struct intel_uncore_ops skx_uncore_iio_freerunning_ops = {
>  	.read_counter		= uncore_msr_read_counter,
> +	.hw_config		= uncore_freerunning_hw_config,
>  };
>  
>  static struct attribute *skx_uncore_iio_freerunning_formats_attr[] = {
> -- 
> 2.20.1
> 
> 

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ