Message ID | cover.1707491940.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 90E0A385828F for <patchwork@sourceware.org>; Fri, 9 Feb 2024 15:25:04 +0000 (GMT) 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 3066A3858C35 for <libc-alpha@sourceware.org>; Fri, 9 Feb 2024 15:24:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3066A3858C35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3066A3858C35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707492282; cv=none; b=d3Qb1yEYtQhDTIWtNN4f5g+zEwD01xXGDcNi/3ippqcYrSjXr05vw3zpbpavWN+ZKd/5T0DQyOslqwmn5ha/LLAE5yIrlqYrm5APperoUDMfZfg+U1ZBBY2pzBUrjf7l+BbD+0CjK8l/4wQuhCApvJcxUboV1zZhtfiM+35t5XQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707492282; c=relaxed/simple; bh=wBeXBdvo/1RWrwcPEtRj3R5n5r/VKWvsXmqd1RIO6js=; h=DKIM-Signature:From:To:Subject:Message-ID:Date:MIME-Version; b=N414r7bw7gc0+m+c0qmyZZJUKoy3JZT+V5i1yIe2/vWXzukMAGknrhoKKGzqaLsjFr+X9/YNOvjYFJ7ahXz/nikGfE8p9JKmd9biRKEZ15Z+vRlSFmMniHUgC3Ihc670HNJbE7FFNnc3EXJeEdMJhRm5xC3fHCWMj+TL/p88W1s= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707492279; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=odktB7dYH/HJ/3/jSqTBqx/eY2pcb5KpjafpkyUMydE=; b=GyTHGHL+5javXp7UypaZCPeYQW/bWNPxhR2UukJXWu+hgTrmRNYg6/7UArCjgkgM+QO+B3 ZBB3kY1pPiFl3bTha1o07tJGU/NN0DzZRigMtuoK3O/zX29OPZQEkDVF+iagH432OIvgL+ spgSz9vF93j66H4n3suo6Hz5WvV5ahE= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-332-ng_XpMnNOceas3IM0k6qog-1; Fri, 09 Feb 2024 10:24:38 -0500 X-MC-Unique: ng_XpMnNOceas3IM0k6qog-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 34CD73C1E9D0 for <libc-alpha@sourceware.org>; Fri, 9 Feb 2024 15:24:38 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.58]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B817F11215 for <libc-alpha@sourceware.org>; Fri, 9 Feb 2024 15:24:37 +0000 (UTC) From: Florian Weimer <fweimer@redhat.com> To: libc-alpha@sourceware.org Subject: [PATCH 00/11] Build getdomainname, gethostname, syslog with fortification Message-ID: <cover.1707491940.git.fweimer@redhat.com> X-From-Line: a709cb1c36c0e92954ebb036adabc350428ee7d5 Mon Sep 17 00:00:00 2001 Date: Fri, 09 Feb 2024 16:24:35 +0100 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.3 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-5.0 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_H5, RCVD_IN_MSPIKE_WL, 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.30 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> Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org |
Series |
Build getdomainname, gethostname, syslog with fortification
|
|
Message
Florian Weimer
Feb. 9, 2024, 3:24 p.m. UTC
Fortification was disabled to address build failures. With fortification enabled, the installed header contains an inline function with a body, and we cannot define the function again, with its real implementation. The internal __snprintf function did not have an fortify wrapper, so we lost a couple of fortification opportunities. After these changes, use of %n in syslog becomes a potential performance bottleneck. The later commits extract useful functionality from asprintf and use that to construct the syslog packet contents. Thanks, Florian Florian Weimer (11): misc: Build getdomainname with fortification misc: Build gethostname with fortification libio: Add fortify wrapper for internal __snprintf syslog: Update misc/tst-syslog to check reported %n value syslog: Build with fortification stdio: Rename __printf_buffer to __vfprintf_buffer libio: Extract __printf_buffer_asprintf_init from asprintf implementation stdio-common: Introduce the __printf_buffer function stdio-common: Allow skipping initial bytes in __printf_buffer for %n stdio-common: Support large offsets with %lln syslog: Use a printf buffer directly to construct the entire packet debug/snprintf_chk.c | 1 + include/bits/stdio2.h | 9 + include/printf.h | 9 +- include/printf_buffer.h | 52 +++++- include/stdio.h | 1 + libio/iovdprintf.c | 2 +- libio/iovsprintf.c | 2 +- libio/obprintf.c | 2 +- libio/vasprintf.c | 42 ++--- libio/vsnprintf.c | 2 +- libio/vswprintf.c | 2 +- misc/Makefile | 7 - misc/bits/syslog.h | 4 + misc/getdomain.c | 2 + misc/gethostname.c | 2 + misc/syslog.c | 187 +++++++------------- misc/tst-syslog.c | 12 +- posix/bits/unistd.h | 6 +- stdio-common/Makefile | 6 + stdio-common/printf_buffer.c | 30 ++++ stdio-common/tst-printf-large-n.c | 81 +++++++++ stdio-common/tst-printf_buffer.c | 156 ++++++++++++++++ stdio-common/vfprintf-internal.c | 10 +- stdio-common/vfprintf-process-arg.c | 2 +- sysdeps/mach/hurd/getdomain.c | 2 + sysdeps/mach/hurd/gethostname.c | 2 + sysdeps/posix/gethostname.c | 2 + sysdeps/unix/sysv/linux/alpha/gethostname.c | 2 + 28 files changed, 448 insertions(+), 189 deletions(-) create mode 100644 stdio-common/printf_buffer.c create mode 100644 stdio-common/tst-printf-large-n.c create mode 100644 stdio-common/tst-printf_buffer.c base-commit: 15de3d17e1d9da5d38efb0a87a82efbc5bda732d