From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 50F833858D28 for ; Mon, 1 May 2023 13:43:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 50F833858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gnu.org Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ptToh-00016b-34; Mon, 01 May 2023 09:43:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=In-Reply-To:MIME-Version:References:Subject:To:From: Date; bh=O74mSqjJQNgB9jYIEl8nREISMU38wr0XpB281BtD0G4=; b=IyAq1hrvXswpCqJpeUfi w3nv7levwt7P/LxjpI0rL/okQakScVMM0+Z+6e9jahCjAJJ4OXH7oe3olVk+jnFFjyOXaqDOd8jrx OLJDeDnV6uvJk8G808ussYgWnmfjgDaeU+CF74UpcQxS0AHqukOHiWkro5v24TkK+60rneGvULxdX FEfusUxHUOsdkSu25aBQm56dmEs7ifaB0qMMvcLt3p1vRYdqRCpODrkCw3CF7W3J/hMqbCUw+Zm/k /eGTEUsVCDaT905P72p0FZDyPD99zT2DdRTGm77vAcGxXXWVFK+SJ1m+qLvj/u1sMr75PxPEwxscI Munitb86BHoIww==; Received: from [2a01:cb19:4a:a400:de41:a9ff:fe47:ec49] (helo=begin) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ptTog-0005sX-NQ; Mon, 01 May 2023 09:43:46 -0400 Received: from samy by begin with local (Exim 4.96) (envelope-from ) id 1ptToe-00G9u4-0S; Mon, 01 May 2023 15:43:44 +0200 Date: Mon, 1 May 2023 15:43:44 +0200 From: Samuel Thibault To: bug-hurd@gnu.org Cc: libc-alpha@sourceware.org, commit-hurd@gnu.org Subject: Re: [hurd, commited] socket: Fix tst-cmsghdr-skeleton.c use of cmsg_len Message-ID: <20230501134344.64xqz7doskwlsmyb@begin> Mail-Followup-To: bug-hurd@gnu.org, libc-alpha@sourceware.org, commit-hurd@gnu.org References: <20230501130607.3846669-1-samuel.thibault@ens-lyon.org> <874jow41ei.fsf@igel.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <874jow41ei.fsf@igel.home> Organization: I am not organized User-Agent: NeoMutt/20170609 (1.8.3) X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Andreas Schwab, le lun. 01 mai 2023 15:38:45 +0200, a ecrit: > On Mai 01 2023, Samuel Thibault wrote: > > > cmsg_len is supposed to be socklen_t according to standards, but it was made > > size_t on Linux, see BZ 16919. For ports that have it socklen_t, SIZE_MAX is > > too large. We can however explicitly cast it to the type of cmsg_len so it > > will fit according to that type. > > --- > > socket/tst-cmsghdr-skeleton.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/socket/tst-cmsghdr-skeleton.c b/socket/tst-cmsghdr-skeleton.c > > index 296a0a8581..9516139f87 100644 > > --- a/socket/tst-cmsghdr-skeleton.c > > +++ b/socket/tst-cmsghdr-skeleton.c > > @@ -49,7 +49,7 @@ RUN_TEST_FUNCNAME (CMSG_NXTHDR_IMPL) (void) > > /* The first header length is so big, using it would cause an overflow. */ > > cmsg = CMSG_FIRSTHDR (&m); > > TEST_VERIFY_EXIT ((char *) cmsg == cmsgbuf); > > - cmsg->cmsg_len = SIZE_MAX; > > + cmsg->cmsg_len = (__typeof (cmsg->cmsg_len)) SIZE_MAX; > > What does that fix? 64bit hurd, where cmsg_len is socklen_t as the standards require (thus 32bit). Samuel