From patchwork Thu Dec 14 06:02:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Flavio Cruz X-Patchwork-Id: 82359 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 119ED3858293 for ; Sun, 17 Dec 2023 22:53:38 +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 869493858CD1 for ; Sun, 17 Dec 2023 22:53:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 869493858CD1 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=aquilenet.fr ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 869493858CD1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a0c:e300::1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702853603; cv=none; b=sVvrvkWYYWdSkSWs9rYH9UWhOK1W12oH7OZMteLp0LZsj/fA9gtlvGgbBcZXQWwbHnmZmO7lYl9zgEmHr4WoCmk81Zp13EMC4L6nEagpBQOKpL/3gnLcrM9j2RGEuwXzISVsiQgExOE05ZtnYSVs7E2kWgkTaQ1UBVjz3ntJNO8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702853603; c=relaxed/simple; bh=ciMzV27ndDyNBXHIEeW+gFh13tUiJ5O2a5dMbAuab8o=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=QmcHSC8MagzsT5N4vhOFTuIZWNTREuZKnM2y7oKM6FcoNF1tPH59VZcBX5WgjuWzf23ZmhQhPw1Jw76dd4CPkQ4NDRlz014IxkNp+odx95G5D0OXDPWf1ZfnRNDHjDe5XcBKwP+EdqheWDYy79ErxdcvIL/J7+4FV4YlF1mTXRw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id C4F63309 for ; Sun, 17 Dec 2023 23:53:20 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at hera.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 q3PdfPcACabF for ; Sun, 17 Dec 2023 23:53:15 +0100 (CET) Received: from begin (unknown [IPv6:2a01:cb19:cca:f000:de41:a9ff:fe47:ec49]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 72767101 for ; Sun, 17 Dec 2023 23:53:15 +0100 (CET) Received: from samy by begin with local (Exim 4.97) (envelope-from ) id 1rF00Y-000000051DJ-2lg1 for libc-alpha@sourceware.org; Sun, 17 Dec 2023 23:53:14 +0100 Resent-From: Samuel Thibault Resent-Date: Sun, 17 Dec 2023 23:53:14 +0100 Resent-Message-ID: <20231217225314.s7jx5khuoiyli6pe@begin> Resent-To: libc-alpha@sourceware.org X-Spam-Language: Received: from imap.u-bordeaux.fr [147.210.215.107] by begin.youpi.perso.aquilenet.fr with IMAP (fetchmail-6.4.37) for (single-drop); Thu, 14 Dec 2023 07:05:07 +0100 (CET) Received: from v-zimboxp12.srv.u-bordeaux.fr (LHLO v-zimboxp12.srv.u-bordeaux.fr) (147.210.219.112) by v-zimboxp12.srv.u-bordeaux.fr with LMTP; Thu, 14 Dec 2023 07:03:29 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by v-zimboxp12.srv.u-bordeaux.fr (Postfix) with ESMTP id 5620EC4426 for ; Thu, 14 Dec 2023 07:03:29 +0100 (CET) Authentication-Results: v-zimboxp12.srv.u-bordeaux.fr (amavis); dkim=pass (2048-bit key) header.d=gmail.com Received: from v-zimboxp12.srv.u-bordeaux.fr ([127.0.0.1]) by localhost (v-zimboxp12.srv.u-bordeaux.fr [127.0.0.1]) (amavis, port 10024) with ESMTP id 2nal_1BVJwA3 for ; Thu, 14 Dec 2023 07:03:28 +0100 (CET) Received: from mta-in02.u-bordeaux.fr (mta-in02.u-bordeaux.fr [147.210.215.18]) by v-zimboxp12.srv.u-bordeaux.fr (Postfix) with ESMTPS id E2110C4423 for ; Thu, 14 Dec 2023 07:03:28 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mta-in02.u-bordeaux.fr (Postfix) with ESMTP id D430CFADA1 for ; Thu, 14 Dec 2023 07:03:28 +0100 (CET) Received: from mta-in02.u-bordeaux.fr ([127.0.0.1]) by localhost (mta-in02.u-bordeaux.fr [127.0.0.1]) (amavisd-new, port 10024) with LMTP id zOVn1Gp4I0cE for ; Thu, 14 Dec 2023 07:03:28 +0100 (CET) Received: from sonata.ens-lyon.org (domu-toccata.ens-lyon.fr [140.77.166.138]) by mta-in02.u-bordeaux.fr (Postfix) with ESMTPS id 832DBFADA0 for ; Thu, 14 Dec 2023 07:03:28 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id A6C9820156 for ; Thu, 14 Dec 2023 07:03:27 +0100 (CET) Received: from sonata.ens-lyon.org ([127.0.0.1]) by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bXwMHXsR2VOP for ; Thu, 14 Dec 2023 07:03:27 +0100 (CET) X-policyd-weight: using cached result; rate:hard: -7 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sonata.ens-lyon.org (Postfix) with ESMTPS id 8BE7F2013C for ; Thu, 14 Dec 2023 07:03:27 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rDeoA-0005CH-ND; Thu, 14 Dec 2023 01:02:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rDeo9-0005Bn-6B for bug-hurd@gnu.org; Thu, 14 Dec 2023 01:02:53 -0500 Received: from mail-qv1-xf30.google.com ([2607:f8b0:4864:20::f30]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rDeo7-0008IG-Lo for bug-hurd@gnu.org; Thu, 14 Dec 2023 01:02:52 -0500 Received: by mail-qv1-xf30.google.com with SMTP id 6a1803df08f44-67ef4c73e02so9896536d6.2 for ; Wed, 13 Dec 2023 22:02:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702533770; x=1703138570; darn=gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5V7XmCUaveC8WjLGiHyD2TQbwesCHjlHx648GMqcXYs=; b=W2fD7PTetezwvQqWaCMOzBTkg02mVc0TgRY5bPClT1wcglelS85OKSWp0dVVL5sW3u GdyvvgeG+C2/aCWs/5Us63I02nGwpvrR3Bu4XF8wuV/mV+V5yDA56ScwwhqU5p1TGJ/I Y7H9MtIw+iwd36/tJ9HL3zwmv4m4blMxZ645/CSf1Bfpqj0yByyLhRCJBmj7OW1nthDi HdCzopLflaQog/8nz69TVAFYLiUgkXe6KV5YA6i+cbEKyXGbIHHee/U+T4E2w5IFtNnj 9OewdYL23bJ6E5vEZfVZ/aOo4+dypvbZsyHckznsTiy2VJBt6oJcl0u+8s/E7jZrPk6i hdFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702533770; x=1703138570; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5V7XmCUaveC8WjLGiHyD2TQbwesCHjlHx648GMqcXYs=; b=U7FpbniESex0s6G1BkjvvAAO8uTdXTW9IY+xxSAFraZYtX98NEeIdwk8rmqS3jJqaa WEWzNOOMVgp+IdQWwzEE3CdkVEi5n69RML4Y3tG3chKcYr8wFwFPZeCaxWXc17PnTcQ2 XxmwS39LNuJlI8elF9ryzRlOs374HrQOXZM/GDlhVTqs8phuLjmogFbVL2Luo9d6vYnz 8LqGJm24u2lJNxivHqv2I9JbpGHZyCsV0FbkPoEs33fiOnGHkTOsT/vsvHjJP3yn2Znd cJAFHaiwsj/t6ckUfztMdPhmjohhcCqYlaAtbvVJAaDW5IUnCNytO76n7s/Do+AcrNBi XM9A== X-Gm-Message-State: AOJu0YyqhrHNHnlTfu4la2CQrB+6Gi+J1AoJ4BVX68CYLR9c6YSZ3QLN 1BBxOgEIB5b/C4JSaDkKm/srYC9EwQ== X-Google-Smtp-Source: AGHT+IEbCJYkGWy+rcpG+6V6aHpph50GttI/1475nUJ5hh2DCW7JT9R6yT7hhKVtp5otJs3uXZUKgw== X-Received: by 2002:ad4:4b30:0:b0:67e:ee16:2ef0 with SMTP id s16-20020ad44b30000000b0067eee162ef0mr2933526qvw.91.1702533770237; Wed, 13 Dec 2023 22:02:50 -0800 (PST) Received: from jupiter.tail36e24.ts.net ([24.154.253.225]) by smtp.gmail.com with ESMTPSA id z7-20020a0ce607000000b0067ac431a369sm1777216qvm.17.2023.12.13.22.02.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 22:02:49 -0800 (PST) From: Flavio Cruz To: bug-hurd@gnu.org Cc: Flavio Cruz Subject: [PATCH glibc] Update code to handle the new ABI for sending inlined port rights. Date: Thu, 14 Dec 2023 01:02:28 -0500 Message-Id: <20231214060231.3652786-2-flaviocruz@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231214060231.3652786-1-flaviocruz@gmail.com> References: <20231214060231.3652786-1-flaviocruz@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::f30; envelope-from=flaviocruz@gmail.com; helo=mail-qv1-xf30.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: bug-hurd@gnu.org X-Mailman-Version: 2.1.29 Precedence: list Sender: bug-hurd-bounces+samuel.thibault=ens-lyon.org@gnu.org X-Spamd-Result: default: False [-2.71 / 15.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_MISSING_CHARSET(0.50)[]; MAILLIST(-0.20)[mailman]; R_SPF_ALLOW(-0.20)[+a:sonata.ens-lyon.org]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20230601]; MIME_GOOD(-0.10)[text/plain]; HAS_LIST_UNSUB(-0.01)[]; FROM_NEQ_ENVFROM(0.00)[flaviocruz@gmail.com,SRS0=3mCF=HZ=gnu.org=bug-hurd-bounces@bounce.ens-lyon.org]; FROM_HAS_DN(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; NEURAL_HAM(-0.00)[-0.819]; FREEMAIL_CC(0.00)[gmail.com]; ARC_NA(0.00)[]; TAGGED_FROM(0.00)[samuel.thibault=ens-lyon.org]; RCVD_COUNT_SEVEN(0.00)[8]; DKIM_TRACE(0.00)[gmail.com:+]; FREEMAIL_FROM(0.00)[gmail.com]; TO_DN_SOME(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; RCPT_COUNT_TWO(0.00)[2]; MIME_TRACE(0.00)[0:+]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; ASN(0.00)[asn:1945, ipnet:140.77.0.0/16, country:EU]; RCVD_TLS_LAST(0.00)[]; FORGED_SENDER_MAILLIST(0.00)[] X-Rspamd-Queue-Id: 832DBFADA0 X-Rspamd-Server: mta-in02 X-Rspamd-Action: no action X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, JMQ_SPF_NEUTRAL, MAILING_LIST_MULTI, SPF_HELO_PASS, 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 List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org For i686, this change is no op but for x86_64 it forces all inlined port rights to be 8 bytes long. --- hurd/intr-msg.c | 26 ++++++++++++++++++++++++-- mach/msg-destroy.c | 12 +++++++++--- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/hurd/intr-msg.c b/hurd/intr-msg.c index 24184f827f..9912f4f1f3 100644 --- a/hurd/intr-msg.c +++ b/hurd/intr-msg.c @@ -199,6 +199,28 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg, __vm_deallocate (__mach_task_self (), (vm_address_t) data, length); } + inline void clean_inlined_ports (mach_port_name_inlined_t *ports) + { + mach_msg_type_number_t i; + switch (name) + { + case MACH_MSG_TYPE_MOVE_SEND: + for (i = 0; i < number; i++) + __mach_port_deallocate (__mach_task_self (), ports[i].name); + if (ty->msgtl_header.msgt_longform) + ty->msgtl_name = MACH_MSG_TYPE_COPY_SEND; + else + ty->msgtl_header.msgt_name = MACH_MSG_TYPE_COPY_SEND; + break; + case MACH_MSG_TYPE_COPY_SEND: + case MACH_MSG_TYPE_MOVE_RECEIVE: + break; + default: + if (MACH_MSG_TYPE_PORT_ANY (name)) + assert (! "unexpected port type in interruptible RPC"); + } + } + char *data; if (ty->msgtl_header.msgt_longform) { @@ -215,11 +237,11 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg, data = (char *) ty + sizeof (mach_msg_type_t); } + /* Calculate length of data in bytes. */ const vm_size_t length = ((number * size) + 7) >> 3; if (ty->msgtl_header.msgt_inline) { - /* Calculate length of data in bytes. */ - clean_ports_and_memory (data, length, 0); + clean_inlined_ports ((mach_port_name_inlined_t *) data); /* Move to the next argument. */ ty = (void *) PTR_ALIGN_UP (data + length, __alignof__ (uintptr_t)); } diff --git a/mach/msg-destroy.c b/mach/msg-destroy.c index 19137baa62..8640c965bd 100644 --- a/mach/msg-destroy.c +++ b/mach/msg-destroy.c @@ -108,11 +108,17 @@ __mach_msg_destroy (mach_msg_header_t *msg) addr = is_inline ? saddr : * (vm_offset_t *) saddr; if (MACH_MSG_TYPE_PORT_ANY(name)) { - mach_port_t *ports = (mach_port_t *) addr; mach_msg_type_number_t i; - for (i = 0; i < number; i++) - mach_msg_destroy_port(*ports++, name); + if (is_inline) { + mach_port_name_inlined_t *inlined_ports = (mach_port_name_inlined_t *)addr; + for (i = 0; i < number; i++) + mach_msg_destroy_port(inlined_ports[i].name, name); + } else { + mach_port_t *ports = (mach_port_t *) addr; + for (i = 0; i < number; i++) + mach_msg_destroy_port(ports[i], name); + } } if (is_inline) {