From patchwork Sun Jan 24 22:58:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Eichenberger X-Patchwork-Id: 1431051 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=lIIPjw57; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=Mm3Mxo/l; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (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 ozlabs.org (Postfix) with ESMTPS id 4DP7nV6zW2z9sT6 for ; Mon, 25 Jan 2021 10:02:54 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=n30/rJqDpLDiP/nNsHH4fB2CxYa9gBHi5PDOAyns3lc=; b=lIIPjw57N9Tyx+9NkwJff5vi8G Ma5Z+PuVGhOmP1T4W/jL5pt0HxhaTA4zPNANSkFyL+mdlnjbZLUEi0uAblQFR3dLOY1bwbAfRvDOJ NiLhEkNPUbLQrRebkYmPwuecsQgaQk3v2wucm4Ep5oOX/uO64IG/ukaJecyNMMSWd6Tjhom6N+10Q aVxuAF4UYc320e7APAzVe6l95TFBrm0NsQAHbFW/74ggRO2xvWw/t0lKadis0cur3JNK4wlU4oZd6 tft+BAAy6E+0o+FmPN6UFhWboAThPWIGPemurv8kT6KYdKFLKfi3rkRv03ZMrY2ZkkSPt1bLa38iM J/wDYraA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l3oM1-0005Ab-Rb; Sun, 24 Jan 2021 22:59:33 +0000 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l3oLy-00059s-MX for openwrt-devel@lists.openwrt.org; Sun, 24 Jan 2021 22:59:31 +0000 Received: by mail-ej1-x630.google.com with SMTP id gx5so15362656ejb.7 for ; Sun, 24 Jan 2021 14:59:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=m2klYqY35pOkBpVVO5hewhtoUmSHHtpVAQlOu5qgGy8=; b=Mm3Mxo/lMEIXxJ2wuhUlzl+9WqGWkztRPraoat105WvZrrjqUEJLKEurVyb7jcXhSL IP2SBa6NgwOFVCOsvYiKUYZT70Ur86iR5/xuYOCcRiF2ULUy7yD4TbdHY2UiW5mGkdiG PSI7u7Pxb1I5UhW7j9AjOEfJujyaRK3cWKGQ2eCw//C3UEOtOHrvOqLi1pN/13TqsFRy sMlI1VOk/9XDDyYUvSyFn2KmOwr7T6JzyUGDaAA57dHE+mx5likHtgOTZCf+rLG77hNg EvtiLJ/pNPOzYDSOiYMkyKiQ5zmXMStocgrFFaBAmhw1J8tRgISU5LjN7yLyHTK/Y4hI VUhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=m2klYqY35pOkBpVVO5hewhtoUmSHHtpVAQlOu5qgGy8=; b=laTpC52MeFmpKO7T+WX2148Cocm2m1Yp3Yl5UcVn5w6IbgNtvW1LDRZtt3+2ylEcdK qkA1rM02UdCLfBFl4pxH4upxqKmJTuRFufsqLY1iHNwhKBeAWYeYv+VzOJkrzECAKT2M HEkx2YnEmkX3xhMueKKacopeqz5BNFjpubal8E3inzK5mSMzhPaxh3os1G/z4lptj7lg xYdSvpk600Pn3LbuPvqJTWojqaIr44Zqzrpt7t9XuDZMltT8mWmv6Z4Z6COWb4mOzVkN u+sfUQukSJ7i1ur/XZJBFf8MKrfVixZF21F66qRkNxlosMbu58aNbWibkcet4ta5jkcc 4fTg== X-Gm-Message-State: AOAM533ZJMQWrzYSZ9cufL2giJ4XWdTLd+0n/DwYLwLKpWPl5pJHWDfv 0rKHy/wg6HKr7D3+diAlCM8+2zKt0EkDOw== X-Google-Smtp-Source: ABdhPJy323cktJSin5zv+mrvC05lC2/yqRakk4uRoetZDjEoATJt616Wwobip+V+2s67jan8Y3Ij5A== X-Received: by 2002:a17:906:1c17:: with SMTP id k23mr958208ejg.255.1611529166657; Sun, 24 Jan 2021 14:59:26 -0800 (PST) Received: from eichest-laptop.local (77-57-203-148.dclient.hispeed.ch. [77.57.203.148]) by smtp.gmail.com with ESMTPSA id z6sm7585210ejx.17.2021.01.24.14.59.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Jan 2021 14:59:26 -0800 (PST) From: eichest@gmail.com To: openwrt-devel@lists.openwrt.org Subject: [PATCH procd] hotplug.c: set nl_pid to zero Date: Sun, 24 Jan 2021 23:58:50 +0100 Message-Id: <20210124225849.659106-1-eichest@gmail.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210124_175930_843697_5F1333E1 X-CRM114-Status: GOOD ( 13.86 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:630 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [eichest[at]gmail.com] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Eichenberger , daniel@makrotopia.org Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Stefan Eichenberger With the current solution where nl_pid is set through getpid we run into problems when running procd in a different PID namespace (e.g. container). The PID number inside the active PID namespace will be set which doesn't match the global PID. Therefore, procd will never receive any netlink messages. By setting nl_pid to zero the kernel will assign the global PID automatically and fixes the issue. Signed-off-by: Stefan Eichenberger Acked-by: John Crispin --- plug/hotplug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plug/hotplug.c b/plug/hotplug.c index 9aeb1c1..beff38a 100644 --- a/plug/hotplug.c +++ b/plug/hotplug.c @@ -612,7 +612,7 @@ void hotplug(char *rules) rule_file = strdup(rules); nls.nl_family = AF_NETLINK; - nls.nl_pid = getpid(); + nls.nl_pid = 0; nls.nl_groups = -1; if ((hotplug_fd.fd = socket(PF_NETLINK, SOCK_DGRAM | SOCK_CLOEXEC, NETLINK_KOBJECT_UEVENT)) == -1) {