From patchwork Fri Feb 9 15:24:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 85524 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 9159F385829B for ; Fri, 9 Feb 2024 15:25:21 +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 5A11D385841D for ; Fri, 9 Feb 2024 15:24:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5A11D385841D 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 5A11D385841D 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=1707492294; cv=none; b=uNmbWJ146EE2TCYqM3sbEjwxAPFBKa74kiCaW0rXA/0BEWpyzD1qFQpCRtLP3mOaLvm2ae8413J9Mk4w7ENmXSCEyT77VwVExvuBh6t+K4W7a3RO3Vm5sacKMV4m2fTTDI+5fi87VGAT6A/MqgdiGDNtrhYQPuT4WwMSpiu8Qus= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707492294; c=relaxed/simple; bh=JKKLU7kX+EKTQsLe+sfaxcYdCD3PiZuUJLIViMFUToc=; h=DKIM-Signature:From:To:Subject:Message-ID:Date:MIME-Version; b=iMeqylpnmJr4mBhyJvPgaZt1vJ60ZNv/I/7lYrKhuRB2NzCZfynEi+qSa2ct/fFUoEbtNZxZADh7I1ey4xQMFdwwpIjj1KWvGYxCrnTtonhUutvXMCXxUzEEFnId5Pa6GDVaOZcCDXytUu6gEZ3mYtoavjP5qyU1/lDd42quh/A= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707492291; 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=6WBS0MOErUE2FStW4oBg0Uj6cvf4phvfWYmNfTPvUKI=; b=SGKtkCAa9zJMwfHxobVNKAaPrG90Q7mELo+V5yaAcNstVv09VyK3uykdLFgKjMOgD6qFYz RivE87jNquheUuw1Nk7N0HlbiRFJ7RLOyq9JcA2X7aMC996AIvCIgaJ7UevLyPjOay2E3d TB0xB3EPEhz47mG8pP/M/lLtfMsmH9k= 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-335-qzeqx4aQMJ-Gb0tmpWHkXw-1; Fri, 09 Feb 2024 10:24:50 -0500 X-MC-Unique: qzeqx4aQMJ-Gb0tmpWHkXw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (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 0F666106D0C3 for ; Fri, 9 Feb 2024 15:24:50 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.58]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6808EAC1F for ; Fri, 9 Feb 2024 15:24:49 +0000 (UTC) From: Florian Weimer To: libc-alpha@sourceware.org Subject: [PATCH 01/11] misc: Build getdomainname with fortification In-Reply-To: Message-ID: <7710004342d09a8e62868a0bc659b5dca5b67324.1707491940.git.fweimer@redhat.com> References: X-From-Line: 7710004342d09a8e62868a0bc659b5dca5b67324 Mon Sep 17 00:00:00 2001 Date: Fri, 09 Feb 2024 16:24:47 +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.1 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, KAM_SHORT, 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 Introduce __glibc_nofortify_getdomainname to request disabling the fortification wrapper. Reviewed-by: Adhemerval Zanella --- misc/Makefile | 1 - misc/getdomain.c | 2 ++ posix/bits/unistd.h | 3 ++- sysdeps/mach/hurd/getdomain.c | 2 ++ 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/misc/Makefile b/misc/Makefile index c273ec6974..44ae89670a 100644 --- a/misc/Makefile +++ b/misc/Makefile @@ -209,7 +209,6 @@ routines := \ # Exclude fortified routines from being built with _FORTIFY_SOURCE routines_no_fortify += \ - getdomain \ gethostname \ syslog \ # routines_no_fortify diff --git a/misc/getdomain.c b/misc/getdomain.c index f6325644c9..f96636821f 100644 --- a/misc/getdomain.c +++ b/misc/getdomain.c @@ -19,6 +19,8 @@ The result is null-terminated if LEN is large enough for the full name and the terminator. */ +#define __glibc_nofortify_getdomainname + #include #include #include diff --git a/posix/bits/unistd.h b/posix/bits/unistd.h index bd209ec28e..6ed2943bf1 100644 --- a/posix/bits/unistd.h +++ b/posix/bits/unistd.h @@ -149,7 +149,8 @@ __NTH (gethostname (char *__buf, size_t __buflen)) #endif -#if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_UNIX98) +#if (defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_UNIX98)) \ + && !defined __glibc_nofortify_getdomainname __fortify_function int __NTH (getdomainname (char *__buf, size_t __buflen)) { diff --git a/sysdeps/mach/hurd/getdomain.c b/sysdeps/mach/hurd/getdomain.c index 137ce9ad5b..e24ab2137e 100644 --- a/sysdeps/mach/hurd/getdomain.c +++ b/sysdeps/mach/hurd/getdomain.c @@ -15,6 +15,8 @@ License along with the GNU C Library; if not, see . */ +#define __glibc_nofortify_getdomainname + #include #include "hurdhost.h"