From patchwork Mon Apr 17 13:38:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Bugaev X-Patchwork-Id: 1769644 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=) Authentication-Results: legolas.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=XF/CaG6Z; dkim-atps=neutral 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 ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q0Sp82swCz1yZr for ; Mon, 17 Apr 2023 23:39:28 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 18CE2385841C for ; Mon, 17 Apr 2023 13:39:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 18CE2385841C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1681738766; bh=YUaESShH7fmAVvky45xc+/wx6FM9UK4KaYsqzQT9d24=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=XF/CaG6ZhYXJSoy6cF4xtcJaGSL+PGIfENvK4XnPRrdFG1GYpSE9jtbyXX/mmkNgy lHV8/8cT3o8dBMWs+2kUhSEjynl+KdkeiC8tWPclwzpRkIymE1+UsHYuNfVRofhOBa LQxSDbaC4ToRKNWv2211XM01tlWVKx9jw63x9NbA= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by sourceware.org (Postfix) with ESMTPS id DC6B33858C2F for ; Mon, 17 Apr 2023 13:39:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DC6B33858C2F Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-4eca0563b31so1394648e87.1 for ; Mon, 17 Apr 2023 06:39:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681738747; x=1684330747; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=YUaESShH7fmAVvky45xc+/wx6FM9UK4KaYsqzQT9d24=; b=Z/TeQToCQEkYnlE4WjXnj9pR30s5DPW2r9WDA7qmGNv83tXpm6VweZIsYYq8opP8/U YZYovXpExbwvxpy48uOjcKddye10Z7k2dpTnVhb/HUJM0FcdQPAFPazCebCU8JXCxAK5 rW2itBKmnO4OkhD9Zqcl/Awu93uTJBc4z+qyP8X6Osn5AEot9DtBpKH9f2LuNQANpmNq 7rSbPPlKT+XKB1jGor2APu6HmQx+HGWO1pc/nzZxiOx99adbzIJvy7e0iC95Qjb2BZCO GNumuNl4spAu4cbEwUBNSdNLOtqtKT23P1X3Dnat/WRBDybs1pAL+7VKHP0MLV+7jRgE i84g== X-Gm-Message-State: AAQBX9feSvUksrxMmeh7I/lEwRFisFa0oXMc0fC9TE5zY0ADC8kVOF20 vkFJDWpRJ5qFmNPQjjAHUJXciaP9C0I= X-Google-Smtp-Source: AKy350buHVhAE2D/5hv/xiii4rLXg+R0MLbbxEW3qH8fK+ibyR/+WOvfpw2xwiFO34FRCboYbC8zUQ== X-Received: by 2002:ac2:5e83:0:b0:4eb:2643:c6c6 with SMTP id b3-20020ac25e83000000b004eb2643c6c6mr1918507lfq.53.1681738747508; Mon, 17 Apr 2023 06:39:07 -0700 (PDT) Received: from surface-pro-6.. ([194.190.106.50]) by smtp.gmail.com with ESMTPSA id u27-20020ac24c3b000000b004db3e445f1fsm2067105lfq.97.2023.04.17.06.39.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 06:39:06 -0700 (PDT) To: libc-alpha@sourceware.org, bug-hurd@gnu.org Cc: Samuel Thibault , Emilio Pozuelo Monfort , Sergey Bugaev Subject: [PATCH 1/4] hurd: Don't pass fd flags in CMSG_DATA Date: Mon, 17 Apr 2023 16:38:59 +0300 Message-Id: <20230417133902.99040-1-bugaevc@gmail.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Sergey Bugaev via Libc-alpha From: Sergey Bugaev Reply-To: Sergey Bugaev Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" The only valid flag defined here is FD_CLOEXEC. It is of no concern to the receiving process whether or not the sender process wants to close its copy of sent file descriptor upon exec, and it should not influence whether or not the received file descriptor gets the FD_CLOEXEC flag set in the receiving process. The latter should in fact be dependent on the MSG_CMSG_CLOEXEC flag being passed to the recvmsg () call, which is going to be implemented in the following commit. Fixes 344e755248ce02c0f8d095d11cc49e340703d926 "hurd: Support sending file descriptors over Unix sockets" Signed-off-by: Sergey Bugaev --- sysdeps/mach/hurd/recvmsg.c | 3 +-- sysdeps/mach/hurd/sendmsg.c | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/sysdeps/mach/hurd/recvmsg.c b/sysdeps/mach/hurd/recvmsg.c index 39de86f6..5e8b18c6 100644 --- a/sysdeps/mach/hurd/recvmsg.c +++ b/sysdeps/mach/hurd/recvmsg.c @@ -189,7 +189,6 @@ __libc_recvmsg (int fd, struct msghdr *message, int flags) if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS) { /* SCM_RIGHTS support. */ - /* The fd's flags are passed in the control data. */ int *fds = (int *) CMSG_DATA (cmsg); nfds = (cmsg->cmsg_len - CMSG_ALIGN (sizeof (struct cmsghdr))) / sizeof (int); @@ -200,7 +199,7 @@ __libc_recvmsg (int fd, struct msghdr *message, int flags) if (err) goto cleanup; fds[j] = opened_fds[newfds] = _hurd_intern_fd (newports[newfds], - fds[j], 0); + 0, 0); if (fds[j] == -1) { err = errno; diff --git a/sysdeps/mach/hurd/sendmsg.c b/sysdeps/mach/hurd/sendmsg.c index 5871d1d8..77a720fb 100644 --- a/sysdeps/mach/hurd/sendmsg.c +++ b/sysdeps/mach/hurd/sendmsg.c @@ -138,8 +138,8 @@ __libc_sendmsg (int fd, const struct msghdr *message, int flags) 0, 0, 0, 0); if (! err) nports++; - /* We pass the flags in the control data. */ - fds[i] = descriptor->flags; + /* We just pass 0 in the control data. */ + fds[i] = 0; err; }));