From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 7C5E13858283 for ; Fri, 9 Feb 2024 15:24:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7C5E13858283 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 7C5E13858283 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=1707492300; cv=none; b=Wccq8KDvuUabCuBmjApkXpB5qayb9rrR/KJ2RUH0+a/oNVcEDh+z12gh7WvUq4yVRWqRrfCMnkNMS++gEWPBRoi9Tk572A0vixCtwPgjdDCqP/hwluM7PE3k8e9tRSoQJTioBsOtZ57YIS94PkRuemMBrMfdYk5SRqh97Iuy+84= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707492300; c=relaxed/simple; bh=8zDBdr3BoV+gCJkE7BxmTHidGHzHlbSFmQW6uejo3dw=; h=DKIM-Signature:From:To:Subject:Message-ID:Date:MIME-Version; b=hBUaDAfmL+KRC0XKTrCtmYip03JA2IlLXrLBx6SXU/zFvt5aQijBLX+QWrAnltgTWZoGEHb8fJdg/1jgyixFz+Z3DXswVAYpvjBtq3j1DE43f+toj0e6K3VwEAdPvrPT/b3bmU+rVwVCRgcAIQPQJGO14IEjfAnXDMyqE9MFKnk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707492298; 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=u1JrGcNwq2df22YFN/AkBjsycERcmQGNx4zRqVelG2s=; b=Q1Qbbp8ORIBGclYtGtE2eBxKKUA/eFAODrVHOskvkQhg7sI07rZo+bO/t14Qbrqk6G12++ lrcwliL3+eWKQDKvH6d5ZkCqvdiRQ28FulrI1rpc6sDZSLjCt1QxP1vKweIascSNbe3UsX 8CwDJWtQwEzMfyqM7awv1r9HItih3xU= 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-350-RxjZWZbKOKmz0yT5CehfQg-1; Fri, 09 Feb 2024 10:24:56 -0500 X-MC-Unique: RxjZWZbKOKmz0yT5CehfQg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (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 9978E185A782 for ; Fri, 9 Feb 2024 15:24:56 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.58]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 15DCC1C14B04 for ; Fri, 9 Feb 2024 15:24:55 +0000 (UTC) From: Florian Weimer To: libc-alpha@sourceware.org Subject: [PATCH 02/11] misc: Build gethostname with fortification In-Reply-To: Message-ID: References: X-From-Line: f0bd7ca129f6dd3df2e9b03270e6fbd5990ace70 Mon Sep 17 00:00:00 2001 Date: Fri, 09 Feb 2024 16:24:54 +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.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain 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,KAM_SHORT,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 List-Id: Introduce __glibc_nofortify_gethostname to request disabling the fortification wrapper. --- misc/Makefile | 1 - misc/gethostname.c | 2 ++ posix/bits/unistd.h | 3 ++- sysdeps/mach/hurd/gethostname.c | 2 ++ sysdeps/posix/gethostname.c | 2 ++ sysdeps/unix/sysv/linux/alpha/gethostname.c | 2 ++ 6 files changed, 10 insertions(+), 2 deletions(-) diff --git a/misc/Makefile b/misc/Makefile index 44ae89670a..6d8528c925 100644 --- a/misc/Makefile +++ b/misc/Makefile @@ -209,7 +209,6 @@ routines := \ # Exclude fortified routines from being built with _FORTIFY_SOURCE routines_no_fortify += \ - gethostname \ syslog \ # routines_no_fortify diff --git a/misc/gethostname.c b/misc/gethostname.c index 2c849a95c3..82800f8abb 100644 --- a/misc/gethostname.c +++ b/misc/gethostname.c @@ -15,6 +15,8 @@ License along with the GNU C Library; if not, see . */ +#define __glibc_nofortify_gethostname + #include #include diff --git a/posix/bits/unistd.h b/posix/bits/unistd.h index 6ed2943bf1..1230bba9a5 100644 --- a/posix/bits/unistd.h +++ b/posix/bits/unistd.h @@ -138,7 +138,8 @@ getlogin_r (char *__buf, size_t __buflen) #endif -#if defined __USE_MISC || defined __USE_UNIX98 +#if defined __USE_MISC || defined __USE_UNIX98 \ + && !defined __glibc_nofortify_gethostname __fortify_function int __NTH (gethostname (char *__buf, size_t __buflen)) { diff --git a/sysdeps/mach/hurd/gethostname.c b/sysdeps/mach/hurd/gethostname.c index 91d7f45d6e..dbb7d75713 100644 --- a/sysdeps/mach/hurd/gethostname.c +++ b/sysdeps/mach/hurd/gethostname.c @@ -15,6 +15,8 @@ License along with the GNU C Library; if not, see . */ +#define __glibc_nofortify_gethostname + #include #include "hurdhost.h" diff --git a/sysdeps/posix/gethostname.c b/sysdeps/posix/gethostname.c index 3c50706b58..3c79f77dd3 100644 --- a/sysdeps/posix/gethostname.c +++ b/sysdeps/posix/gethostname.c @@ -15,6 +15,8 @@ License along with the GNU C Library; if not, see . */ +#define __glibc_nofortify_gethostname + #include #include #include diff --git a/sysdeps/unix/sysv/linux/alpha/gethostname.c b/sysdeps/unix/sysv/linux/alpha/gethostname.c index 30da8f30e4..45eb1788d4 100644 --- a/sysdeps/unix/sysv/linux/alpha/gethostname.c +++ b/sysdeps/unix/sysv/linux/alpha/gethostname.c @@ -15,6 +15,8 @@ License along with the GNU C Library. If not, see . */ +#define __glibc_nofortify_gethostname + #include #include #include -- 2.43.0