From: Ingo Molnar <mingo@kernel.org>
To: kan.liang@linux.intel.com
Cc: vincent.weaver@maine.edu, ak@linux.intel.com,
peterz@infradead.org, alexander.shishkin@linux.intel.com,
acme@redhat.com, jolsa@redhat.com, eranian@google.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] perf/x86/regs: Check reserved bits
Date: Sat, 25 May 2019 10:49:49 +0200 [thread overview]
Message-ID: <20190525084949.GB15802@gmail.com> (raw)
In-Reply-To: <1558636616-4891-2-git-send-email-kan.liang@linux.intel.com>
* kan.liang@linux.intel.com <kan.liang@linux.intel.com> wrote:
> From: Kan Liang <kan.liang@linux.intel.com>
>
> The perf fuzzer triggers a warning which map to:
>
> if (WARN_ON_ONCE(idx >= ARRAY_SIZE(pt_regs_offset)))
> return 0;
>
> The bits between XMM registers and generic registers are reserved.
> But perf_reg_validate() doesn't check these bits.
>
> Add REG_RESERVED for reserved bits.
> Check the reserved bits in perf_reg_validate().
>
> Fixes: 878068ea270e ("perf/x86: Support outputting XMM registers")
> Reported-by: Vince Weaver <vincent.weaver@maine.edu>
> Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
> ---
> arch/x86/kernel/perf_regs.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kernel/perf_regs.c b/arch/x86/kernel/perf_regs.c
> index 86ffe5a..3f8c1fc 100644
> --- a/arch/x86/kernel/perf_regs.c
> +++ b/arch/x86/kernel/perf_regs.c
> @@ -79,6 +79,9 @@ u64 perf_reg_value(struct pt_regs *regs, int idx)
> return regs_get_register(regs, pt_regs_offset[idx]);
> }
>
> +#define REG_RESERVED (((1ULL << PERF_REG_X86_XMM0) - 1) & \
> + ~((1ULL << PERF_REG_X86_MAX) - 1))
This is just randomly polluting the macro namespace with a new variant.
We have PERF_REG_X86_ pattern - why not name the new one within that
pattern?
Thanks,
Ingo
next prev parent reply other threads:[~2019-05-25 8:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-23 18:36 [PATCH 1/2] perf/x86: Disable non generic regs for software/probe events kan.liang
2019-05-23 18:36 ` [PATCH 2/2] perf/x86/regs: Check reserved bits kan.liang
2019-05-25 8:49 ` Ingo Molnar [this message]
2019-05-24 13:03 ` [PATCH 1/2] perf/x86: Disable non generic regs for software/probe events Vince Weaver
2019-05-24 13:09 ` Liang, Kan
2019-05-25 8:48 ` Ingo Molnar
2019-05-27 18:33 ` Liang, Kan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190525084949.GB15802@gmail.com \
--to=mingo@kernel.org \
--cc=acme@redhat.com \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=eranian@google.com \
--cc=jolsa@redhat.com \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=vincent.weaver@maine.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox