From patchwork Fri Feb 9 15:25:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 85527 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 559D73858012 for ; Fri, 9 Feb 2024 15:25:55 +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.129.124]) by sourceware.org (Postfix) with ESMTPS id 0BDAB3858407 for ; Fri, 9 Feb 2024 15:25:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0BDAB3858407 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 0BDAB3858407 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707492328; cv=none; b=ONOMwKMWjRlOZE+eqwZZSJx+zqHxDmizmTx+HtcgmTb/DlFtIbQnsO+TshOaH5dAgo3cDopkyUo8mhBR5hVR2PRnqNBMZ4MXV1pmUzTyP9po1LK97CiE1Kgwxha913oX7AGj3oJ6FVadjUJdeXiqefPsKQP4uUEzBxyR0wJqyC8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707492328; c=relaxed/simple; bh=asvuEZGDVQ68oiWI91gSjabHaw8A+GYk3Izkt+jOi8A=; h=DKIM-Signature:From:To:Subject:Message-ID:Date:MIME-Version; b=tsKgA3wvLMRSIqqlqSwbIDzD5URr3CkrjDLsBp8kwrUKF1I4YQnCGIKRwbS45enVSk2x85yD7twXhb+/POSnc++oqVe00VNDyJfD8iWIO1CkzZiY+mJ1hoK2kPkACCtJueCucibC0bEm9MPI9IzZxwm+ipxoOVah0sWIFQLDRfM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707492326; 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=x0OdSTbXNOPxgL0QktflHI7piP1rkMFBjh4nhoRtlMc=; b=MHtHBcpNpzb6PHikUgSOrwwjHb+92A0l01Evp18TGozI5Hh3+0rW2mSWZqtRA0C19/lnqW o8lwgERLhyxbwxDMiW4eenqbite0Op+xNeHsPEG/y/GdmdXcZuKABjw27FgAGsCU5uCDMI fKHUxfECReZ7IZ7eNJvCPWufMkzioaA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-197-7afrDYFGPcqaQKTDCoVh6g-1; Fri, 09 Feb 2024 10:25:25 -0500 X-MC-Unique: 7afrDYFGPcqaQKTDCoVh6g-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (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 E155F185A780 for ; Fri, 9 Feb 2024 15:25:24 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.58]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 866DCC08EF7 for ; Fri, 9 Feb 2024 15:25:24 +0000 (UTC) From: Florian Weimer To: libc-alpha@sourceware.org Subject: [PATCH 05/11] syslog: Build with fortification In-Reply-To: Message-ID: <3025a0556566ebbe0955666387d1285b39605de4.1707491940.git.fweimer@redhat.com> References: X-From-Line: 3025a0556566ebbe0955666387d1285b39605de4 Mon Sep 17 00:00:00 2001 Date: Fri, 09 Feb 2024 16:25:23 +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.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-10.7 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_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.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 This causes /proc/self/maps to be processed for certain syslog calls due to the use of %n. Reviewed-by: Adhemerval Zanella --- misc/Makefile | 5 ----- misc/bits/syslog.h | 4 ++++ misc/syslog.c | 3 +++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/misc/Makefile b/misc/Makefile index 6d8528c925..236076a9d6 100644 --- a/misc/Makefile +++ b/misc/Makefile @@ -207,11 +207,6 @@ routines := \ writev \ # routines -# Exclude fortified routines from being built with _FORTIFY_SOURCE -routines_no_fortify += \ - syslog \ - # routines_no_fortify - generated += \ tst-allocate_once-mem.out \ tst-allocate_once.mtrace \ diff --git a/misc/bits/syslog.h b/misc/bits/syslog.h index aadcd42000..e6f7938a3f 100644 --- a/misc/bits/syslog.h +++ b/misc/bits/syslog.h @@ -31,11 +31,13 @@ redirections, e.g. long double asm redirections. */ #ifdef __va_arg_pack +# ifndef __glibc_nofortify_syslog __fortify_function void syslog (int __pri, const char *__fmt, ...) { __syslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ()); } +# endif #elif !defined __cplusplus # define syslog(pri, ...) \ __syslog_chk (pri, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__) @@ -43,9 +45,11 @@ syslog (int __pri, const char *__fmt, ...) #ifdef __USE_MISC +# ifndef __glibc_nofortify_vsyslog __fortify_function void vsyslog (int __pri, const char *__fmt, __gnuc_va_list __ap) { __vsyslog_chk (__pri, __USE_FORTIFY_LEVEL - 1, __fmt, __ap); } +# endif #endif diff --git a/misc/syslog.c b/misc/syslog.c index 4af87f54fd..68ee3aef5f 100644 --- a/misc/syslog.c +++ b/misc/syslog.c @@ -27,6 +27,9 @@ * SUCH DAMAGE. */ +#define __glibc_nofortify_syslog +#define __glibc_nofortify_vsyslog + #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)syslog.c 8.4 (Berkeley) 3/18/94"; #endif /* LIBC_SCCS and not lint */