public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: "Philip Lorenz" <philip@bithub.de>
To: Mike Crowe <mac@mcrowe.com>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [OE-core] [pseudo][PATCH] makewrappers: Handle parameters marked as nonnull
Date: Wed, 11 Aug 2021 18:43:27 +0200	[thread overview]
Message-ID: <87eda11b-e544-ed39-b9be-234c64bd5b43@bithub.de> (raw)
In-Reply-To: <20210811162522.GA9259@mcrowe.com>

Hi Mike,

On 11.08.21 18:25, Mike Crowe wrote:
> On Monday 17 May 2021 at 21:25:06 +0200, Philip Lorenz wrote:
>> Commit 60e25a36558f1f07dcce1a044fe976b475bec42b started dereferencing
>> the "path" parameter which for some functions is annotated with the
>> "nonnull" attribute. While the commit explicitly checks for NULL
>> pointers before dereferencing it, GCC (at optimization level 1 and
>> above) removes the check due to the "nonnull" attribute being set for
>> some parameters in the glibc headers (e.g. statx()).
>>
>> However, the statx() man page explicitly allows calling with NULL
>> pointers (in which case the EFAULT is returned) and this behaviour is
>> used in the wild (e.g. in Rust) to determine whether the statx() system
>> call is supported.
>>
>> Disabling the optimization is not possible ([1]) so prevent the compiler
>> optimization by referencing the parameter in a noop inline assembly
>> instruction instead.
>>
>> [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100404
>>
>> Signed-off-by: Philip Lorenz <philip@bithub.de>
>> ---
>>   Makefile.in        |  2 ++
>>   makewrappers       |  6 +++++-
>>   test/test-fstat.c  | 29 +++++++++++++++++++++++++++++
>>   test/test-fstat.sh |  8 ++++++++
>>   4 files changed, 44 insertions(+), 1 deletion(-)
>>   create mode 100644 test/test-fstat.c
>>   create mode 100755 test/test-fstat.sh
>>
>> diff --git a/Makefile.in b/Makefile.in
>> index cf13010..10441ef 100644
>> --- a/Makefile.in
>> +++ b/Makefile.in
>> @@ -77,6 +77,8 @@ all: $(LIBPSEUDO) $(PSEUDO) $(PSEUDODB) $(PSEUDOLOG) $(PSEUDO_PROFILE)
>>   test: all | $(BIN) $(LIB) $(LOCALSTATE)
>>   	$(CC) $(CFLAGS) $(CFLAGS_PSEUDO) -o test/test-rename-fstat test/test-rename-fstat.c
>>   	$(CC) $(CFLAGS) $(CFLAGS_PSEUDO) -o test/test-openat test/test-openat.c
>> +	$(CC) $(CFLAGS) $(CFLAGS_PSEUDO) -o test/test-statx test/test-statx.c
> The test/test-stax.c file wasn't included in the patch, which means that
> "make test" no longer works on the current pseudo oe-core branch. :(
> Perhaps this went unnoticed since it's necessary to run configure again for
> the Makefile to be regenerated to see the problem.
>
> Do you still have the file, or should I just submit a change to remove this
> line?

My bad - I must've forgotten to stage it. Just resent the missing test 
case in "[pseudo][PATCH] test: Add missing test-statx test case".

Philip


      reply	other threads:[~2021-08-11 16:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-17 19:25 [pseudo][PATCH] makewrappers: Handle parameters marked as nonnull Philip Lorenz
2021-08-11 16:25 ` [OE-core] " Mike Crowe
2021-08-11 16:43   ` Philip Lorenz [this message]

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=87eda11b-e544-ed39-b9be-234c64bd5b43@bithub.de \
    --to=philip@bithub.de \
    --cc=mac@mcrowe.com \
    --cc=openembedded-core@lists.openembedded.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