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: <20190525084808.GA15802@gmail.com>
Date:   Sat, 25 May 2019 10:48:08 +0200
From:   Ingo Molnar <mingo@...nel.org>
To:     kan.liang@...ux.intel.com
Cc:     vincent.weaver@...ne.edu, ak@...ux.intel.com, peterz@...radead.org,
        alexander.shishkin@...ux.intel.com, acme@...hat.com,
        jolsa@...hat.com, eranian@...gle.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] perf/x86: Disable non generic regs for
 software/probe events


* kan.liang@...ux.intel.com <kan.liang@...ux.intel.com> wrote:

> @@ -57,6 +57,11 @@ static unsigned int pt_regs_offset[PERF_REG_X86_MAX] = {
>  #endif
>  };
>  
> +u64 non_generic_regs_mask(void)
> +{
> +	return (~((1ULL << PERF_REG_X86_XMM0) - 1));
> +}
> +
>  u64 perf_reg_value(struct pt_regs *regs, int idx)
>  {
>  	struct x86_perf_regs *perf_regs;
> diff --git a/include/linux/perf_regs.h b/include/linux/perf_regs.h
> index 4767474..c1c3454 100644
> --- a/include/linux/perf_regs.h
> +++ b/include/linux/perf_regs.h
> @@ -9,6 +9,8 @@ struct perf_regs {
>  	struct pt_regs	*regs;
>  };
>  
> +u64 non_generic_regs_mask(void);

This is a *constant* value, why is it in a separate function, not an 
inline?

Or rather, since it's obviously a constant, name it in such a way. 
(PERF_REG_X86_NON_GENERIC_MASK or so.)

To the generic code define it as 0 if arch headers haven't overriden it.

> +u64 __weak non_generic_regs_mask(void)
> +{
> +	return 0;
> +}
> +
> +static inline bool has_non_generic_regs(struct perf_event *event)
> +{
> +	u64 mask = non_generic_regs_mask();
> +
> +	return ((event->attr.sample_regs_user & mask) ||
> +		(event->attr.sample_regs_intr & mask));

'return' is not a function ...

> +	/* only support generic regs */
> +	if (has_non_generic_regs(event))
> +		return -EOPNOTSUPP;

In human readable comments please use complete sentences with no 
unnecessary abbreviations, i.e. "Only support generic registers".

Thanks,

	Ingo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ