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]
Message-ID: <1309863060.3282.52.camel@twins>
Date:	Tue, 05 Jul 2011 12:51:00 +0200
From:	Peter Zijlstra <a.p.zijlstra@...llo.nl>
To:	Robert Richter <robert.richter@....com>
Cc:	Paul Mackerras <paulus@...ba.org>, Ingo Molnar <mingo@...e.hu>,
	Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] perf: Extend attr check to allow also dynamically
 generated

On Tue, 2011-07-05 at 11:47 +0200, Robert Richter wrote:

> From 63e76c3d827e3d6d24ff4ee24854523c054c7179 Mon Sep 17 00:00:00 2001
> From: Robert Richter <robert.richter@....com>
> Date: Tue, 5 Jul 2011 11:04:39 +0200
> Subject: [PATCH] perf: Extend attr check to allow also dynamically generated
>  types
> 
> When attaching events to a pmu with generated type, the initialization
> fails. Extending the check to allow such types.
> 
> Signed-off-by: Robert Richter <robert.richter@....com>
> ---
>  kernel/events/core.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index cca3588..5900729 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -5958,7 +5958,7 @@ static int perf_copy_attr(struct perf_event_attr __user *uattr,
>  	 * If the type exists, the corresponding creation will verify
>  	 * the attr->config.
>  	 */
> -	if (attr->type >= PERF_TYPE_MAX)
> +	if (attr->type >= PERF_TYPE_MAX && !idr_find(&pmu_idr, attr->type))
>  		return -EINVAL;
>  
>  	if (attr->__reserved_1)

Lin Ming submitted a similar patch:

 http://marc.info/?l=linux-kernel&m=130942109729864

Which I prefer as it removes code. Event creation will fail in
perf_init_event() in that case when an invalid type is specified.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ