From patchwork Fri Feb 9 15:25:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 85526 X-Patchwork-Delegate: azanella@linux.vnet.ibm.com 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 464DC38582B2 for ; Fri, 9 Feb 2024 15:25:40 +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 8745F3858439 for ; Fri, 9 Feb 2024 15:25:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8745F3858439 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 8745F3858439 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=1707492310; cv=none; b=aYCMd4nTejVfCal7yBRqeyMr3AjvGtpn59LS/9SOSj/0WN0Jsjx+41y16XfD1c3DuseNbEyqh77Kuokj/ao0e8+cRApB/IlCK0WeJtkZz+vhB0bkB0aNVtjjTy8K3gJVUcfkol947Xg3pGYnK8R2PIogCkyKjc0QgYDoXx6Qh4k= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707492310; c=relaxed/simple; bh=pGqu5VgpySGJho/Xns/sIBSWBf2A+EznYEfvML6n2WM=; h=DKIM-Signature:From:To:Subject:Message-ID:Date:MIME-Version; b=Dm8IAjzVXnw9IzS+NfrzT4cTlPJoMIRESPXHem8cXJoaCZ/Hh3tdOmbXrs8EQTkUeaB9+gDE80cR8nSn6FnFs86f8OgHxBTJRcKNROBK7BsZkxCyoysqKOK0UO9zLX9HqUepDfCJF7en5NupcQucCcLGGIxiIcIBck+XWVVHTEs= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707492308; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ceCAv6pPsBH/3Q4mezG1E6VSZYnH1aE2y5J4FRuqLU4=; b=RQrPWYR13X7BoTaUH+D7wcjUVUoOvERvE6CspmHdhI2XM8d8FMgGfY1mEHYQEEyO9uzmxN qNs3TjL/psvQv4lJcNn5JchO5ZyZszo1KW2kyNk8a9wjhRuz5XFZbPfexvZ/mpGnE+Qrga KhVxv5ZDQBdS2CWifA+DksJl2M8n3vU= 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-692-c14AtKyPMnq1lbnQPkL-tA-1; Fri, 09 Feb 2024 10:25:06 -0500 X-MC-Unique: c14AtKyPMnq1lbnQPkL-tA-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 9E0B11C05129 for ; Fri, 9 Feb 2024 15:25:06 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.58]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 038921103A for ; Fri, 9 Feb 2024 15:25:05 +0000 (UTC) From: Florian Weimer To: libc-alpha@sourceware.org Subject: [PATCH 03/11] libio: Add fortify wrapper for internal __snprintf In-Reply-To: Message-ID: <45d399f3e70726984705466772370ba33ce3aa8a.1707491940.git.fweimer@redhat.com> References: X-From-Line: 45d399f3e70726984705466772370ba33ce3aa8a Mon Sep 17 00:00:00 2001 Date: Fri, 09 Feb 2024 16:25:04 +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 X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org --- debug/snprintf_chk.c | 1 + include/bits/stdio2.h | 9 +++++++++ include/stdio.h | 1 + 3 files changed, 11 insertions(+) diff --git a/debug/snprintf_chk.c b/debug/snprintf_chk.c index 995d805f5d..ea02efec3e 100644 --- a/debug/snprintf_chk.c +++ b/debug/snprintf_chk.c @@ -40,4 +40,5 @@ ___snprintf_chk (char *s, size_t maxlen, int flag, size_t slen, return ret; } +ldbl_hidden_def (___snprintf_chk, __snprintf_chk) ldbl_strong_alias (___snprintf_chk, __snprintf_chk) diff --git a/include/bits/stdio2.h b/include/bits/stdio2.h index 6d7cf4306f..fb909c21ee 100644 --- a/include/bits/stdio2.h +++ b/include/bits/stdio2.h @@ -1 +1,10 @@ #include + +__fortify_function int +__NTH (__snprintf (char *__restrict __s, size_t __n, + const char *__restrict __fmt, ...)) +{ + return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, + __glibc_objsize (__s), __fmt, + __va_arg_pack ()); +} diff --git a/include/stdio.h b/include/stdio.h index 24f1652f19..364f4d22a1 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -62,6 +62,7 @@ extern int __vsscanf (const char *__restrict __s, extern int __sprintf_chk (char *, int, size_t, const char *, ...) __THROW; extern int __snprintf_chk (char *, size_t, int, size_t, const char *, ...) __THROW; +stdio_hidden_ldbl_proto (__, snprintf_chk) extern int __vsprintf_chk (char *, int, size_t, const char *, __gnuc_va_list) __THROW; extern int __vsnprintf_chk (char *, size_t, int, size_t, const char *,