From patchwork Sun Apr 30 00:27:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Flavio Cruz X-Patchwork-Id: 1775293 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=8.43.85.97; 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=ReelszoB; dkim-atps=neutral Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (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 4Q86d25zSrz23tv for ; Sun, 30 Apr 2023 10:28:06 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 19EE43858D28 for ; Sun, 30 Apr 2023 00:28:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 19EE43858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1682814481; bh=1BN6Xl79wiAMFpKfqOU9AKlScnJ5FJLFPuyX5Aawyk4=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=ReelszoBX80RJ3QNDHGs7/asDpWE/3p9QBS6gnN5fvfSfuKNY1CZEf68oMUtmwczd KYOgRkAGHLAstBZd+1KZLv99N1WC15UgKNo9j+vwemzyfrwEC2OGXs9b66Z609lOnN aI9LCyqwLwKaf6VuRNDoBDFkSiVCtV1FP2rjkwag= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-yb1-xb34.google.com (mail-yb1-xb34.google.com [IPv6:2607:f8b0:4864:20::b34]) by sourceware.org (Postfix) with ESMTPS id 269163858C50 for ; Sun, 30 Apr 2023 00:27:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 269163858C50 Received: by mail-yb1-xb34.google.com with SMTP id 3f1490d57ef6-b980e16b27bso940300276.2 for ; Sat, 29 Apr 2023 17:27:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682814459; x=1685406459; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=1BN6Xl79wiAMFpKfqOU9AKlScnJ5FJLFPuyX5Aawyk4=; b=DE6CunM2Vlwo4wDJunzUgNw1O2QBZ6oArU1Wl6q4fT4DTrZoCAGnzAkSd6kbM578EE wlnGlonoX8DPEEPvCB9PPHqwYACYCaNIE1ughg1U47V+pnUpCKc7c05gZNbw00909muR Qu4E0inh8RBnFOgtdX8i8LVLlAEE48epyajn8cy0uvoIPQDxdx2X3dF0fknWSpOnEuG8 cl/GdpQLFKyYvFoJx5XZhislgS/d2NEflEHXsVxi8vlxsAXDOSU9KT22vM/0tDBczsR6 0mGIAI59NaTnUgiYkwv0SpR5yqwWXe574NFELMR/8kF/GUXctFmSPS+DjzrxT2JYTfLj G3jQ== X-Gm-Message-State: AC+VfDzYYoalomGwyVnHUgyO0LBAEVqnR+msFeJQxzDrsGtFYmzVfEpL chhifYHxsg5NcouXQ7U3Os5nVdeCFQ== X-Google-Smtp-Source: ACHHUZ7pG7q/TXKaAbdir+GHlBeiRuYTcwxJUSpzX1x4cVV99FVWNscRf4Dh+NOmhIwyFTMXLP/+sg== X-Received: by 2002:a25:4f03:0:b0:b9d:c27c:3441 with SMTP id d3-20020a254f03000000b00b9dc27c3441mr1426612ybb.21.1682814459159; Sat, 29 Apr 2023 17:27:39 -0700 (PDT) Received: from jupiter.tail36e24.ts.net (dynamic-acs-24-154-253-225.zoominternet.net. [24.154.253.225]) by smtp.gmail.com with ESMTPSA id u185-20020a8184c2000000b0054640a352f2sm6334948ywf.20.2023.04.29.17.27.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Apr 2023 17:27:38 -0700 (PDT) Date: Sat, 29 Apr 2023 20:27:36 -0400 To: libc-alpha@sourceware.org Cc: bugaevc@gmail.com, samuel.thibault@gnu.org, bug-hurd@gnu.org Subject: [PATCH] Define mig_strlen and __mig_strlen to support dynamically sized strings in hurd RPCs Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, URIBL_BLACK 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: Flavio Cruz via Libc-alpha From: Flavio Cruz Reply-To: Flavio Cruz Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" We make lib{mach,hurd}user.so call __mig_strlen which can be relocated before libc.so is relocated, similar to what is done with __mig_memcpy. --- mach/Makefile | 2 +- mach/Versions | 4 ++++ mach/mach/mig_support.h | 2 ++ mach/mig_strlen.c | 27 +++++++++++++++++++++++++++ sysdeps/mach/hurd/i386/libc.abilist | 1 + 5 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 mach/mig_strlen.c diff --git a/mach/Makefile b/mach/Makefile index 39358fdb83..a5d1252f95 100644 --- a/mach/Makefile +++ b/mach/Makefile @@ -25,7 +25,7 @@ headers = mach_init.h mach.h mach_error.h mach-shortcuts.h mach/mach_traps.h \ lock = spin-solid spin-lock mutex-init mutex-solid lock-headers = lock-intern.h spin-lock.h routines = $(mach-syscalls) $(mach-shortcuts) \ - mach_init mig_strncpy mig_memcpy msg \ + mach_init mig_strncpy mig_strlen mig_memcpy msg \ mig-alloc mig-dealloc mig-reply \ msg-destroy msgserver \ mach_error errstring error_compat errsystems \ diff --git a/mach/Versions b/mach/Versions index b525cfdcf9..2dff5c477e 100644 --- a/mach/Versions +++ b/mach/Versions @@ -61,6 +61,9 @@ libc { GLIBC_2.32 { mach_print; } + GLIBC_2.38 { + mig_strlen; + } HURD_CTHREADS_0.3 { __mutex_init; __mutex_lock; __mutex_lock_solid; __mutex_trylock; @@ -71,5 +74,6 @@ libc { GLIBC_PRIVATE { # functions used by RPC stubs __mig_memcpy; + __mig_strlen; } } diff --git a/mach/mach/mig_support.h b/mach/mach/mig_support.h index 78d4c4f0e3..3108e0af56 100644 --- a/mach/mach/mig_support.h +++ b/mach/mach/mig_support.h @@ -53,6 +53,8 @@ extern void mig_reply_setup (const mach_msg_header_t *__request, /* Idiocy support function. */ extern vm_size_t mig_strncpy (char *__dst, const char *__src, vm_size_t __len); extern vm_size_t __mig_strncpy (char *__dst, const char *__src, vm_size_t); +extern vm_size_t mig_strlen (const char *__src); +extern vm_size_t __mig_strlen (const char *__src); extern void *__mig_memcpy (void *__dst, const void *__src, vm_size_t __len); diff --git a/mach/mig_strlen.c b/mach/mig_strlen.c new file mode 100644 index 0000000000..65e39b9bdf --- /dev/null +++ b/mach/mig_strlen.c @@ -0,0 +1,27 @@ +/* strlen stub for mig stubs in libmachuser and libhurduser. + Copyright (C) 2023 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include + +vm_size_t +__mig_strlen (const char *src) +{ + return strlen (src); +} +weak_alias (__mig_strlen, mig_strlen) diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist index 6925222ff3..ac7d06e385 100644 --- a/sysdeps/mach/hurd/i386/libc.abilist +++ b/sysdeps/mach/hurd/i386/libc.abilist @@ -2326,6 +2326,7 @@ GLIBC_2.38 __isoc23_wcstoull F GLIBC_2.38 __isoc23_wcstoull_l F GLIBC_2.38 __isoc23_wcstoumax F GLIBC_2.38 __isoc23_wscanf F +GLIBC_2.38 mig_strlen F GLIBC_2.4 __confstr_chk F GLIBC_2.4 __fgets_chk F GLIBC_2.4 __fgets_unlocked_chk F