Message ID | cover.1681993374.git.fweimer@redhat.com |
---|---|
Headers |
Return-Path: <libc-alpha-bounces+patchwork=sourceware.org@sourceware.org> 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 A1AEE3858401 for <patchwork@sourceware.org>; Thu, 20 Apr 2023 12:28:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A1AEE3858401 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1681993719; bh=zN8/X4GZo+s/iTZLxMpmVPa0ZCUYDwS2WLfesUlVKqo=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=mt0513c8MoXKq6yaaK75/Rx1ii7o5YOd0jl1QBym7gEgdO5Pg+MqnMgr/15m96hwA 694w3zsYZfGsWPAAMbUg3p5DdIGzFtgxE3ly81QuBAxcakQhkeE+QRhMYP/Xud0VWR 5RJmSyNn1rJXqJnsq4U2WPCvusG0b1BmpfDSMAfg= 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 5C7363858D37 for <libc-alpha@sourceware.org>; Thu, 20 Apr 2023 12:28:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5C7363858D37 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-8-f7FryJD4MgGsw6mshNLJ4w-1; Thu, 20 Apr 2023 08:28:14 -0400 X-MC-Unique: f7FryJD4MgGsw6mshNLJ4w-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 62E09185A790 for <libc-alpha@sourceware.org>; Thu, 20 Apr 2023 12:28:14 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.2.16.5]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BC0654020BEE for <libc-alpha@sourceware.org>; Thu, 20 Apr 2023 12:28:13 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH v2 0/3] strlcpy and related functions X-From-Line: f39fcf3e4b98dd53f27a2d196038c73e91148cd4 Mon Sep 17 00:00:00 2001 Message-Id: <cover.1681993374.git.fweimer@redhat.com> Date: Thu, 20 Apr 2023 14:28:11 +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.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain 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, 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 <libc-alpha.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=subscribe> From: Florian Weimer via Libc-alpha <libc-alpha@sourceware.org> Reply-To: Florian Weimer <fweimer@redhat.com> Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" <libc-alpha-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
strlcpy and related functions
|
|
Message
Florian Weimer
April 20, 2023, 12:28 p.m. UTC
I split this repost somewhat differently, with the manual updates in a separate commit, so that I can give proper attribution to Paul's work. I went through the discussion again and wasn't sure if there was anything regarding the actual implementation, beyond the fortify macro usage (discussed with Siddhesh) and Paul's suggestion to open-code the copying and counting (which I declined). Thanks, Florian Florian Weimer (2): Implement strlcpy and strlcat [BZ #178] Add the wcslcpy, wcslcat functions Paul Eggert (1): manual: Manual update for strlcat, strlcpy, wcslcat, wclscpy NEWS | 3 + debug/Makefile | 4 + debug/Versions | 6 ++ debug/strlcat_chk.c | 31 ++++++ debug/strlcpy_chk.c | 31 ++++++ debug/tst-fortify.c | 48 ++++++++++ debug/wcslcat_chk.c | 31 ++++++ debug/wcslcpy_chk.c | 31 ++++++ include/string.h | 4 + include/wchar.h | 5 + manual/maint.texi | 8 ++ manual/string.texi | 96 ++++++++++++++++++- string/Makefile | 4 + string/Versions | 4 + string/bits/string_fortified.h | 36 +++++++ string/string.h | 13 +++ string/strlcat.c | 59 ++++++++++++ string/strlcpy.c | 46 +++++++++ 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 | 4 + 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 +++++++++ 63 files changed, 1222 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: 65cbd52174f5bc211dd655727c2239e25e55bfce
Comments
On Thu, Apr 20, 2023 at 5:28 AM Florian Weimer via Libc-alpha <libc-alpha@sourceware.org> wrote: > > I split this repost somewhat differently, with the manual updates in a > separate commit, so that I can give proper attribution to Paul's work. > > I went through the discussion again and wasn't sure if there was > anything regarding the actual implementation, beyond the fortify macro > usage (discussed with Siddhesh) and Paul's suggestion to open-code the > copying and counting (which I declined). > > Thanks, > Florian > > Florian Weimer (2): > Implement strlcpy and strlcat [BZ #178] > Add the wcslcpy, wcslcat functions > > Paul Eggert (1): > manual: Manual update for strlcat, strlcpy, wcslcat, wclscpy > > NEWS | 3 + > debug/Makefile | 4 + > debug/Versions | 6 ++ > debug/strlcat_chk.c | 31 ++++++ > debug/strlcpy_chk.c | 31 ++++++ > debug/tst-fortify.c | 48 ++++++++++ > debug/wcslcat_chk.c | 31 ++++++ > debug/wcslcpy_chk.c | 31 ++++++ > include/string.h | 4 + > include/wchar.h | 5 + > manual/maint.texi | 8 ++ > manual/string.texi | 96 ++++++++++++++++++- > string/Makefile | 4 + > string/Versions | 4 + > string/bits/string_fortified.h | 36 +++++++ > string/string.h | 13 +++ > string/strlcat.c | 59 ++++++++++++ > string/strlcpy.c | 46 +++++++++ > 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 | 4 + > 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 +++++++++ > 63 files changed, 1222 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: 65cbd52174f5bc211dd655727c2239e25e55bfce > -- > 2.40.0 > Should we add benchtests for them?
* H. J. Lu:
> Should we add benchtests for them?
Sure, but that's really not my area of expertise.
We could start with the strcpy tests if they exist, and pass down the
buffer sizes. It would allow us to compare strcpy vs strlcpy, which
might be interesting in its own right.
I don't think it's necessary to benchmark the truncation case.
Thanks,
Florian
On Fri, Apr 21, 2023 at 12:46 PM Florian Weimer via Libc-alpha <libc-alpha@sourceware.org> wrote: > > * H. J. Lu: > > > Should we add benchtests for them? > > Sure, but that's really not my area of expertise. > > We could start with the strcpy tests if they exist, and pass down the > buffer sizes. It would allow us to compare strcpy vs strlcpy, which > might be interesting in its own right. > > I don't think it's necessary to benchmark the truncation case. > I posted a patch with benchmarks. Just reuses what we have for strncpy/strncat. We can use that if you'd like. > Thanks, > Florian >
* Florian Weimer via Libc-alpha: > I split this repost somewhat differently, with the manual updates in a > separate commit, so that I can give proper attribution to Paul's work. > > I went through the discussion again and wasn't sure if there was > anything regarding the actual implementation, beyond the fortify macro > usage (discussed with Siddhesh) and Paul's suggestion to open-code the > copying and counting (which I declined). > > Thanks, > Florian > > Florian Weimer (2): > Implement strlcpy and strlcat [BZ #178] > Add the wcslcpy, wcslcat functions > > Paul Eggert (1): > manual: Manual update for strlcat, strlcpy, wcslcat, wclscpy Any further comments on this version? Thanks, Florian