From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTP id 0B0A25A0082 for ; Wed, 8 Feb 2023 16:54:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675871699; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=k0Maq6iEHd1pF0alZbxZIw+Z7BeZdv9eaMK/jj3Z7vU=; b=QWurxfnXDXEuCCBlVkeYoBtO+Jf2WnpwxJGdXDvv/UfZhuASWyZdzi/f1c/dlDBgsPo+5q Fyg27qaVpzUKBDpRl6RwX3gZclzeBqceU8oulaQSmqnGoSTL5fvT4dCMPM8RxdeL0ookQR d1/XCiQUY7EvD0I+tjz0Ml9vKgCs+ig= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-338-2quIFLGXNNyxPvlTW4xASw-1; Wed, 08 Feb 2023 10:54:57 -0500 X-MC-Unique: 2quIFLGXNNyxPvlTW4xASw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2D7D5882828 for ; Wed, 8 Feb 2023 15:54:57 +0000 (UTC) Received: from pholzing-fedora.redhat.com (unknown [10.39.193.122]) by smtp.corp.redhat.com (Postfix) with ESMTP id 76B52492B00; Wed, 8 Feb 2023 15:54:56 +0000 (UTC) From: Paul Holzinger To: passt-dev@passt.top Subject: [PATCH 1/2] pasta: correctly exit when execvp() fails Date: Wed, 8 Feb 2023 16:54:40 +0100 Message-Id: <20230208155441.64306-1-pholzing@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-MailFrom: pholzing@redhat.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation Message-ID-Hash: 4ONCXSEQURHXNW22D2L4P6DFTRZ4CIY7 X-Message-ID-Hash: 4ONCXSEQURHXNW22D2L4P6DFTRZ4CIY7 X-Mailman-Approved-At: Wed, 08 Feb 2023 17:27:13 +0100 CC: Paul Holzinger X-Mailman-Version: 3.3.3 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: By default clone() will create a child that does not send SIGCHLD when the child exits. The caller has to specifiy the SIGNAL it should get in the flag bitmask. see clone(2) under "The child termination signal" This fixes the problem where pasta would not exit when the execvp() call failed, i.e. when the command does not exists. Signed-off-by: Paul Holzinger --- pasta.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pasta.c b/pasta.c index 528f02a..3f6477c 100644 --- a/pasta.c +++ b/pasta.c @@ -229,7 +229,7 @@ void pasta_start_ns(struct ctx *c, uid_t uid, gid_t gid, pasta_child_pid = do_clone(pasta_spawn_cmd, ns_fn_stack, sizeof(ns_fn_stack), CLONE_NEWIPC | CLONE_NEWPID | CLONE_NEWNET | - CLONE_NEWUTS, + CLONE_NEWUTS | SIGCHLD, (void *)&arg); if (pasta_child_pid == -1) { -- 2.39.1