From patchwork Tue Mar 8 10:07:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 1602859 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=Lu1KFx9P; 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 4KCWL466nmz9sGL for ; Tue, 8 Mar 2022 21:10:36 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A89FF385800E for ; Tue, 8 Mar 2022 10:10:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A89FF385800E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1646734234; bh=UOWTZwxuRYYljq7qXyybSrRO8TWK3V43WFer5AmOGoU=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=Lu1KFx9P5/v1auavAEbSmRUuZtW5LYWmIoiXq9M2ubkG3XcVg6uqYZas4yrxccthf oWRcDToNx/oqYAtGkw9yCer5vdhKsOKZiKClPI926QgHoS8k8HNUeexblJLr9lDwk1 CG9HP0QOPTfKUuN4CQbYJ5onLSLRZpV84H+LiSM0= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from eastern.birch.relay.mailchannels.net (eastern.birch.relay.mailchannels.net [23.83.209.55]) by sourceware.org (Postfix) with ESMTPS id E8D403858C83 for ; Tue, 8 Mar 2022 10:08:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E8D403858C83 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 659B04612D1; Tue, 8 Mar 2022 10:08:11 +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 624FD461F20; Tue, 8 Mar 2022 10:07:45 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1646734090; a=rsa-sha256; cv=none; b=yF76LrxWrJ/iiOfYEp3joAbcGjdCDEaF25ORKN6z9B8tFqpWVcO3asy/QivrSTmwwNfzl9 pnHrK6ZLE3DSt1DhLVoz9333iZLWuO04bf6UA3/dQiWP5MS27VRgwRSkNKtfl9UnXqgvHF UgeikMgivHyM5eFsPTkkSMna+TeHvCOfvCCWoaxwogpHF9dlZ1Q9/alC8W2PsOHLdGP2NB gvAyaTz/LHkeVKf17tuiXp/lRtC6cHl/EdvYWnfYLc18yQaOzXOGvCKBaOoEgkd8TT4hNe LOYpgcRq+PVfFEg9PiDm7hHvhVNUsoSCMAJ6KeOxztQP+5p6vx7l5dWZKrSnjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1646734090; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=UOWTZwxuRYYljq7qXyybSrRO8TWK3V43WFer5AmOGoU=; b=TuM/H8wAU83RYsPwwa6knOaxp48tBcbckIAm9w9XFEsCfhCnM2yC3jDD4SOMRMrZlWcP89 zWPSUag83597tkg/tk4vBVqYC5Zk3J0jpaD7Qwg9JqfclNzTfS+g8v78mR1bwV4Vo/Zv6H mJTNjTRYCCvJUQ+lPbuvBwDLZ87dDJaUaf9523OyPh9yFRLR2RbDpWwova1JSoHtffe/bK E+2l2pYZ4SKfLOhYKkHaEyrOsBoPoaQLHC/8KKrpt1OBQWYYFwHRp0QRzeOCyf2iZ56h22 aeNZji2aFmiNR49GuTBvJT7tOB+ZI1aBL+krgOSbfdhef1qNBwolQkBvAOybxw== ARC-Authentication-Results: i=1; rspamd-c9cb649d9-7z87n; 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.114.196.240 (trex/6.5.3); Tue, 08 Mar 2022 10:08:11 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Hysterical-Reaction: 17ad3a59658cd8a6_1646734090915_1409714254 X-MC-Loop-Signature: 1646734090915:227812864 X-MC-Ingress-Time: 1646734090915 Received: from rhbox.redhat.com (unknown [1.186.224.155]) (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 4KCWGc5pb7z2x; Tue, 8 Mar 2022 02:07:36 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH 00/12] getaddrinfo facelift and fixes Date: Tue, 8 Mar 2022 15:37:05 +0530 Message-Id: <20220308100717.1006126-1-siddhesh@sourceware.org> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Spam-Status: No, score=-3486.4 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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 Cc: fweimer@redhat.com 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. 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 | 242 ++++++ sysdeps/posix/getaddrinfo.c | 1518 ++++++++++++++++++----------------- 3 files changed, 1046 insertions(+), 715 deletions(-) create mode 100644 nss/tst-nss-gai-actions.c