BPF List
 help / color / mirror / Atom feed
From: Mahe Tardy <mahe.tardy@gmail.com>
To: Song Liu <song@kernel.org>
Cc: bpf@vger.kernel.org, andrew+netdev@lunn.ch, andrii@kernel.org,
	ast@kernel.org, daniel@iogearbox.net, davem@davemloft.net,
	eddyz87@gmail.com, edumazet@google.com, john.fastabend@gmail.com,
	kuba@kernel.org, liamwisehart@meta.com, martin.lau@linux.dev,
	pabeni@redhat.com, netdev@vger.kernel.org, sdf.kernel@gmail.com,
	ameryhung@gmail.com, kuniyu@google.com
Subject: Re: [PATCH bpf-next v3 1/5] net: Add __sys_connect_socket() helper
Date: Thu, 6 Aug 2026 19:18:25 +0200	[thread overview]
Message-ID: <anTB4fYBFmmHcQpY@gmail.com> (raw)
In-Reply-To: <CAPhsuW5ZTqfzpxNf=S6JbmGxWf2m9qPZGberdzRdLuvv2-Xwgw@mail.gmail.com>

On Tue, Aug 04, 2026 at 09:05:28PM -0700, Song Liu wrote:
> On Tue, Aug 4, 2026 at 9:47 AM Mahe Tardy <mahe.tardy@gmail.com> wrote:
> >
> > Add a helper that connects an existing socket while invoking the LSM
> > hook. Reuse it in __sys_connect_file() to avoid duplicating the connect
> > logic. Other socket operations have equivalent helpers that trigger the
> > appropriate LSM hooks that can be reused, this one was the only one
> > missing.
> >
> > Signed-off-by: Mahe Tardy <mahe.tardy@gmail.com>
> > ---
> >  include/linux/socket.h |  2 ++
> >  net/socket.c           | 32 ++++++++++++++++++--------------
> >  2 files changed, 20 insertions(+), 14 deletions(-)
> >
> > diff --git a/include/linux/socket.h b/include/linux/socket.h
> > index 2a8d7b14f1d1..48f1eb8193de 100644
> > --- a/include/linux/socket.h
> > +++ b/include/linux/socket.h
> > @@ -461,6 +461,8 @@ extern struct file *__sys_socket_file(int family, int type, int protocol);
> >  extern int __sys_bind(int fd, struct sockaddr __user *umyaddr, int addrlen);
> >  extern int __sys_bind_socket(struct socket *sock, struct sockaddr_storage *address,
> >                              int addrlen);
> > +extern int __sys_connect_socket(struct socket *sock, struct sockaddr_storage *addr,
> > +                               int addrlen, int flags);
> 
> IIUC, __sys_ prefix is for functions behind syscalls. Do we really want this
> prefix here?

Yeah let's remove it.

> 
> Thanks,
> Song
> 
> >  extern int __sys_connect_file(struct file *file, struct sockaddr_storage *addr,
> >                               int addrlen, int file_flags);
> >  extern int __sys_connect(int fd, struct sockaddr __user *uservaddr,
> > diff --git a/net/socket.c b/net/socket.c
> > index 63c69a0fa74e..c7427dd4dd52 100644
> > --- a/net/socket.c
> > +++ b/net/socket.c

  reply	other threads:[~2026-08-06 17:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-04 16:46 [PATCH bpf-next v3 0/5] Introduce bpf_ksock Mahe Tardy
2026-08-04 16:46 ` [PATCH bpf-next v3 1/5] net: Add __sys_connect_socket() helper Mahe Tardy
2026-08-04 17:50   ` bot+bpf-ci
2026-08-05  4:05   ` Song Liu
2026-08-06 17:18     ` Mahe Tardy [this message]
2026-08-04 16:46 ` [PATCH bpf-next v3 2/5] bpf: Add ksock kfuncs Mahe Tardy
2026-08-05  4:55   ` Song Liu
2026-08-06 17:21     ` Mahe Tardy
2026-08-06 17:22       ` Kumar Kartikeya Dwivedi
2026-08-04 16:46 ` [PATCH bpf-next v3 3/5] selftests/bpf: Add ksock kfunc test Mahe Tardy
2026-08-04 16:46 ` [PATCH bpf-next v3 4/5] selftests/bpf: Add ksock LSM recursion test Mahe Tardy
2026-08-04 16:46 ` [PATCH bpf-next v3 5/5] selftests/bpf: Add ksock test for async callback guard Mahe Tardy

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=anTB4fYBFmmHcQpY@gmail.com \
    --to=mahe.tardy@gmail.com \
    --cc=ameryhung@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=eddyz87@gmail.com \
    --cc=edumazet@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=liamwisehart@meta.com \
    --cc=martin.lau@linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf.kernel@gmail.com \
    --cc=song@kernel.org \
    /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