From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 24009 invoked from network); 19 Jan 2023 14:59:07 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 19 Jan 2023 14:59:07 -0000 Received: (qmail 11756 invoked by uid 550); 19 Jan 2023 14:59:03 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 11711 invoked from network); 19 Jan 2023 14:59:02 -0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oaQ5aZfGtBalh5N27B9m3YHCjPrOIfkIG22xhLZY36q6KhJ9+Wn95o/ki5YqsOWOWuq0wUmiEaZIrV9HMcVesMx5sIkEmZQJeDBmGKUl3fGSzRRGfbTxVAbDHE7Bi22oDmxs71X9vY81WDQs1XkYlirw+ssbBe4rdvyL7rqR4pIy47hV8RRowDG1KQ5Ny4uR45v0cfnB7opEFZ6m+24+/hsPzKEiVdnBjrMSfU1zc+fukaJgBxOe/l9mT0aTJvW3W+KbDHO+SZNjtfgEEho1sAAUR3PxBvg1brAbNDOhEG2hIc6+9ROU3sMbfP2wiEkNs94zDF+REBovhuRMAqUU/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=F6nr0t04cMeIMnS28p8uyKfzi7Ke+Pbqu/1Wj6u63+M=; b=dihNasgBTzSWqIHm/xeExYYCPBLk26o3U1fUogFjgFaDjCYOWpySK35mDAkoDnmZnCE+CutgNM8xCqMfG7LnkM9sfGR0/qkpd97bo0fa46LHLDapCrh4JWjhzb1gTXpOJi2uY9ofdy3l3t47rW+rJpGEEahNfwtDjCKW//yWFbbAOqWUYsuKMzKV+PA38laTw0wdRrfdt7BdOgIDq4k34HqJPZQu2v2j+rTC7ZFwrjzMNawDaCde+R+ztrafKwTYg8f4Jr0kM9EZ3sf8C1N1YcHYpn8HjEOU1tGjGXbCtvtaANgNsmMLtKD+ribeYYuV2dePqwLLk1riQiaZ8Fu+cg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=F6nr0t04cMeIMnS28p8uyKfzi7Ke+Pbqu/1Wj6u63+M=; b=Ll6kYkhPLUUgdLWsrE7bkodi74METPBsDO11Lrg/KuhUdqS0pEoMwXnyL0yJN+8rwjaluvy5rnz/BtrR0qM0veR3vx4Q6vvvFs+hXIJwKB03reN38cVPR/UeAoPcj/JW8AneHBc32LSVXSaFcLQWF5qoinJft6JbXyg6CWq/diQ= From: Barry Bond To: Rich Felker CC: "musl@lists.openwall.com" Thread-Topic: [EXTERNAL] Re: [musl] Behavior change in getaddrbyname() with AF_UNSPEC Thread-Index: Adkoav5p71MTtM4ESZaetbz2cBVolgC5keKAADFDx1A= Date: Thu, 19 Jan 2023 14:58:47 +0000 Message-ID: References: <20230118152645.GG4163@brightrain.aerifal.cx> In-Reply-To: <20230118152645.GG4163@brightrain.aerifal.cx> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=7c4eeb04-7a48-4b9a-9a4b-3408b95a9afe;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=true;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Standard;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=Internal;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2023-01-19T14:57:21Z;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM6PR21MB1611:EE_|CY8PR21MB3816:EE_ x-ms-office365-filtering-correlation-id: 7412d544-e6a7-4408-fc9c-08dafa2dab16 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: M+s9eNcm5cJ7ySN9+nSlJYc1/0MP0oMUp/fp7+EKJCersvZbm+auJuwKLSPQBiu4FO0T0isSM66ugVoV4j/4PAKVgGydnj5Mozp9SXXCE/VS2VBskxydwotR8zfJl6s77vJx00eTTyNS++QT3NFjacCcepuiHpoRRIc3TMFl550/MiWPZKerzfG/UuR8LIFvfN7xM/tKFWgr1gFVQVzugbA7pYkdudHH72RojeWXcGxo1tgu91UXWRRacJpYeJhN4PhtOyddvtZTxJ014n0vQZA6LOmHDAwXUFWI9LD3xQK8M03ummaZwbs30GCUgVVZzVj9P6gRUqOeu2pRqq2AArswyfp00Vf9Mng3oLhWRRWsxtALl3thcFiK4xEzTQQLPZeJxSEK7M4MgihIq2jnAgSN4VKZnznyHWYko6cxVtYoO2y48p+4YEOB8pmkKqNsfUn2OxI0ZaSAYs68xMz2OGyeVstMpbXM6M+FKervB/7QO6rwoqXOmA9EjgkE0uQNLLZIDhFRwJzt41tu/o+Pvqrb48pQg+v4XOVnnn1/kLkDxO9hStoF4jGJ7Am4GhS3dz0kwoVAvT6I1o7IoUMRBmRMRVfFPIIlVeY5L5pc6XoFwjP8mQhx9yO5kfITIZBEDiCsEIis9e6Y/vQMdk4H0efSUcNUHvcYzbRXbRzRyYhjYpSLsrh6/uqvU+XH46icdSIkDizuMcfYvu9IOy0UrHB6Qo6j897+o22b+zy+T+9vaL8GzGRBFAOed+MmENXFoO4WcDhJeFUd752uakYrvLmRMhKg8Ruo1d2AiXQwwx0= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR21MB1611.namprd21.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(39860400002)(376002)(396003)(346002)(136003)(366004)(451199015)(82950400001)(82960400001)(38100700002)(122000001)(33656002)(38070700005)(86362001)(966005)(52536014)(8936002)(41300700001)(5660300002)(66446008)(316002)(66946007)(64756008)(76116006)(66556008)(66476007)(8676002)(6916009)(4326008)(2906002)(8990500004)(55016003)(83380400001)(7696005)(53546011)(478600001)(10290500003)(71200400001)(186003)(26005)(6506007)(9686003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?K9y2LwSzONFN6ZUp+aacvaJYN7zImfSs50M1PH08f3+ffIMt9BMOEhgRWSkv?= =?us-ascii?Q?oMfsC9EnDfnaMWZ7nSAk8Mq4MwGhk3HcGFGOsw/CbV7lqCTM5fxNFstTonIP?= =?us-ascii?Q?4ScRfKOVbTqm/UHgByL3ylSyxQmw2P3vdIaxRc5/lyI/oXUAzp0E116hBycx?= =?us-ascii?Q?eHbpNOKFrD27OBw+HjTQzgSoWLYZeKDjMZkE2SBXOZXKaTSPAWcDwg9JdLUP?= =?us-ascii?Q?EJRMbQ81CCNGETwdpInX9+CRUBXdiyvziSRDNIB0ZuL9UfA8OVwHtmdWv6RW?= =?us-ascii?Q?qkb5/YLMoMjx3mHXVvXmwnY4ECjZxW5Zfyj62drbvkB7Z/uFS/qeyoAo5f0B?= =?us-ascii?Q?RyULUMSu41STljMhudZN8l9MNsgbbXNSznENgVOCoq54fh8nfnEs7764MtGf?= =?us-ascii?Q?pEf1vTCJgmj+5TnrffgaWEc8BtgW3JcONQnGcDEl3040IW6qz4KqhBuel0x+?= =?us-ascii?Q?Irr29w5IiaDbyuqVXJ6433SMryNxHINVTtZVDbvRJASgVm/76e6P6nyahhZc?= =?us-ascii?Q?bpuhbcO7+jWf0KJBAOpRCMnNDf3qQenhRoB4800rOgGclhWZowB4KituWNSO?= =?us-ascii?Q?toVOyu5+F4ZOlx040jv/Wvjal+tWsnv+lUlC4MCk4VlUomAS07dHmY3PRMYl?= =?us-ascii?Q?lQ516+q4NVFpyAM2hcla1Kr28mQOzLHEyRITPeDD6vCQ58F1/skgVwAxTzji?= =?us-ascii?Q?NNx6aDAIB+BLApYt6L2togJIMeVzoHaSKc4gttynJle7M++aIF8mp6P4bJbV?= =?us-ascii?Q?cKCShYIqRjlI+7R3bM1DZQqDL53yFkcBkIRcH/+MOIvNFOPh0kiOWEzQmZYH?= =?us-ascii?Q?doLOwrW0jsR7SP0PTbLKultzDjBrj6B7BhORfi56rh1sR6ZWLzJjpRnFj4l2?= =?us-ascii?Q?EIxJvRl6EvTBWUygNlmQcTONXskfF3UeWeOfUQq0FlFoWJS9kLxsehIIgGPi?= =?us-ascii?Q?Qm6Juu36dvCkHjkViGvfN5SXv36fNonUnPpZoNjTXdZneTlzU53usAZ3jnA4?= =?us-ascii?Q?qrrX31kK0VNJHhaT3C29cvoeel6GDInHI6mg5bs14VjikAjiISZtaHG+DzEY?= =?us-ascii?Q?NdRDN39XlCoGJP/GDKjWNZURQfp+Sx8s6X+YNsrcLTsJDzdYtwJUfEVeFA7z?= =?us-ascii?Q?vjIGVmU/3QObDy0w9OaNbNYBnDfMD0NLyBA4ABhauR92QN4H/xeiBohg3oUo?= =?us-ascii?Q?UaaBkqFSp13VGERjS6LQRUkgflBWnMIrNeQoXgoCjwpr8Uo6nv2rHajQ484Q?= =?us-ascii?Q?AtD1h8YWT7YmJCqN1p1WJwy4pOhybq3jMl5Y776yFu0r1k3JvqfubRIEC5z2?= =?us-ascii?Q?t6el/LcbLBeK9+Ln5QKY7dPDkckHdY4xfVYMD/E7lfbSwkt2Jonz4xgC26JP?= =?us-ascii?Q?lCtAvA00z7bUZeexedLcaKvRseSVBUuX67lqV93L9YU8gPfBad+HTqw1l8fy?= =?us-ascii?Q?a3Szd9eB59TZOItQb0cHQCXvdCXdTTWUCrRTUWauJvp2lljiXKWuv1yNhWkK?= =?us-ascii?Q?Nxu3DTbaX6CHXd9UgwCekLMQbqNF23TRAGiyIsZbyINQg5L5qTf0SvCll8dV?= =?us-ascii?Q?WSyjiDFERohJMkrTlzNsNJqpzotEVkqL22vqI3eP?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR21MB1611.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7412d544-e6a7-4408-fc9c-08dafa2dab16 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Jan 2023 14:58:47.6760 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: +WzRqNZxGBGUyhWI2A5dGMBOqH/ARNnjh4uPaSLP6SN7qGIzia33QEBHLxKC9eA22XkqvchcLywQpir4y+WypA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR21MB3816 Subject: [musl] RE: [EXTERNAL] Re: [musl] Behavior change in getaddrbyname() with AF_UNSPEC OK, let me get more data about exactly what happened to the second query. Barry -----Original Message----- From: Rich Felker =20 Sent: Wednesday, January 18, 2023 7:27 AM To: Barry Bond Cc: musl@lists.openwall.com Subject: [EXTERNAL] Re: [musl] Behavior change in getaddrbyname() with AF_U= NSPEC [You don't often get email from dalias@libc.org. Learn why this is importan= t at https://aka.ms/LearnAboutSenderIdentification ] On Sat, Jan 14, 2023 at 10:56:28PM +0000, Barry Bond wrote: > This is related to this change: https://nam06.safelinks.protection.outlo= ok.com/?url=3Dhttps%3A%2F%2Fgit.musl-libc.org%2Fcgit%2Fmusl%2Fcommit%2F%3Fi= d%3D5cf1ac2443ad0dba263559a3fe043d929e0e5c4c&data=3D05%7C01%7Cbarrybo%40mic= rosoft.com%7C02af54c5fcbb4559460b08daf9686c4a%7C72f988bf86f141af91ab2d7cd01= 1db47%7C1%7C0%7C638096524143833435%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAw= MDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=3D= Yh3xEyuJixzQbjEWRofxh85c%2BF6yxkUsxy3LgS2tasw%3D&reserved=3D0 made back in = 2020. > > In the repro case, getaddrbyname() with AF_UNSPEC sends out two=20 > requests, but only gets back a single response, with the ipv4 address.=20 > There is no ipv6 on the network. > > name_from_dns() contains the relevant code. After __res_msend_rc()=20 > returns, 'nq' is 2, and 'alens' is [96, 0], indicating that there was=20 > an ipv4 response of 96 bytes, but no response for ipv6. Then the=20 > validation code runs: > > for (i=3D0; i if (alens[i] < 4 || (abuf[i][3] & 15) =3D= =3D 2) return EAI_AGAIN; > if ((abuf[i][3] & 15) =3D=3D 3) return 0; > if ((abuf[i][3] & 15) !=3D 0) return EAI_= FAIL; > } > > and the result is EAI_AGAIN, because alens[1]=3D=3D0. > > Before this patch, the code would have parsed the ipv4 response via=20 > __dns_parse(), failed to parse the empty second response because=20 > alens[1]<12, and the function would return with ctx.cnt=3D=3D1. That was the wrong behavior that this patch fixed. Previously, the query wa= s timing out, but because there was an answer to the other query, we were e= rroneously hiding the failure from the application and presenting a timing-= /network-congestion-dependent incorrect result (wrongly claiming only A or = only AAAA exist when in fact we didn't get enough information to make that = determination). "There is no ipv6 on the network" is not cause for the AAAA query to timeou= t. The ability to lookup a particular RR type has nothing to do with what n= etwork protocols are supported on your network. Can you describe the enviro= nment this is happening in and why it might be happening? Rich