[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEhU8Zy09JLHhiAbPw+es4Pp6Xumg5DrDaNv=jfNvGvuReOnbA@mail.gmail.com>
Date: Mon, 23 Sep 2024 23:06:26 +0330
From: Sahand Evs <sahandevs@...il.com>
To: Eric Dumazet <edumazet@...gle.com>
Cc: Jordan Rife <jrife@...gle.com>, davem@...emloft.net, kuba@...nel.org,
pabeni@...hat.com, netdev@...r.kernel.org
Subject: Re: [PATCH] net: expose __sock_sendmsg() symbol
On Mon, Sep 23, 2024 at 10:30 PM Eric Dumazet <edumazet@...gle.com> wrote:
>
> On Mon, Sep 23, 2024 at 8:45 PM Sahand Akbarzadeh <sahandevs@...il.com> wrote:
> >
> > Yes, existing program still need some modification in order to work and
> > are already broken (from kernel 6.8 to master branch) for some time. The issue
> > here is there is no direct probe equivalent one could use to update those scripts.
> >
> > By adding `__sock_sendmsg`, one could attach based on kernel version or do something
> > like this:
> >
> > sudo bpftrace -e 'kprobe:sock_sendmsg,kprobe:__sock_sendmsg {}'
> >
> > which only throws a warning if it can't find the `__sock_sendmsg`
> >
> > - Sahand
>
> Convention on netdev mailing list is to not top post.
>
> Removing the static is not enough, a compiler and linker can
> completely inline / delete this function.
>
> Anyway, I do not think sock_sendmsg() was part of any ABI.
>
> If it was ABI, we would have to reinstate sock_sendmsg(), not making
> __sock_sendmsg() visible.
Sorry about the top posting. I do think this patch is not necessarily a good
solution to the problem but I'm not sure what is a/the good solution for it.
To give more context, I was trying to figure out why this observability script
(written in bpftrace) doesn't work on some kernels and how to fix it.
(goal: calculating network usage per process per thread. recv part
works fine)
kretprobe:sock_sendmsg
{
if (@inetsocket[tid] && retval < 0x7fffffff) {
@send_bytes[pid, comm, tid] = sum(retval);
}
delete(@inetsocket[tid])
}
Script Source:
https://www.gcardone.net/2020-07-31-per-process-bandwidth-monitoring-on-Linux-with-bpftrace/
> Removing the static is not enough
Should I also add a EXPORT_SYMBOL?
Powered by blists - more mailing lists