public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
* [PATCH] seccomp: Unconditionally allow accept(2) even if accept4(2) is present
@ 2025-01-02 22:02 Stefano Brivio
  2025-01-03  0:40 ` David Gibson
  0 siblings, 1 reply; 2+ messages in thread
From: Stefano Brivio @ 2025-01-02 22:02 UTC (permalink / raw)
  To: passt-dev

On Alpine Linux 3.21, passt aborts right away as soon as QEMU connects
to it.

Most likely, this has always been the case with musl, because since
musl commit dc01e2cbfb29 ("add fallback emulation for accept4 on old
kernels"), accept4() without flags is implemented using accept().

However, I guess that nobody realised earlier because it's typically
pasta(1) being used on musl-based distributions, and the only place
where we call accept4() without flags is tap_listen_handler().

Add accept() to the list of allowed system calls regardless of the
presence of accept4().

Reported-by: NN708
Link: https://bugs.passt.top/show_bug.cgi?id=106
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
---
 passt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/passt.c b/passt.c
index 957f3d0..1a0c404 100644
--- a/passt.c
+++ b/passt.c
@@ -180,7 +180,7 @@ void exit_handler(int signal)
  * #syscalls socket getsockopt setsockopt s390x:socketcall i686:socketcall close
  * #syscalls bind connect recvfrom sendto shutdown
  * #syscalls arm:recv ppc64le:recv arm:send ppc64le:send
- * #syscalls accept4|accept listen epoll_ctl epoll_wait|epoll_pwait epoll_pwait
+ * #syscalls accept4 accept listen epoll_ctl epoll_wait|epoll_pwait epoll_pwait
  * #syscalls clock_gettime arm:clock_gettime64 i686:clock_gettime64
  */
 int main(int argc, char **argv)
-- 
@@ -180,7 +180,7 @@ void exit_handler(int signal)
  * #syscalls socket getsockopt setsockopt s390x:socketcall i686:socketcall close
  * #syscalls bind connect recvfrom sendto shutdown
  * #syscalls arm:recv ppc64le:recv arm:send ppc64le:send
- * #syscalls accept4|accept listen epoll_ctl epoll_wait|epoll_pwait epoll_pwait
+ * #syscalls accept4 accept listen epoll_ctl epoll_wait|epoll_pwait epoll_pwait
  * #syscalls clock_gettime arm:clock_gettime64 i686:clock_gettime64
  */
 int main(int argc, char **argv)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] seccomp: Unconditionally allow accept(2) even if accept4(2) is present
  2025-01-02 22:02 [PATCH] seccomp: Unconditionally allow accept(2) even if accept4(2) is present Stefano Brivio
@ 2025-01-03  0:40 ` David Gibson
  0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2025-01-03  0:40 UTC (permalink / raw)
  To: Stefano Brivio; +Cc: passt-dev

[-- Attachment #1: Type: text/plain, Size: 1788 bytes --]

On Thu, Jan 02, 2025 at 11:02:23PM +0100, Stefano Brivio wrote:
> On Alpine Linux 3.21, passt aborts right away as soon as QEMU connects
> to it.
> 
> Most likely, this has always been the case with musl, because since
> musl commit dc01e2cbfb29 ("add fallback emulation for accept4 on old
> kernels"), accept4() without flags is implemented using accept().
> 
> However, I guess that nobody realised earlier because it's typically
> pasta(1) being used on musl-based distributions, and the only place
> where we call accept4() without flags is tap_listen_handler().
> 
> Add accept() to the list of allowed system calls regardless of the
> presence of accept4().
> 
> Reported-by: NN708
> Link: https://bugs.passt.top/show_bug.cgi?id=106
> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  passt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/passt.c b/passt.c
> index 957f3d0..1a0c404 100644
> --- a/passt.c
> +++ b/passt.c
> @@ -180,7 +180,7 @@ void exit_handler(int signal)
>   * #syscalls socket getsockopt setsockopt s390x:socketcall i686:socketcall close
>   * #syscalls bind connect recvfrom sendto shutdown
>   * #syscalls arm:recv ppc64le:recv arm:send ppc64le:send
> - * #syscalls accept4|accept listen epoll_ctl epoll_wait|epoll_pwait epoll_pwait
> + * #syscalls accept4 accept listen epoll_ctl epoll_wait|epoll_pwait epoll_pwait
>   * #syscalls clock_gettime arm:clock_gettime64 i686:clock_gettime64
>   */
>  int main(int argc, char **argv)

-- 
David Gibson (he or they)	| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you, not the other way
				| around.
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-01-03  1:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-02 22:02 [PATCH] seccomp: Unconditionally allow accept(2) even if accept4(2) is present Stefano Brivio
2025-01-03  0:40 ` David Gibson

Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).