public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Sergei Trofimovich <slyich@gmail.com>
To: Siddhesh Poyarekar <siddhesh@sourceware.org>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH] string.h: fix __fortified_attr_access macro call [BZ #29162]
Date: Mon, 23 May 2022 09:24:02 +0100	[thread overview]
Message-ID: <20220523092356.7e197052@nz> (raw)
In-Reply-To: <90a1369a-21c0-5d9c-4fde-491d2597a30f@sourceware.org>

On Mon, 23 May 2022 12:49:54 +0530
Siddhesh Poyarekar <siddhesh@sourceware.org> wrote:

> On 20/05/2022 20:36, Sergei Trofimovich wrote:
> > From: Sergei Trofimovich <slyich@gmail.com>
> > 
> > commit e938c0274 "Don't add access size hints to fortifiable functions"
> > converted a few '__attr_access ((...))' into '__fortified_attr_access (...)'
> > calls.
> > 
> > But one of conversions had double parentheses of '__fortified_attr_access (...)'.
> > 
> > Noticed as a gnat6 build failure:
> > 
> >      /<<NIX>>-glibc-2.34-210-dev/include/bits/string_fortified.h:110:50: error: macro "__fortified_attr_access" requires 3 arguments, but only 1 given
> > 
> > The change fixes parentheses.
> > 
> > Signed-off-by: Sergei Trofimovich <slyich@gmail.com>
> > ---
> >   string/bits/string_fortified.h | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/string/bits/string_fortified.h b/string/bits/string_fortified.h
> > index f4a5dfc2e5..149ebbb08b 100644
> > --- a/string/bits/string_fortified.h
> > +++ b/string/bits/string_fortified.h
> > @@ -107,7 +107,7 @@ __NTH (stpncpy (char *__dest, const char *__src, size_t __n))
> >   # else
> >   extern char *__stpncpy_chk (char *__dest, const char *__src, size_t __n,
> >   			    size_t __destlen) __THROW
> > -  __fortified_attr_access ((__write_only__, 1, 3))
> > +  __fortified_attr_access (__write_only__, 1, 3)
> >     __attr_access ((__read_only__, 2));
> >   extern char *__REDIRECT_NTH (__stpncpy_alias, (char *__dest, const char *__src,
> >   					       size_t __n), stpncpy);  
> 
> Hi Sergei, one question before I pull this in; how did this even happen? 
>   The build flags don't appear to have -D_FORTIFY_SOURCE, which is 
> prerequisite to including this file.  Also, that bit in the header is 
> reachable only with an older compiler, e.g. older than gcc 4.7 or an 
> ancient clang.

That's a great question!

NixOS / nixpkgs silently injects -D_FORTIFY_SOURCE=2 via gcc driver for vast majority
of packages even if they don't pass -D_FORTIFY_SOURCE=2 explicitly.

Also nixpkgs builds gnat6 with ... gcc-4.1.0 for historical reasons. We'll
get rid of such ancient toolchains eventually.

-- 

  Sergei

  parent reply	other threads:[~2022-05-23  8:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-20 15:06 Sergei Trofimovich
2022-05-23  3:50 ` Siddhesh Poyarekar
2022-05-23  6:54   ` Sergei Trofimovich
2022-05-23  6:55     ` Siddhesh Poyarekar
2022-05-23  7:19 ` Siddhesh Poyarekar
2022-05-23  7:23   ` Siddhesh Poyarekar
2022-05-23  8:24   ` Sergei Trofimovich [this message]
2022-05-23  8:31     ` Siddhesh Poyarekar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220523092356.7e197052@nz \
    --to=slyich@gmail.com \
    --cc=libc-alpha@sourceware.org \
    --cc=siddhesh@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).