From patchwork Mon Mar 14 09:48:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 1604998 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=BMWKa628; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KHBZS1vHXz9sG2 for ; Mon, 14 Mar 2022 20:49:04 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0F30E3857835 for ; Mon, 14 Mar 2022 09:49:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0F30E3857835 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1647251342; bh=GFAJPQeBP1VUQwKohKooHQewHX34U9gDJuHJ/Y4Ga/U=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=BMWKa6282wEIALMZTpBuZ5isuxgBHdJhS0td2HL6AdENNnEDzoqEqmcR26RLcjKh+ vC84ji40Q276cVx0qDGssTTHRTAxio4nuSzZOXReAf8r7TGr6mutA+uo1A2MZUx710 YbyIvF07kBB6rqCtjQVjijKhmZdQTdYva2MUYi4Y= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from dog.birch.relay.mailchannels.net (dog.birch.relay.mailchannels.net [23.83.209.48]) by sourceware.org (Postfix) with ESMTPS id 474D13858C27 for ; Mon, 14 Mar 2022 09:48:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 474D13858C27 X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id B81F6460175 for ; Mon, 14 Mar 2022 09:48:44 +0000 (UTC) Received: from pdx1-sub0-mail-a305.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 0B596461A64 for ; Mon, 14 Mar 2022 09:48:44 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1647251324; a=rsa-sha256; cv=none; b=dTaxPc56dv0gOyS7cDP5aX7/6quq1guu8zxl38Q9f0YjR7m27JW2Cu+D7ymYfWgyAA9Mgv B7pXlHRcNboR9aR6nWslM7HKt9EV+920g1DvY3AV6hj3iNIuePAt9Sd2m3tOZ3CkggTjB7 5bFO8l4g81ftO35uHefpV1OERDrapHD9CJGV9w3NwAHXIeonXY+kBV/jvV2p2sN0AwhLQ8 pKeDpQ6QOoZ//KUiTVeZw99zL32n/ZVCLow23w1zJ0jDOPuYxRGwYyj5pCxB0zuZpDKkpK pLExuipOq/0oV2YQ3YfPkT29WN7wtYzbydq00SJ5dJIo58Najj+ckjGdkiZKaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1647251324; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GFAJPQeBP1VUQwKohKooHQewHX34U9gDJuHJ/Y4Ga/U=; b=j7tECIKgOD7Ha6givKq12YNRgsExVeLpmeABeZFcoVHK9P6Uu/70ZiGDLFRBlhSzP5PAFc sJTHnqpDsAxub/O3n2CZZGDrlT/o76hTieHxPbqpbbqZVMv+1kOb6LxEGBS20AzmqXC3Zb GpsCq7AcoTOprlNmjw0uf7zikpXRTkHUgWXPuFq1nS/9fUpzLwnzDGhNPJvMT92r+olFVG B+4KOJKbyq9RayaJaMuIlUd8KaiSENjoPDWWQrX/3gWazOwD74uA10aOgGDM/H5NEbrVfJ mTG+6osPLAt1HCGudBkV2z2gTRom2NgiM3SizhLgPNXiK02v/EDAuNRBxleyxw== ARC-Authentication-Results: i=1; rspamd-c9cb649d9-gswf9; auth=pass smtp.auth=dreamhost smtp.mailfrom=siddhesh@sourceware.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from pdx1-sub0-mail-a305.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.102.3.5 (trex/6.5.3); Mon, 14 Mar 2022 09:48:44 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Illustrious-Snatch: 6cd150d5186c65bf_1647251324270_3348630701 X-MC-Loop-Signature: 1647251324270:123349928 X-MC-Ingress-Time: 1647251324269 Received: from rhbox.redhat.com (unknown [106.220.192.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a305.dreamhost.com (Postfix) with ESMTPSA id 4KHBZ26NKhz2d for ; Mon, 14 Mar 2022 02:48:42 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH v2 00/12] getaddrinfo facelift and fixes Date: Mon, 14 Mar 2022 15:18:23 +0530 Message-Id: <20220314094835.1159523-1-siddhesh@sourceware.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220308100717.1006126-1-siddhesh@sourceware.org> References: <20220308100717.1006126-1-siddhesh@sourceware.org> MIME-Version: 1.0 X-Spam-Status: No, score=-1161.3 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NEUTRAL, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Siddhesh Poyarekar via Libc-alpha From: Siddhesh Poyarekar Reply-To: Siddhesh Poyarekar Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" The gaih_inet implementation, which forms the core of getaddrinfo, is quite complex in its implementation, making it hard to follow or debug. Particularly, allocations for gaih_addrtuples to store intermediate results are particularly hard to track because of the way in which it is written. This patchset is an attempt at cleaning up the implementation to make it much easier to follow. In the process, it also fixes a couple of bugs, one that was the trigger for this cleanup and another that was discovered during the cleanup. Testing: The leak reproducer in BZ #28852 could not be converted into a testsuite test since mtrace isn't able to track the leak, so I separately verified that it is fixed. There is a new test for #28931 which tests a variety of combinations with SUCCESS=merge and SUCCESS=continue. Further, I have built and done some smoke testing on Fedora with and without nscd to ensure that there are no regressions resulting from this patchset. Finally, I did a scratch build for Fedora and verified that there are no new regressions on i686, x86_64, s390x, ppc64le and aarch64. Changes from v1: - Fixed nit: boolean coercion in convert_hostent_to_gaih_addrtuple - Dropped DNS tests in tst-nss-gai-actions test since they are unnecessary and the files tests are sufficient. Siddhesh Poyarekar (12): Simplify allocations and fix merge and continue actions [BZ #28931] gaih_inet: Simplify canon name resolution getaddrinfo: Fix leak with AI_ALL [BZ #28852] gaih_inet: Simplify service resolution gaih_inet: make numeric lookup a separate routine gaih_inet: Split simple gethostbyname into its own function gaih_inet: Split nscd lookup code into its own function. gaih_inet: separate nss lookup loop into its own function gaih_inet: make gethosts into a function gaih_inet: split loopback lookup into its own function gaih_inet: Split result generation into its own function gethosts: Return EAI_MEMORY on allocation failure nss/Makefile | 1 + nss/tst-nss-gai-actions.c | 208 +++++ sysdeps/posix/getaddrinfo.c | 1518 ++++++++++++++++++----------------- 3 files changed, 1012 insertions(+), 715 deletions(-) create mode 100644 nss/tst-nss-gai-actions.c