From patchwork Sun Jun 14 18:27:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1309034 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=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org 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 ozlabs.org (Postfix) with ESMTPS id 49lNHJ39mSz9sRK for ; Mon, 15 Jun 2020 04:27:40 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2E588388B030; Sun, 14 Jun 2020 18:27:36 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from hera.aquilenet.fr (hera.aquilenet.fr [IPv6:2a0c:e300::1]) by sourceware.org (Postfix) with ESMTPS id 6C129388B030 for ; Sun, 14 Jun 2020 18:27:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6C129388B030 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=samuel.thibault@ens-lyon.org Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 74815347A; Sun, 14 Jun 2020 20:27:32 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fbch7vEtliIR; Sun, 14 Jun 2020 20:27:31 +0200 (CEST) Received: from function (unknown [IPv6:2a01:cb19:956:1b00:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 992DC30D2; Sun, 14 Jun 2020 20:27:31 +0200 (CEST) Received: from samy by function with local (Exim 4.94) (envelope-from ) id 1jkXLu-00HSjL-E7; Sun, 14 Jun 2020 20:27:30 +0200 From: Samuel Thibault To: libc-alpha@sourceware.org Subject: [hurd,commited] hurd: Make send* cancellation points Date: Sun, 14 Jun 2020 20:27:29 +0200 Message-Id: <20200614182729.4161974-1-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: , Cc: commit-hurd@gnu.org Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" * sysdeps/mach/hurd/send.c (__send): Make the __socket_send call a cancellation point. * sysdeps/mach/hurd/sendto.c (__sendto): Likewise. * sysdeps/mach/hurd/sendmsg.c (__libc_sendmsg): Likewise. --- sysdeps/mach/hurd/send.c | 4 ++++ sysdeps/mach/hurd/sendmsg.c | 3 +++ sysdeps/mach/hurd/sendto.c | 3 +++ 3 files changed, 10 insertions(+) diff --git a/sysdeps/mach/hurd/send.c b/sysdeps/mach/hurd/send.c index af002765d2..78edbc2ff3 100644 --- a/sysdeps/mach/hurd/send.c +++ b/sysdeps/mach/hurd/send.c @@ -20,6 +20,7 @@ #include #include #include +#include /* Send N bytes of BUF to socket FD. Returns the number sent or -1. */ ssize_t @@ -27,11 +28,14 @@ __send (int fd, const void *buf, size_t n, int flags) { error_t err; size_t wrote; + int cancel_oldtype; + cancel_oldtype = LIBC_CANCEL_ASYNC(); err = HURD_DPORT_USE (fd, __socket_send (port, MACH_PORT_NULL, flags, buf, n, NULL, MACH_MSG_TYPE_COPY_SEND, 0, NULL, 0, &wrote)); + LIBC_CANCEL_RESET (cancel_oldtype); if (err == MIG_BAD_ID || err == EOPNOTSUPP) /* The file did not grok the socket protocol. */ diff --git a/sysdeps/mach/hurd/sendmsg.c b/sysdeps/mach/hurd/sendmsg.c index dfc5afd4c6..37ab7f3ce0 100644 --- a/sysdeps/mach/hurd/sendmsg.c +++ b/sysdeps/mach/hurd/sendmsg.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "hurd/hurdsocket.h" /* Send a message described MESSAGE on socket FD. @@ -184,6 +185,7 @@ __libc_sendmsg (int fd, const struct msghdr *message, int flags) if (! err) { /* Send the data. */ + int cancel_oldtype = LIBC_CANCEL_ASYNC(); err = __socket_send (port, aport, flags, data.ptr, len, ports, @@ -192,6 +194,7 @@ __libc_sendmsg (int fd, const struct msghdr *message, int flags) message->msg_control, message->msg_controllen, &amount); + LIBC_CANCEL_RESET (cancel_oldtype); __mach_port_deallocate (__mach_task_self (), aport); } diff --git a/sysdeps/mach/hurd/sendto.c b/sysdeps/mach/hurd/sendto.c index 2f26b36b9e..a5faf8ea2e 100644 --- a/sysdeps/mach/hurd/sendto.c +++ b/sysdeps/mach/hurd/sendto.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "hurd/hurdsocket.h" /* Send N bytes of BUF on socket FD to peer at address ADDR (which is @@ -82,11 +83,13 @@ __sendto (int fd, if (! err) { /* Send the data. */ + int cancel_oldtype = LIBC_CANCEL_ASYNC(); err = __socket_send (port, aport, flags, buf, n, NULL, MACH_MSG_TYPE_COPY_SEND, 0, NULL, 0, &wrote); + LIBC_CANCEL_RESET (cancel_oldtype); } err; }));