Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quick tests fails with ASRL enabled on CentOS #161

Open
racardoso opened this issue Nov 24, 2016 · 4 comments
Open

Quick tests fails with ASRL enabled on CentOS #161

racardoso opened this issue Nov 24, 2016 · 4 comments
Assignees
Labels

Comments

@racardoso
Copy link

racardoso commented Nov 24, 2016

This problem only affects CentOS (possible Rhel). Ubuntu runs fine. Tested on CentOS7.

HHVM Version

HHVM next (ppc64el)
HHVM master (ppc64el)
HHVM upstream/master (ppc64el)
HHVM 3.15.1 (ppc64el)

Tested on Release and Debug mode.

Standalone code, or other way to reproduce the problem

Compile and install HHVM on CentOS7.

After installation run quick tests

cd hphp/test
./run quick

Expected result

1105/1105 tests passed as in Ubuntu

Actual result

1065 tests failed with a segmentation fault (SIGSEGV) or a assert fail when run in Debug mode:

Assertion failure: /home/hhvm-3.15.0/hphp/runtime/vm/jit/fixup.cpp:108: void HPHP::jit::FixupMap::fixupWork(HPHP::ExecutionContext*, HPHP::ActRec*) const: assertion `nextRbp && nextRbp != rbp && "Missing fixup for native call"' failed.
@racardoso racardoso added the bug label Nov 24, 2016
@racardoso
Copy link
Author

racardoso commented Nov 24, 2016

Run a failed test at GDB got:

$ gdb --args ../hhvm/hhvm -c hhvm/hphp/test/config.ini -vEval.EnableArgsInBacktraces=true -vEval.EnableIntrinsicsExtension=true -vRepo.Local.Mode=-- -vRepo.Central.Path=hhvm/hphp/hhvm/verify.hhbc -vEval.Jit=true -vResourceLimit.CoreFileSize=0 --file 'quick/BindM.php'
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-80.el7
(gdb) run
Starting program: hphp/test/../hhvm/hhvm -c /hphp/test/config.ini -vEval.EnableArgsInBacktraces=true -vEval.EnableIntrinsicsExtension=true -vRepo.Local.Mode=-- -vRepo.Central.Path=hphp/hhvm/verify.hhbc -vEval.Jit=true -vResourceLimit.CoreFileSize=0 --file quick/BindM.php
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/power8/libthread_db.so.1".
array(1) {
  [0]=>
  &string(2) "hi"
}
array(1) {
  [0]=>
  &string(2) "hi"
}
[Inferior 1 (process 606) exited normally]

Running this test out of gdb can reproduce the error.

Assertion failure: /home/hhvm-3.15.0/hphp/runtime/vm/jit/fixup.cpp:108: void HPHP::jit::FixupMap::fixupWork(HPHP::ExecutionContext*, HPHP::ActRec*) const: assertion `nextRbp && nextRbp != rbp && "Missing fixup for native call"' failed

@racardoso
Copy link
Author

racardoso commented Nov 24, 2016

Enable address randomization on GDB
set disable-randomization off
Reproduces the problem. GDB disable virtual address randomization since it can cause problems when debug code.

(gdb) set disable-randomization off
(gdb) run
Starting program: hhvm/hphp/test/../hhvm/hhvm -c hphp/test/config.ini -vEval.EnableArgsInBacktraces=true -vEval.EnableIntrinsicsExtension=true -vRepo.Local.Mode=-- -vRepo.Central.Path=hhvm/hphp/hhvm/verify.hhbc -vEval.Jit=true -vResourceLimit.CoreFileSize=0 --file quick/BindM.php
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/power8/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x0000010003200028 in ?? ()

@racardoso
Copy link
Author

racardoso commented Nov 24, 2016

Address 0x0000010003200028 points to a li, 1 instruction which makes no sense since this instruction do not access memory and should not throw a SIGSEGV. Checking memory permissions appears that the block where the jitted instructions are write is not marked with exec permission hence we got a segmentation fault when try to execute the instruction due a permission fault.

Program received signal SIGSEGV, Segmentation fault.
0x0000010003200028 in ?? ()
(gdb) call getpid()
$1 = 610
(gdb) !pmap -x 610
610:   hhvm/hphp/test/../hhvm/hhvm -c hphp/test/config.ini -vEval.EnableArgsInBacktraces=true -vEval.EnableIntrinsicsExtension=true -vRepo.Local.Mode=-- -vRepo.Central.Path=/hhvm/hphp/hhvm/verify.hhbc -vEval.Jit=true -vResourceLimit.CoreFileSize=0 --file quick/BindM.php
Address           Kbytes     RSS   Dirty Mode  Mapping
0000000010000000   64704   27904     128 r-x-- hhvm
0000000013f30000     320     320     320 r---- hhvm
0000000013f80000     960     320     320 rw--- hhvm
0000000014070000     576     384     384 rw---   [ anon ]
0000010003150000  105152     256     256 rw---   [ anon ]
 

@racardoso
Copy link
Author

There's two workarounds for this problem:

  1. Disable Address Space Randomization (ASRL)
    Edit /etc/sysctl.conf and add:
kernel.randomize_va_space = 0

then run

sysctl -p

  1. Disable selinux

Disable selinux works too:
Edit the file /etc/sysconfig/selinux and change SELINUX variable to disabled

I still need to confirm if this bug affects only PPC64 machines or affects X86. I still not sure if this is a HHVM or a CentOS bug.

@racardoso racardoso self-assigned this Nov 24, 2016
@racardoso racardoso changed the title CentOS bug with address space layout randomization 1065 quick tests fails on CentOS7 Nov 24, 2016
@racardoso racardoso changed the title 1065 quick tests fails on CentOS7 Quick tests fails with ASRL enabled on CentOS Mar 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant