From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x133.google.com (mail-il1-x133.google.com [IPv6:2607:f8b0:4864:20::133]) by sourceware.org (Postfix) with ESMTPS id E066C3858C39 for ; Mon, 12 Feb 2024 17:25:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E066C3858C39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E066C3858C39 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::133 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707758762; cv=none; b=W5kF6MV1Kqvv0Kx1IBMG3RzgEFDuk/K4vDNP7lWlBk+wFqCaiFzka7gOMECW6aX7Ee+MSmvTNYb4niyCgz/p0xYu807fYT9XCdSidD0Iqint2eY5mwP/4A4dejSvywylyII8/BCUyZj7KBK8RSfb43jbE3gTdx4EFiCOGhfTz3Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707758762; c=relaxed/simple; bh=DpUANIMq2jBNtMSd/LaZFybxxYsLWBnTDncrhrdxm+g=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=nH7hfFhcGmHh0TQpTKiwm/lIKOhGJ5KWinihbtnGsoYhD/XndNWp8aZdxL0T1LYDvWg/gncckW3EbA3M5VhvUHq2sSauIRVt2fm0MquIfGB0BZH4K3VEOZeLcwS9heGrcFHmpuRbQ1d5yDdHCmU5CAYfDCS/jHyzNMSMUM3zV9g= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-il1-x133.google.com with SMTP id e9e14a558f8ab-363ca193a3aso10011255ab.0 for ; Mon, 12 Feb 2024 09:25:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707758758; x=1708363558; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:organization:from:references :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=sBrY3DkxuLH2zH2fPt/y8VJgZdaYeTzlZsvjONnLQv4=; b=KADlgcl7xiJRszBi5fIQNICyfS+KWh5ctO3CmM1rwMpVJu2/afxKr7SYsuzL73dv5m 5x5tEnnKti4WNQglvhbrElNWQJ9JRJwbdgSrnprtU+YbZ8yEXlqI/2lYPfgzk4JRVfXi PFVjk32dSwnpJqsDdYznoz0eyO5z0Gl/hBjZWYTt+UuRDCqcLxe0lIsBQD8YCgzV9wds hTvUYzjYvFo8oJuAKlR+qK1F+Iipm1DMk1v5KCY4vrrLPPUjPOIGRubDwuBq7FSvAW3u 5d7Z4ebduw/+4Y+fWMw/DcO43zv1lekXBB0r6oflJ7c8E6j1bkOWDIyvatQPXOcjyMjx oqIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707758758; x=1708363558; h=content-transfer-encoding:in-reply-to:organization:from:references :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=sBrY3DkxuLH2zH2fPt/y8VJgZdaYeTzlZsvjONnLQv4=; b=Yu3EW0ib5Kysd3Ee6vL6k9oRXJ57CcTFu7ZCXmDYALv2gHwpcljf63czL0OIDasYVV h6H43mc1lBggA012U2FZkCZMnUPvj9pTJvG/LWWqJtkNRtw3bwHaOyPN/tQPC4Kp9dN4 1koh5ilMaVZNi4XGQgT5DwKQ/FDVUOfADxflDbU4FhgrE2TSCmzeNUpIKHHEBmukxvLT MiOY6MLrHj1J+Gh+mxoTVpbuBHsacth36L3VOGaaoTlng0cptWuwN0vHy0pEvJbk33UP mFaNli7/naF5w53A/GKDoABa0NhInAF440Py3gqbb0lufeiUO6pLDbaenwGx8X5Y/tvY fEPg== X-Gm-Message-State: AOJu0YylRVpHNzHCBs14snUHLriMhgKkFiQnJdN9GIa4zfW8R+nxgvtb 9ive7QOsD31R3OlHxbQayV2mZnr18+Mw91QCyWzuUMwqeKIn6tD/54Op4TQgv1LCej3aoL58Q4V b X-Google-Smtp-Source: AGHT+IHnNjkV8k8tb+Lk9NnCHg3oaEWiNsoDFOI+lwWhIV1Y5PcUHAPO6xaDqj/Ay+pDLmi3w/d23Q== X-Received: by 2002:a05:6e02:1d99:b0:363:c33d:82de with SMTP id h25-20020a056e021d9900b00363c33d82demr10207985ila.23.1707758758480; Mon, 12 Feb 2024 09:25:58 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUY5kjnIftNFnUaNY5Q1ZHmmAyIaZmlQ+csyAa52kdGtfvNJwH0Pv4V/Jb0dvfJ+hWZA+qcrexowjkBx/Zy22TXlKmCxtFTA3MF Received: from ?IPV6:2804:1b3:a7c0:378:a95e:7d43:370e:1d4c? ([2804:1b3:a7c0:378:a95e:7d43:370e:1d4c]) by smtp.gmail.com with ESMTPSA id cb5-20020a056a02070500b005dbf22d6e1asm626806pgb.56.2024.02.12.09.25.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 12 Feb 2024 09:25:57 -0800 (PST) Message-ID: Date: Mon, 12 Feb 2024 14:25:55 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 02/11] misc: Build gethostname with fortification Content-Language: en-US To: Florian Weimer , libc-alpha@sourceware.org References: From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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: On 09/02/24 12:24, Florian Weimer wrote: > Introduce __glibc_nofortify_gethostname to request disabling > the fortification wrapper. LGTM, thanks. Reviewed-by: Adhemerval Zanella > --- > 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