public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Andreas Fink <finkandreas@web.de>
Cc: libc-help <libc-help@sourceware.org>
Subject: Re: segmentation fault with glibc-2.34
Date: Fri, 3 Dec 2021 12:03:53 -0300	[thread overview]
Message-ID: <fe51f268-b678-6808-a321-b62ab565d626@linaro.org> (raw)
In-Reply-To: <CAMXh4bVBP5EU+1Zi4fK+=GHr0Miytjb-_J3+336t8i=J+TnL2A@mail.gmail.com>



On 03/12/2021 11:55, Adhemerval Zanella wrote:
> On Fri, Dec 3, 2021 at 10:38 AM Andreas Fink via Libc-help
> <libc-help@sourceware.org> wrote:
>>
>> Hello,
>> I have observed a crash in firefox with glibc-2.34 and have found a
>> small reproducer.
>> Is the sigsys signal handler valid? If yes, then there is a bug in
>> glibc-2.34.
>> If it is invalid to set the result in the context, I think the firefox
>> sandbox is doing dodgy things.
>>
>> gcc test.c -lseccomp
>> strace ./a.out
> 
> The seccomp filter *explicitly* blocks newfstatat, which might be used
> by getpwuid.

Oops, I didn't not get the issue at first.  It seems that the syscall return
code it not being set as expected:

(gdb) disas
Dump of assembler code for function __GI___fstatat64:
   0x00007ffff7e6fe70 <+0>:	endbr64 
   0x00007ffff7e6fe74 <+4>:	mov    %ecx,%r10d
   0x00007ffff7e6fe77 <+7>:	mov    $0x106,%eax
   0x00007ffff7e6fe7c <+12>:	syscall 
   0x00007ffff7e6fe7e <+14>:	cmp    $0xfffff000,%eax
=> 0x00007ffff7e6fe83 <+19>:	ja     0x7ffff7e6fe90 <__GI___fstatat64+32>
   0x00007ffff7e6fe85 <+21>:	xor    %eax,%eax
   0x00007ffff7e6fe87 <+23>:	ret    
   0x00007ffff7e6fe88 <+24>:	nopl   0x0(%rax,%rax,1)
   0x00007ffff7e6fe90 <+32>:	mov    0x100f79(%rip),%rdx        # 0x7ffff7f70e10
   0x00007ffff7e6fe97 <+39>:	neg    %eax
   0x00007ffff7e6fe99 <+41>:	mov    %eax,%fs:(%rdx)
   0x00007ffff7e6fe9c <+44>:	mov    $0xffffffff,%eax
   0x00007ffff7e6fea1 <+49>:	ret    
End of assembler dump.
(gdb) i r eax
eax            0x0                 0

Which makes getpwuid access uninitiated/invalid memory later.

      parent reply	other threads:[~2021-12-03 15:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-03 13:38 Andreas Fink
2021-12-03 14:55 ` Adhemerval Zanella
2021-12-03 15:02   ` Florian Weimer
2021-12-03 15:15     ` Adhemerval Zanella
2021-12-03 15:03   ` Adhemerval Zanella [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=fe51f268-b678-6808-a321-b62ab565d626@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=finkandreas@web.de \
    --cc=libc-help@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).