From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 3E665385800C for ; Wed, 17 Nov 2021 13:54:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3E665385800C Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-416-2WdbtZiKM9WKDKlK-Pa37Q-1; Wed, 17 Nov 2021 08:54:10 -0500 X-MC-Unique: 2WdbtZiKM9WKDKlK-Pa37Q-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E743187D541; Wed, 17 Nov 2021 13:54:09 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.194.81]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3309E5C25D; Wed, 17 Nov 2021 13:54:09 +0000 (UTC) From: Florian Weimer To: Adhemerval Zanella Cc: libc-alpha@sourceware.org Subject: Re: [PATCH v3] Linux: Simplify __opensock and fix race condition [BZ #28353] References: <87wnn1df57.fsf@oldenburg.str.redhat.com> <371babb1-e79e-fb0b-b021-fa167bf023b0@linaro.org> Date: Wed, 17 Nov 2021 14:54:07 +0100 In-Reply-To: <371babb1-e79e-fb0b-b021-fa167bf023b0@linaro.org> (Adhemerval Zanella's message of "Mon, 8 Nov 2021 14:22:29 -0300") Message-ID: <87v90q6g74.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham 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-List-Received-Date: Wed, 17 Nov 2021 13:54:13 -0000 * Adhemerval Zanella: > On 27/09/2021 15:53, Florian Weimer via Libc-alpha wrote: >> AF_NETLINK support is not quite optional on modern Linux systems >> anymore, so it is likely that the first attempt will always succeed. >> Consequently, there is no need to cache the result. Keep AF_UNIX >> and the Internet address families as a fallback, for the rare case >> that AF_NETLINK is missing. The other address families previously >> probed are totally obsolete be now, so remove them. >> >> Use this simplified version as the generic implementation, disabling >> Netlink support as needed. > > It seems that defaulting to AF_NETLINKS fails for some operations on > older kernels: > > $ uname -a > Linux ubuntu16 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux > $ ./testrun.sh --tool=strace inet/test_ifindex --direct > [...] > socket(PF_NETLINK, SOCK_DGRAM|SOCK_CLOEXEC, NETLINK_ROUTE) = 3 > ioctl(3, SIOCGIFINDEX, {ifr_name="lo"}) = -1 EOPNOTSUPP (Operation not supported) > close(3) = 0 > > I am not sure if this something related to the system configuration or > some security features, but AF_UNIX does work in this case. Right. I will send a patch. I think it's not worth trying AF_NETLINK at all. Thanks, Florian