public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Laurent Vivier <lvivier@redhat.com>
Cc: passt-dev@passt.top
Subject: Re: [PATCH] seccomp.sh: Quote tr character ranges to prevent glob expansion
Date: Mon, 3 Nov 2025 23:36:14 +1100	[thread overview]
Message-ID: <aQihvgnEagEM5wwr@zatzit> (raw)
In-Reply-To: <20251103120834.192683-1-lvivier@redhat.com>

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

On Mon, Nov 03, 2025 at 01:08:34PM +0100, Laurent Vivier wrote:
> we use [a-z] and [A-Z] patterns with 'tr', but
> if there are files with names matching these patterns they will be
> replaced by the name of the file and seccomp.h will not be generated
> correctly:
> $ rm seccomp.h
> $ touch a b
> $ make
> tr: extra operand '[A-Z]'
> Try 'tr --help' for more information.
> seccomp profile passt allows:  accept accept4 bind clock_gettime close connect epoll_ctl epoll_pwait epoll_wait exit_group
>    fallocate fcntl fsync ftruncate getsockname getsockopt listen lseek read recvfrom recvmmsg recvmsg sendmmsg sendmsg sendto
> ...
> cc -Wall -Wextra -Wno-format-zero-length -Wformat-security -pedantic -std=c11 -D_XOPEN_SOURCE=700 -D_GNU_SOURCE -D_FORTIFY_SOURCE=2 -O2 -pie -fPIE -DPAGE_SIZE=4096 -DVERSION="2025_09_19.623dbf6-54-gf6b6118fcabd" -DDUAL_STACK_SOCKETS=1 -DHAS_GETRANDOM -fstack-protector-strong   arch.c arp.c checksum.c conf.c dhcp.c dhcpv6.c epoll_ctl.c flow.c fwd.c icmp.c igmp.c inany.c iov.c ip.c isolation.c lineread.c log.c mld.c ndp.c netlink.c migrate.c packet.c passt.c pasta.c pcap.c pif.c repair.c tap.c tcp.c tcp_buf.c tcp_splice.c tcp_vu.c udp.c udp_flow.c udp_vu.c util.c vhost_user.c virtio.c vu_common.c -o passt
> In file included from isolation.c:83:
> seccomp.h:11:45: error: 'AUDIT_ARCH_' undeclared here (not in a function); did you mean 'AUDIT_ARCH'?
>    11 |         BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, AUDIT_ARCH_, 0, 80),
>       |                                             ^~~~~~~~~~~
> 
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>

Ouch.

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

> ---
>  seccomp.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/seccomp.sh b/seccomp.sh
> index a7bc417b9f6b..ba92b29d9a29 100755
> --- a/seccomp.sh
> +++ b/seccomp.sh
> @@ -22,7 +22,7 @@ IN="$@"
>  [ -z "${ARCH}" ] && ARCH="$(uname -m)"
>  [ -z "${CC}" ] && CC="cc"
>  
> -AUDIT_ARCH="AUDIT_ARCH_$(echo ${ARCH} | tr [a-z] [A-Z]             \
> +AUDIT_ARCH="AUDIT_ARCH_$(echo ${ARCH} | tr '[a-z]' '[A-Z]'         \
>                                        | sed 's/^ARM.*/ARM/'        \
>                                        | sed 's/I[456]86/I386/'     \
>                                        | sed 's/PPC64/PPC/'         \
> -- 
> 2.51.0
> 

-- 
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 --]

  reply	other threads:[~2025-11-03 22:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-03 12:08 Laurent Vivier
2025-11-03 12:36 ` David Gibson [this message]
2025-11-04  5:01 ` Stefano Brivio
2025-11-04 13:49   ` Laurent Vivier
2025-11-05  1:22   ` David Gibson
2025-11-14  0:01     ` Stefano Brivio
2025-11-14  0:50       ` David Gibson
2025-11-04 21:14 ` Stefano Brivio

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=aQihvgnEagEM5wwr@zatzit \
    --to=david@gibson.dropbear.id.au \
    --cc=lvivier@redhat.com \
    --cc=passt-dev@passt.top \
    /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.
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).