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

Segmentation fault with IonCube or SourceGuardian loaders #873

Open
yuriysklyarenko opened this issue Apr 8, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@yuriysklyarenko
Copy link

Description

We faced a 'Segmentation fault' issue when using NewRelic APM 10.19.0.9-1 with PHP 8.1 and the latest versions of SourceGuardian or IonCube PHP extensions when using the encoded files.

Steps to Reproduce

  1. Install the latest version of SourceGuardian or IonCube loaders
  2. Install the latest version of NewRelic APM
  3. Try to run encoded files via CGI or CLI

PHP 8.1.27 (cli) (built: Feb 20 2024 15:31:34) (NTS)
ionCube PHP Loader v13.0.2
SourceGuardian v14.0.2

$ php -m |grep newrelic
newrelic

$ php AbstractCategory_sg.php
Segmentation fault (core dumped)

$ php AbstractCategory_ioncube.php
Segmentation fault (core dumped)

It is reproducible for both PHP-FPM and CLI, at the same time when the Newrelic PHP extension is disabled the error isn't reproducible.

Relevant Logs / Console output

An example of strace output:
With enabled SourceGuadian loader on a file encoded by SourceGuardian encoder:
read(7, "<?php\r\nreturn sg_load('A574EF8E4CDFF5BCAAQAAAAXAAAABHAAAACABAAAAAAAAAD/DQrnshe3//JpbIWOTWBixCaUoxpbgIXEQ9rv6C8yrBUNY72JTmzkRpgl3sgcmPtWVIWp84RqB5snz9pVkWXdUHZlPhSARK56cTyMs4MJRr8XsqTedsm4BmQl0yaE1+n3ewecgK5KHMwKG80z8sOdywcAAACYtQAAXAy1ND588Uv9o2trmFLjPqTv6"..., 8192) = 8192 close(7) = 0 --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_ACCERR, si_addr=0x7f895ec7d1e0} --- getpid() = 2259803 write(3, "Process 2259803 (version 10.19.0.9) received signal 11: segmentation violation\n", 79) = 79 write(3, "process id 2259803 fatal signal (SIGSEGV, SIGFPE, SIGILL, SIGBUS, ...) - stack dump follows (code=0x7f8969028000 bss=0x7f8969133fbc):\n", 135) = 135 futex(0x7f8962289088, FUTEX_WAKE_PRIVATE, 2147483647) = 0

With enabled IonCube loader on a file encoded by IonCube encoder:
openat(AT_FDCWD, "/home/user/AbstractCategory_ioncube.php", O_RDONLY) = 7 fstat(7, {st_mode=S_IFREG|0644, st_size=64996, ...}) = 0 mmap(NULL, 64996, PROT_READ, MAP_SHARED, 7, 0) = 0x7ff3bc23e000 brk(NULL) = 0x1ca6000 brk(0x1cc7000) = 0x1cc7000 brk(NULL) = 0x1cc7000 brk(0x1ce8000) = 0x1ce8000 brk(NULL) = 0x1ce8000 brk(0x1d09000) = 0x1d09000 brk(NULL) = 0x1d09000 brk(0x1d2a000) = 0x1d2a000 brk(NULL) = 0x1d2a000 brk(0x1d4b000) = 0x1d4b000 brk(NULL) = 0x1d4b000 brk(0x1d70000) = 0x1d70000 munmap(0x7ff3bc23e000, 64996) = 0 close(7) = 0 --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x7ff300000001} --- getpid() = 2260021 write(3, "Process 2260021 (version 10.19.0.9) received signal 11: segmentation violation\n", 79) = 79

Your Environment

We can replicate the issue in several different environments (CentOS 7, RockyLinux 8) using PHP 8.1 .

@yuriysklyarenko yuriysklyarenko added the bug Something isn't working label Apr 8, 2024
@Khez
Copy link

Khez commented May 1, 2024

You can try going back to version 10.17.0.7 of the php agent (which does not use the php observable api)

There appears to be a problem in php core php/php-src#13817

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants