From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id TMzDAiebM2arGAMAWB0awg (envelope-from ) for ; Thu, 02 May 2024 09:54:47 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=lists.lttng.org header.i=@lists.lttng.org header.a=rsa-sha256 header.s=default header.b=qOCOr7Z2; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id EC2EA1E0C1; Thu, 2 May 2024 09:54:46 -0400 (EDT) Received: from lists.lttng.org (lists.lttng.org [167.114.26.123]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id D347F1E092 for ; Thu, 2 May 2024 09:54:44 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lists.lttng.org; s=default; t=1714658084; bh=GbDIU7dY+dFl8uRqZbe3g/FJa6Sgbk4HQhlucPq5KK0=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=qOCOr7Z2DtEOOPeDPKoTsSUKWaS2pyH95WQITYZaZgPIq7wzKiSl/Tqyf4Xqc6isI v+SOfrW4BoUuFFH4Ts0TukDtzCgE8lTcEgkda6CKT4Eu9N+enLl7c6im2UoiRA0z3I To/ldu5XHdbf6dRD+TlEnBokI9itqX6NAsPd4B3dvUN2GOTaqbB3tHxgCjSIbdYu1x /m6+2OCyoVt53fOnm02NxeSILs5JmR7R2Jy4TaIlszgFo5SnYcuba3ODrjK/dN3jDf IBD6EYkSiqAkkmtQmzsSlQ74ZEVCglqFAbaE5wL8j83LdZN+TxtTyKnhmZZ9w9qATk LMquLXPsE4gQA== Received: from lists-lttng01.efficios.com (localhost [IPv6:::1]) by lists.lttng.org (Postfix) with ESMTP id 4VVb5w0y8Rz2l2T; Thu, 2 May 2024 09:54:44 -0400 (EDT) Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by lists.lttng.org (Postfix) with ESMTPS id 4VVb5v2cwYz2l2S for ; Thu, 2 May 2024 09:54:43 -0400 (EDT) Received: from [172.16.0.134] (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4VVb5r2DPxzy0T; Thu, 2 May 2024 09:54:40 -0400 (EDT) Message-ID: <2a7f6659-4332-47ed-adbf-45e88915ac6b@efficios.com> Date: Thu, 2 May 2024 09:54:55 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Benjamin Marzinski , lttng-dev@lists.lttng.org, Michael Jeanson References: <20240501234242.2395659-1-bmarzins@redhat.com> Content-Language: en-US In-Reply-To: <20240501234242.2395659-1-bmarzins@redhat.com> Subject: Re: [lttng-dev] [PATCH urcu] fix: handle EINTR correctly in get_cpu_mask_from_sysfs X-BeenThere: lttng-dev@lists.lttng.org X-Mailman-Version: 2.1.39 Precedence: list List-Id: LTTng development list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Mathieu Desnoyers via lttng-dev Reply-To: Mathieu Desnoyers Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: lttng-dev-bounces@lists.lttng.org Sender: "lttng-dev" On 2024-05-01 19:42, Benjamin Marzinski via lttng-dev wrote: > If the read() in get_cpu_mask_from_sysfs() fails with EINTR, the code is > supposed to retry, but the while loop condition has (bytes_read > 0), > which is false when read() fails with EINTR. The result is that the code > exits the loop, having only read part of the string. > > Use (bytes_read != 0) in the while loop condition instead, since the > (bytes_read < 0) case is already handled in the loop. Thanks for the fix ! It is indeed the right thing to do. I would like to integrate this fix into the librseq and libside projects as well though, but I notice the the copy in liburcu is LGPLv2.1 whereas the copy in librseq and libside are MIT. Michael, should we first relicense the liburcu src/compat-smp.h implementation to MIT so it matches the license of the copies in librseq and libside ? Thanks, Mathieu > > Signed-off-by: Benjamin Marzinski > --- > src/compat-smp.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/compat-smp.h b/src/compat-smp.h > index 31fa979..075a332 100644 > --- a/src/compat-smp.h > +++ b/src/compat-smp.h > @@ -164,7 +164,7 @@ static inline int get_cpu_mask_from_sysfs(char *buf, size_t max_bytes, const cha > > total_bytes_read += bytes_read; > assert(total_bytes_read <= max_bytes); > - } while (max_bytes > total_bytes_read && bytes_read > 0); > + } while (max_bytes > total_bytes_read && bytes_read != 0); > > /* > * Make sure the mask read is a null terminated string. -- Mathieu Desnoyers EfficiOS Inc. https://www.efficios.com _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev