New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 894587 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Nov 8
Cc:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug

Blocking:
issue 834385



Sign in to add a comment

mosys: segmentation fault when running with glibc

Project Member Reported by yunlian@chromium.org, Oct 11

Issue description

On samus board, build an image with glibc 2.27.
mosys crashed with SIGSYS


backstrace looks like


__libc_open64 
file_lock_open_or_create()
mosys::main()

The source code of __libc_open64 looks like
int
__libc_open64 (const char *file, int oflag, ...)
{
  int mode = 0;

  if (__OPEN_NEEDS_MODE (oflag))
    {
      va_list arg;
      va_start (arg, oflag);
      mode = va_arg (arg, int);
      va_end (arg);
    }

  return SYSCALL_CANCEL (openat, AT_FDCWD, file, oflag | EXTRA_OPEN_FLAGS,
                         mode);
}

It failed on SYSCALL_CANCEL().

In glibc, this commit

Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Nov 11 15:00:03 2016 -0200

    Consolidate Linux open implementation
    
    This patch consolidates the open Linux syscall implementation on
    sysdeps/unix/sysv/linux/open{64}.c.  The changes are:
    
      1. Remove open{64} from auto-generation syscalls.list.
      2. Add a new open{64}.c implementation.  For architectures that
         define __OFF_T_MATCHES_OFF64_T the default open64 will create
         alias to required open symbols.
      3. Use __NR_openat as default syscall for open{64}.

changes the __libc_open64 to call
return SYSCALL_CANCEL (openat, AT_FDCWD, file, oflag | EXTRA_OPEN_FLAGS,   mode)
instead of 
return SYSCALL_CANCEL (open, file, oflag | O_LARGEFILE, mode)

Maybe this is caused by this change on glibc?

 
Cc: vapier@chromium.org
should I add 'openat' to mosys-seccomp.policy?
if we're permitting open, adding openat is fine

prob want to grep all the policies files to see if there's any others that need updating
Project Member

Comment 4 by bugdroid1@chromium.org, Oct 12

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/mosys/+/1366b262e679d4b885fe44da11d9bdbce9b1d239

commit 1366b262e679d4b885fe44da11d9bdbce9b1d239
Author: Yunlian Jiang <yunlian@google.com>
Date: Fri Oct 12 11:47:13 2018

mosys: allow openat on amd64 and arm.

This allows openat on amd64 and arm board because glibc is using this
system call when calling open.

BUG= chromium:894587 
TEST=no crash when running /usr/sbin/mosys on samus with glibc 2.27

Change-Id: If0d0df8afdd433f50b0c9dc048e9e7823399bf69
Reviewed-on: https://chromium-review.googlesource.com/1277642
Commit-Ready: Yunlian Jiang <yunlian@chromium.org>
Tested-by: Yunlian Jiang <yunlian@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>

[modify] https://crrev.com/1366b262e679d4b885fe44da11d9bdbce9b1d239/seccomp/mosys-seccomp-arm.policy
[modify] https://crrev.com/1366b262e679d4b885fe44da11d9bdbce9b1d239/seccomp/mosys-seccomp-amd64.policy

Labels: OS-Chrome
Owner: yunlian@chromium.org
Status: Fixed (was: Untriaged)

Sign in to add a comment