public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Stefano Brivio <sbrivio@redhat.com>
Cc: passt-dev@passt.top
Subject: Re: [PATCH 5/8] util, pasta: Use __clone2() instead of clone() on ia64
Date: Wed, 16 Nov 2022 16:17:13 +1100	[thread overview]
Message-ID: <Y3RyWXfjkBRB14cv@yekko> (raw)
In-Reply-To: <20221115012349.2240096-6-sbrivio@redhat.com>

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

On Tue, Nov 15, 2022 at 02:23:46AM +0100, Stefano Brivio wrote:
> On ia64, clone(2) is not available: the glibc wrapper is named
> __clone2() and it takes, additionally, the size of the stack area
> passed by the caller.
> 
> Spotted in Debian's buildd logs.
> 
> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>

Urgh, I'd really prefer to make our own wrapper to reduce two ifdefs
to one.

> ---
>  pasta.c |  9 +++++++++
>  util.h  | 12 ++++++++++++
>  2 files changed, 21 insertions(+)
> 
> diff --git a/pasta.c b/pasta.c
> index db86317..1f3afa1 100644
> --- a/pasta.c
> +++ b/pasta.c
> @@ -226,11 +226,20 @@ void pasta_start_ns(struct ctx *c, uid_t uid, gid_t gid,
>  		arg.argv = sh_argv;
>  	}
>  
> +#ifdef __ia64__
> +	pasta_child_pid = __clone2(pasta_spawn_cmd,
> +				   ns_fn_stack + sizeof(ns_fn_stack) / 2,
> +				   sizeof(ns_fn_stack) / 2,
> +				   CLONE_NEWIPC | CLONE_NEWPID | CLONE_NEWNET |
> +				   CLONE_NEWUTS,
> +				   (void *)&arg);
> +#else
>  	pasta_child_pid = clone(pasta_spawn_cmd,
>  				ns_fn_stack + sizeof(ns_fn_stack) / 2,
>  				CLONE_NEWIPC | CLONE_NEWPID | CLONE_NEWNET |
>  				CLONE_NEWUTS,
>  				(void *)&arg);
> +#endif
>  
>  	if (pasta_child_pid == -1) {
>  		perror("clone");
> diff --git a/util.h b/util.h
> index 2d4e1ff..3c48992 100644
> --- a/util.h
> +++ b/util.h
> @@ -81,6 +81,17 @@
>  	(((struct in_addr *)(a))->s_addr == ((struct in_addr *)b)->s_addr)
>  
>  #define NS_FN_STACK_SIZE	(RLIMIT_STACK_VAL * 1024 / 8)
> +#ifdef __ia64__
> +#define NS_CALL(fn, arg)						\
> +	do {								\
> +		char ns_fn_stack[NS_FN_STACK_SIZE];			\
> +									\
> +		__clone2((fn), ns_fn_stack + sizeof(ns_fn_stack) / 2,	\
> +			 sizeof(ns_fn_stack) / 2,			\
> +			 CLONE_VM | CLONE_VFORK | CLONE_FILES | SIGCHLD,\
> +			 (void *)(arg));				\
> +	} while (0)
> +#else
>  #define NS_CALL(fn, arg)						\
>  	do {								\
>  		char ns_fn_stack[NS_FN_STACK_SIZE];			\
> @@ -89,6 +100,7 @@
>  		      CLONE_VM | CLONE_VFORK | CLONE_FILES | SIGCHLD,	\
>  		      (void *)(arg));					\
>  	} while (0)
> +#endif
>  
>  #if __BYTE_ORDER == __BIG_ENDIAN
>  #define L2_BUF_ETH_IP4_INIT						\

-- 
David Gibson			| 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:[~2022-11-16  5:19 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-15  1:23 [PATCH 0/8] Fixes for Debian package functionality and build Stefano Brivio
2022-11-15  1:23 ` [PATCH 1/8] Makefile: Honour passed CPPFLAGS, not just CFLAGS Stefano Brivio
2022-11-15  5:00   ` David Gibson
2022-11-15  1:23 ` [PATCH 2/8] Makefile: Don't filter out -O2 from supplied flags for AVX2 builds Stefano Brivio
2022-11-15  5:15   ` David Gibson
2022-11-15  1:23 ` [PATCH 3/8] Makefile: It's AUDIT_ARCH_MIPSEL64, not AUDIT_ARCH_MIPS64EL Stefano Brivio
2022-11-16  5:14   ` David Gibson
2022-11-15  1:23 ` [PATCH 4/8] Makefile: Change HPPA into PARISC while building PASST_AUDIT_ARCH Stefano Brivio
2022-11-16  5:15   ` David Gibson
2022-11-15  1:23 ` [PATCH 5/8] util, pasta: Use __clone2() instead of clone() on ia64 Stefano Brivio
2022-11-16  5:17   ` David Gibson [this message]
2022-11-16  8:12     ` Stefano Brivio
2022-11-15  1:23 ` [PATCH 6/8] README: Add links to Debian package tracker Stefano Brivio
2022-11-16  5:18   ` David Gibson
2022-11-15  1:23 ` [PATCH 7/8] contrib/apparmor: Merge pasta and passt profiles, update rules Stefano Brivio
2022-11-15  1:23 ` [PATCH 8/8] Remove contrib/debian, Debian package development now happens on Salsa 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=Y3RyWXfjkBRB14cv@yekko \
    --to=david@gibson.dropbear.id.au \
    --cc=passt-dev@passt.top \
    --cc=sbrivio@redhat.com \
    /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).