Re: [PATCH 1/3] tracing/kprobe: Add PERF_EVENT_IOC_QUERY_KPROBE ioctl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 7, 2019 at 2:33 PM Daniel Xu <dxu@xxxxxxxxx> wrote:
>
>
> On Tue, Aug 6, 2019, at 11:06 PM, Yonghong Song wrote:
> [...]
> > > +int perf_event_query_kprobe(struct perf_event *event, void __user *info)
> > > +{
> > > +   struct perf_event_query_kprobe __user *uquery = info;
> > > +   struct perf_event_query_kprobe query = {};
> > > +   struct trace_event_call *call = event->tp_event;
> > > +   struct trace_kprobe *tk = (struct trace_kprobe *)call->data;
> > > +   u64 nmissed, nhit;
> > > +
> > > +   if (!capable(CAP_SYS_ADMIN))
> > > +           return -EPERM;
> > > +   if (copy_from_user(&query, uquery, sizeof(query)))
> > > +           return -EFAULT;
> > > +   if (query.size != sizeof(query))
> > > +           return -EINVAL;
> >
> > Note that here we did not handle any backward or forward compatibility.
> >
>
> I intended this to be reserved for future changes. Sort of like how new syscalls
> will check for unknown flags. I can remove this if it's a problem.

I think what Yonghong meant was that you should probably allow
query.size > sizeof(query), but make sure that all the extra stuff is
zeroed, similar to how it's done elsewhere (e.g.,
kernel/bpf/syscall.c).



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux