From owner-freebsd-net@freebsd.org Sat Jan 9 17:28:09 2021 Return-Path: Delivered-To: freebsd-net@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F32914DD5A8 for ; Sat, 9 Jan 2021 17:28:09 +0000 (UTC) (envelope-from shamaz.mazum@gmail.com) Received: from mail-ot1-x334.google.com (mail-ot1-x334.google.com [IPv6:2607:f8b0:4864:20::334]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DCn491lRBz3lqH; Sat, 9 Jan 2021 17:28:08 +0000 (UTC) (envelope-from shamaz.mazum@gmail.com) Received: by mail-ot1-x334.google.com with SMTP id d20so12975764otl.3; Sat, 09 Jan 2021 09:28:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=BRFoOu2BSjlSL8pF15OYKi8s+nQHdgo7G8c4xnr+MvU=; b=NmxXJt23j0L72Ly1yj9YmfnweIsYI1TfUBRw0XmjFkpuuX2qk9o2J9L5B0NZCzMjGd E0fL8msyMydhW+ntPOaPE4ON1uRka73K+HW7PV3xhXXG7m+ualf7dAKMH1IYwLqRG4wr RTOf+D/VltKjBa9VZAqQBEG5Cuaww5OxWBtrjbr94EN8siEl1Rveg9NUHA/k++V5ojVa tlRrFlqpz8ZPNXpcsSu6cmEOMshD7nZb2JoRsLtarAVqaWT1EwRJE81VaJxxSFaUj6u8 ssFhPqydHq5zJ77coIZeh5sKAjSeccvQ3Xmt42dqYaBUlftTjTRGV0AhgALlAQWeHILG rC/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=BRFoOu2BSjlSL8pF15OYKi8s+nQHdgo7G8c4xnr+MvU=; b=uiloYvhKbHsk9L0pX7ZYD+FAKsh84lZlDgtLuH/sg2uojQHwPTPApd7M4hoZ28MIxM yIVill0fjOP8M9ojFxuVFp8uf29B9nVyqODy20R9N4q2vwK1hOMZPCHmBRvSvxwkCK2Z 4RVd8YFXN4vkKY9vUHRcRQH8sDrIkmsAwBMZEBqda75Z5/yvM/rARGsBQPEn5LDZRGKR nZ5Jq0YkECdJYkUbRj9h1P3BXPuEZ2JCHBhOVHJxI7FXLEu/HVZ/v4zWvnGSatAE4ToL niLZTymMHvqFkVnpecfcpIkzeDaMuRJNQIIjgwHSdep62r1K7wNKmEd6y431OD82LdKj WKag== X-Gm-Message-State: AOAM531IQ6iXOAuLEwV0JKb6IcJHPN0fFiX9KCjPF9/Usjg3GtX2XRy5 9XJCsENZug4OmKyPM404z0jf6BwHFJM4HzwSP/hQGht10CJUxQ== X-Google-Smtp-Source: ABdhPJw4qEJh+Zxckr7jcanK1ywr1Ve0Ax29odRCwTK3ZoxrM1WDTctaTt+ZYAYS2OICExmZbGCZw6faXJ2wl/l0wXs= X-Received: by 2002:a05:6830:1e0c:: with SMTP id s12mr6234657otr.152.1610213288087; Sat, 09 Jan 2021 09:28:08 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Vasily Postnicov Date: Sat, 9 Jan 2021 20:27:57 +0300 Message-ID: Subject: Re: DNS using Name Service Switch module and Casper To: Mark Johnston Cc: freebsd-net@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4DCn491lRBz3lqH X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=NmxXJt23; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of shamazmazum@gmail.com designates 2607:f8b0:4864:20::334 as permitted sender) smtp.mailfrom=shamazmazum@gmail.com X-Spamd-Result: default: False [-2.00 / 15.00]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; DKIM_TRACE(0.00)[gmail.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[2607:f8b0:4864:20::334:from]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; TAGGED_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; NEURAL_SPAM_SHORT(1.00)[1.000]; SPAMHAUS_ZRD(0.00)[2607:f8b0:4864:20::334:from:127.0.2.255]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::334:from]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-net] X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2021 17:28:10 -0000 Oh, I almost forgot. I am on f2b794e now =D1=81=D0=B1, 9 =D1=8F=D0=BD=D0=B2. 2021 =D0=B3. =D0=B2 20:25, Vasily Postn= icov : > > Brilliant! It took me almost a day to dive into ZeroMQ to reassure > myself that there is nothing wrong with it. When I tried to write > minimal test programs which call fork after pthread_create() in all > combinations. When I realized that NSS stub module is what I need. > > Instructions: > > 1) Compile NSS stub module: cc -shared -fPIC -pthread -o > nss_zerodns.so.1 test.c (Note '.1' at the end). > 2) Copy nss_zerodns.so.1 to /usr/local/lib > 3) Apply the patch src_sbin_ping_main.c to ping source code. With this > patch ping will not quit too early when the initial call to > getaddrinfo() fails. > 4) Add stub module to /etc/nsswitch.conf: edit 'hosts' line to be > 'hosts: files dns zerodns' > 5) Ping non-existent host, like 'ping foo.bar' > 6) Ping will hang. The child process which it creates cannot be killed > even with killall -9 ping > > =D1=81=D0=B1, 9 =D1=8F=D0=BD=D0=B2. 2021 =D0=B3. =D0=B2 19:46, Mark Johns= ton : > > > > On Sat, Jan 09, 2021 at 04:16:49PM +0300, Vasily Postnicov wrote: > > > Turns out, if you do not specify either -4 or -6 to ping, unsandboxed > > > getaddrinfo() will be called in /usr/src/sbin/ping/main.c, line 139. > > > (what's the point in sandboxing then, lol?) This somehow affects > > > sandboxing. > > > > Indeed, that seems to be an issue with the recent merge of ping and > > ping6. > > > > I guess the initial call to getaddrinfo() causes nsswitch.conf to be > > parsed and your module is loaded before we fork(). The module is linke= d > > with libthr but obviously ping itself is not. I'm sure this kind of > > configuration worked at some point, there might have been a regression. > > > > If you can provide a stub NSS module that links libthr and demonstrates > > the issue, it would be useful. > > > > > Look at the screenshot, it explains where fork() gets stuck. > > > https://photos.app.goo.gl/T1B3Fo1hg6z7r3vZ6 > > > > And there are no other threads in the process?