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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yidmd3I2eHoZo/Wv@krava>
Date:   Tue, 8 Mar 2022 15:21:43 +0100
From:   Jiri Olsa <olsajiri@...il.com>
To:     Andrii Nakryiko <andrii.nakryiko@...il.com>
Cc:     Jiri Olsa <jolsa@...nel.org>, Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>,
        Masami Hiramatsu <mhiramat@...nel.org>,
        Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
        lkml <linux-kernel@...r.kernel.org>,
        Martin KaFai Lau <kafai@...com>,
        Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
        John Fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...omium.org>,
        Steven Rostedt <rostedt@...dmis.org>
Subject: Re: [PATCH 02/10] bpf: Add multi kprobe link

On Mon, Mar 07, 2022 at 05:23:34PM -0800, Andrii Nakryiko wrote:
> On Sun, Mar 6, 2022 at 9:28 AM Jiri Olsa <olsajiri@...il.com> wrote:
> >
> > On Fri, Mar 04, 2022 at 03:11:01PM -0800, Andrii Nakryiko wrote:
> >
> > SNIP
> >
> > > > +static int
> > > > +kprobe_multi_resolve_syms(const void *usyms, u32 cnt,
> > > > +                         unsigned long *addrs)
> > > > +{
> > > > +       unsigned long addr, size;
> > > > +       const char **syms;
> > > > +       int err = -ENOMEM;
> > > > +       unsigned int i;
> > > > +       char *func;
> > > > +
> > > > +       size = cnt * sizeof(*syms);
> > > > +       syms = kvzalloc(size, GFP_KERNEL);
> > > > +       if (!syms)
> > > > +               return -ENOMEM;
> > > > +
> > > > +       func = kmalloc(KSYM_NAME_LEN, GFP_KERNEL);
> > > > +       if (!func)
> > > > +               goto error;
> > > > +
> > > > +       if (copy_from_user(syms, usyms, size)) {
> > > > +               err = -EFAULT;
> > > > +               goto error;
> > > > +       }
> > > > +
> > > > +       for (i = 0; i < cnt; i++) {
> > > > +               err = strncpy_from_user(func, syms[i], KSYM_NAME_LEN);
> > > > +               if (err == KSYM_NAME_LEN)
> > > > +                       err = -E2BIG;
> > > > +               if (err < 0)
> > > > +                       goto error;
> > > > +
> > > > +               err = -EINVAL;
> > > > +               if (func[0] == '\0')
> > > > +                       goto error;
> > >
> > > wouldn't empty string be handled by kallsyms_lookup_name?
> >
> > it would scan and compare all symbols with empty string,
> > so it's better to test for it
> 
> I don't mind, but it seems like kallsyms_lookup_name() should be made
> smarter than that instead, no?

true, I'll do that

jirka

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ