[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMmz+YkdiJVjKSPM1+9RbXfGuERi3LyHP8aiKxoV5UJdoOO7Jw@mail.gmail.com>
Date: Mon, 27 Nov 2017 14:16:31 -0800
From: Milind Chabbi <chabbi.milind@...il.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Milind Chabbi <chabbi.milind@...il.com>,
Jiri Olsa <jolsa@...hat.com>, Jiri Olsa <jolsa@...nel.org>,
Ingo Molnar <mingo@...nel.org>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
lkml <linux-kernel@...r.kernel.org>,
Namhyung Kim <namhyung@...nel.org>,
David Ahern <dsahern@...il.com>,
Andi Kleen <ak@...ux.intel.com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Michael Ellerman <mpe@...erman.id.au>,
Hari Bathini <hbathini@...ux.vnet.ibm.com>,
Jin Yao <yao.jin@...ux.intel.com>,
Kan Liang <kan.liang@...el.com>,
Sukadev Bhattiprolu <sukadev@...ux.vnet.ibm.com>,
Oleg Nesterov <onestero@...hat.com>,
Will Deacon <will.deacon@....com>
Subject: Re: [PATCH 4/6] hw_breakpoint: Factor out __modify_user_hw_breakpoint function
On Mon, Nov 27, 2017 at 2:01 PM, Peter Zijlstra <peterz@...radead.org> wrote:
> On Mon, Nov 27, 2017 at 01:50:30PM -0800, Milind Chabbi wrote:
>> The possible checks is infinite
>
> struct perf_event_attr is very much a finite data type.
>
> Something as simple as:
>
> struct perf_event_attr tmp1 = new_attr, tmp2 = event->attr;
>
> tmp1.bp_type = tmp2.bp_type;
> tmp1.bp_addr = tmp2.bp_addr;
> tmp1.bp_len = tmp2.bp_len;
>
> if (memcmp(&tmp1, &tmp2, sizeof(tmp1)))
> return -EINVAL;
>
> would actually do the checks __modify_user_hw_breakpoint() needs to do.
Ok. That seems like a slick idea. I will post a patch that does this.
Powered by blists - more mailing lists