From patchwork Wed Apr 5 11:20:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 1765367 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=Z4CT0Oj3; 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 4Ps2J91xGhz1yYn for ; Wed, 5 Apr 2023 21:21:13 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D7411385700D for ; Wed, 5 Apr 2023 11:21:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D7411385700D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1680693670; bh=mR1zZQ1q1Q12iGQ52aPa18B6CcXb7dB4xD80WLUN+dM=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=Z4CT0Oj3/B5Z0wjAp4tQL2xtjmC5Vy4yBznrYd6QcGEql+OwZJsEwI+TS6AbIV403 rcSToeyqug2QCq4f2mPHb/0eMjGik+XmUP1oqoxbsNMq5omwCgNJKxfhvAOfGQYiCP Oi+h/VEr3CqmG15kaxmlxE3UW1DcimqbGj3QqQVI= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 178323858D20 for ; Wed, 5 Apr 2023 11:20:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 178323858D20 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-610-0UqJxnZYMnCU40Ui2dye7A-1; Wed, 05 Apr 2023 07:20:52 -0400 X-MC-Unique: 0UqJxnZYMnCU40Ui2dye7A-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0F458885622; Wed, 5 Apr 2023 11:20:52 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.210]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 48F3518EC7; Wed, 5 Apr 2023 11:20:51 +0000 (UTC) To: libc-alpha@sourceware.org Cc: Paul Eggert Subject: [PATCH 0/2] strlcpy/strlcat/wcslcpy/wcscat implementation X-From-Line: 6c94849aad1952b50504894b35fa462d445c3a4f Mon Sep 17 00:00:00 2001 Message-Id: Date: Wed, 05 Apr 2023 13:20:49 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP 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: Florian Weimer via Libc-alpha From: Florian Weimer Reply-To: Florian Weimer Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" These two patches add support for four functions planned for addition to POSIX, plus their fortified variants. They are available with _DEFAULT_SOURCE because the BSDs expose them by default, oto. Tested on i686-linux-gnu and x86_64-linux-gnu. Built with build-many-glibcs.py (on all ABIs, but not all targets because disk space is no longer sufficient on the lab machines I have access to). Paul, the Austin Groups issue you raised has been closed. Do you keep your sustained objection to adding these functions to glibc? Thanks, Florian Florian Weimer (2): Implement strlcpy and strlcat [BZ #178] Add the wcslcpy, wcslcat functions NEWS | 6 ++ debug/Makefile | 3 +- debug/Versions | 6 ++ debug/strlcat_chk.c | 32 +++++++ debug/strlcpy_chk.c | 32 +++++++ debug/tst-fortify.c | 48 ++++++++++ debug/wcslcat_chk.c | 31 +++++++ debug/wcslcpy_chk.c | 31 +++++++ include/string.h | 4 + include/wchar.h | 5 + manual/string.texi | 74 +++++++++++++++ string/Makefile | 4 + string/Versions | 4 + string/bits/string_fortified.h | 36 +++++++ string/string.h | 13 +++ string/strlcat.c | 61 ++++++++++++ string/strlcpy.c | 48 ++++++++++ string/tst-strlcat.c | 84 +++++++++++++++++ string/tst-strlcpy.c | 68 ++++++++++++++ sysdeps/mach/hurd/i386/libc.abilist | 8 ++ sysdeps/unix/sysv/linux/aarch64/libc.abilist | 8 ++ sysdeps/unix/sysv/linux/alpha/libc.abilist | 8 ++ sysdeps/unix/sysv/linux/arc/libc.abilist | 8 ++ sysdeps/unix/sysv/linux/arm/be/libc.abilist | 8 ++ sysdeps/unix/sysv/linux/arm/le/libc.abilist | 8 ++ sysdeps/unix/sysv/linux/csky/libc.abilist | 8 ++ sysdeps/unix/sysv/linux/hppa/libc.abilist | 8 ++ sysdeps/unix/sysv/linux/i386/libc.abilist | 8 ++ sysdeps/unix/sysv/linux/ia64/libc.abilist | 8 ++ .../sysv/linux/loongarch/lp64/libc.abilist | 8 ++ .../sysv/linux/m68k/coldfire/libc.abilist | 8 ++ .../unix/sysv/linux/m68k/m680x0/libc.abilist | 8 ++ .../sysv/linux/microblaze/be/libc.abilist | 8 ++ .../sysv/linux/microblaze/le/libc.abilist | 8 ++ .../sysv/linux/mips/mips32/fpu/libc.abilist | 8 ++ .../sysv/linux/mips/mips32/nofpu/libc.abilist | 8 ++ .../sysv/linux/mips/mips64/n32/libc.abilist | 8 ++ .../sysv/linux/mips/mips64/n64/libc.abilist | 8 ++ sysdeps/unix/sysv/linux/nios2/libc.abilist | 8 ++ sysdeps/unix/sysv/linux/or1k/libc.abilist | 8 ++ .../linux/powerpc/powerpc32/fpu/libc.abilist | 8 ++ .../powerpc/powerpc32/nofpu/libc.abilist | 8 ++ .../linux/powerpc/powerpc64/be/libc.abilist | 8 ++ .../linux/powerpc/powerpc64/le/libc.abilist | 8 ++ .../unix/sysv/linux/riscv/rv32/libc.abilist | 8 ++ .../unix/sysv/linux/riscv/rv64/libc.abilist | 8 ++ .../unix/sysv/linux/s390/s390-32/libc.abilist | 8 ++ .../unix/sysv/linux/s390/s390-64/libc.abilist | 8 ++ sysdeps/unix/sysv/linux/sh/be/libc.abilist | 8 ++ sysdeps/unix/sysv/linux/sh/le/libc.abilist | 8 ++ .../sysv/linux/sparc/sparc32/libc.abilist | 8 ++ .../sysv/linux/sparc/sparc64/libc.abilist | 8 ++ .../unix/sysv/linux/x86_64/64/libc.abilist | 8 ++ .../unix/sysv/linux/x86_64/x32/libc.abilist | 8 ++ wcsmbs/Makefile | 8 +- wcsmbs/Versions | 2 + wcsmbs/bits/wchar2.h | 37 ++++++++ wcsmbs/tst-wcslcat.c | 93 +++++++++++++++++++ wcsmbs/tst-wcslcpy.c | 78 ++++++++++++++++ wcsmbs/wchar.h | 13 +++ wcsmbs/wcslcat.c | 60 ++++++++++++ wcsmbs/wcslcpy.c | 46 +++++++++ 62 files changed, 1204 insertions(+), 3 deletions(-) create mode 100644 debug/strlcat_chk.c create mode 100644 debug/strlcpy_chk.c create mode 100644 debug/wcslcat_chk.c create mode 100644 debug/wcslcpy_chk.c create mode 100644 string/strlcat.c create mode 100644 string/strlcpy.c create mode 100644 string/tst-strlcat.c create mode 100644 string/tst-strlcpy.c create mode 100644 wcsmbs/tst-wcslcat.c create mode 100644 wcsmbs/tst-wcslcpy.c create mode 100644 wcsmbs/wcslcat.c create mode 100644 wcsmbs/wcslcpy.c base-commit: 16439f419b270184ec501c531bf20d83b6745fb0