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.129.124]) by passt.top (Postfix) with ESMTP id 2DBF85A004E for ; Fri, 02 Aug 2024 15:57:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722607038; 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: in-reply-to:in-reply-to:references:references; bh=G1h0D8CNxIvc4mdAD2gpz7X4jvu5l5nf/48LVeFzsLg=; b=MeUbSEAez6F1ZIrDGkApKeWe7dcj3afJ62+mPcOcXtIx31YDpowhhz/ak/HroEDVYOqyhm zlRGHo5Wr7jQlnTnt2adfyuZIOYbSyD0nM08reBAcIFKvnGtt2kTJrPXtzkS/C8uVprdTJ w8sfSe/Gfp5ttIVE7Pe9GYrciT9f4kE= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-689-Pynx4TTAMxSqfzLgvJ4bCg-1; Fri, 02 Aug 2024 09:57:17 -0400 X-MC-Unique: Pynx4TTAMxSqfzLgvJ4bCg-1 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-3687faecea0so3772156f8f.2 for ; Fri, 02 Aug 2024 06:57:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722607036; x=1723211836; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=G1h0D8CNxIvc4mdAD2gpz7X4jvu5l5nf/48LVeFzsLg=; b=nUcM8GF07xH+xAvgbDPK5Hs7AgEP/YdVz79C2cZBDNd8XzWJeja12Mc5qE36I0SRZ1 l/s8XvPEKiaEVUIlcOh44i7hZbiQW9YCZXtfde8DH0+4bOB306ESBISmKl+NkWl7PC/0 HleaLNIqlAxGBa7omtWbkYusmYUq5HG8bvgTsK1sJFLyquDCgcOClbEU3SL1tkUnj24e Q9e47LfSp5VzoqRZhqKkGGXRd2nc/FftuzdmCqXKr3NyOoY22rfGsalxzafWsgeRLwvr KYXKXH5sb2o7j5ByhjuNJOaKsEsFkC91g01Af4BMkMb0ME3v5vptM8qvqzIRgMvac+h1 hUOw== X-Forwarded-Encrypted: i=1; AJvYcCWWYAlF7/Xug4sggnO498TaOJ8ll3u5vVvCRMvKrDiYftd06FzHHXfiDFlXz5qnptJs7es+D6Sb4hk=@passt.top X-Gm-Message-State: AOJu0YzezGSpUeaDrVVFEcXBlbYEpuRw7xh3VFdtnHNu1nChzE3j8AkE guuSNzPT8Mo5NtUNPm4vsWyV2QqztLx8aRRH3x3YTFwyicZwcFZ0cVwfe7KS/p4cWfX44leWQhW FA9/Di+aHhdrra+Rc9A/3gAX6pmbFun3TY1Ej5dPc/YwRbp4fpQ== X-Received: by 2002:a5d:47af:0:b0:367:8a9e:6bed with SMTP id ffacd0b85a97d-36bbc1d34b2mr2196530f8f.61.1722607036349; Fri, 02 Aug 2024 06:57:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHhVPjR3xFoPH+ArfU9sdBVT1TeY+QcsnMFZJ0ncF0Soi+WaZqF3ytC2yoRVki/vuqukhqlPQ== X-Received: by 2002:a5d:47af:0:b0:367:8a9e:6bed with SMTP id ffacd0b85a97d-36bbc1d34b2mr2196511f8f.61.1722607035855; Fri, 02 Aug 2024 06:57:15 -0700 (PDT) Received: from [192.168.188.25] ([80.243.52.136]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4282bb63f21sm94381895e9.29.2024.08.02.06.57.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 02 Aug 2024 06:57:15 -0700 (PDT) Message-ID: <18571d4e-8ada-467c-b5d6-c4a6b33efcfe@redhat.com> Date: Fri, 2 Aug 2024 15:57:14 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] pasta: Save errno on signal handler entry, restore on return when needed To: Stefano Brivio , passt-dev@passt.top References: <20240802133448.3778368-1-sbrivio@redhat.com> From: Paul Holzinger In-Reply-To: <20240802133448.3778368-1-sbrivio@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Message-ID-Hash: MAFCAZDQAF3YBLIVLZJGTUWBEGKUKEMC X-Message-ID-Hash: MAFCAZDQAF3YBLIVLZJGTUWBEGKUKEMC X-MailFrom: pholzing@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Ed Santiago X-Mailman-Version: 3.3.8 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: On 02/08/2024 15:34, Stefano Brivio wrote: > Ed reported this: > > # Error: pasta failed with exit code 1: > # Couldn't drop cap 3 from bounding set > # : No child processes > > in a Podman CI run with tests being run in parallel. The error message > itself, by the way, is fixed by commit 1cd773081f12 ("log: Drop > newlines in the middle of the perror()-like messages"), but how can we > possibly get ECHILD as failure code for prctl()? > > Well, we don't, but if we exit early enough, pasta_child_handler() > might run before we're even done with isolation steps, and it calls > waitid(), which sets errno. We need to restore it before returning > from the signal handler (if we return after calling functions that > might set it), as signal-safety(7) also implies: > > Fetching and setting the value of errno is async-signal-safe > provided that the signal handler saves errno on entry and > restores its value before returning. > > Eventually, we'll probably need to switch to signalfd(2) the day we > want to implement multithreading, but this will do for the moment. > > Reported-by: Ed Santiago > Link: https://github.com/containers/podman/issues/23478 > Signed-off-by: Stefano Brivio Reviewed-by: Paul Holzinger