mirror of
git://git.openembedded.org/meta-openembedded
synced 2026-09-03 03:08:41 +00:00
Various security and bug fixes; adds support for the JIT compiler. * Fixed bug #81026 (PHP-FPM oob R/W in root process leading to privilege escalation) (CVE-2021-21703). https://www.php.net/ChangeLog-8.php#8.0.0 Signed-off-by: Claude Bing <cbing@cybernetics.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
242 lines
5.6 KiB
Diff
242 lines
5.6 KiB
Diff
From 8cabcf1043953a0fe48107204a2212609b8e6516 Mon Sep 17 00:00:00 2001
|
|
From: Claude Bing <cbing@cybernetics.com>
|
|
Date: Tue, 9 Nov 2021 12:59:15 -0500
|
|
Subject: [PATCH 01/11] ext/opcache/config.m4: enable opcache
|
|
|
|
We can't use AC_TRY_RUN to run programs in a cross compile
|
|
environment. Set the variables directly instead since we know
|
|
that we'd be running on latest enough linux kernel.
|
|
|
|
Upstream-Status: Inappropriate [Configuration]
|
|
|
|
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
|
|
|
|
update patch to version 7.4.4
|
|
Signed-off-by: Changqing Li <changqing.li@windriver.com>
|
|
|
|
update patch to version 8.0.12
|
|
fix issue linking with librt
|
|
Signed-off-by: Claude Bing <cbing@cybernetics.com>
|
|
---
|
|
ext/opcache/config.m4 | 197 ++----------------------------------------
|
|
1 file changed, 8 insertions(+), 189 deletions(-)
|
|
|
|
diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4
|
|
index 5492fd920c..95158ccfd9 100644
|
|
--- a/ext/opcache/config.m4
|
|
+++ b/ext/opcache/config.m4
|
|
@@ -101,202 +101,21 @@ if test "$PHP_OPCACHE" != "no"; then
|
|
AC_CHECK_FUNCS([mprotect])
|
|
|
|
AC_MSG_CHECKING(for sysvipc shared memory support)
|
|
- AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
|
-#include <sys/types.h>
|
|
-#include <sys/wait.h>
|
|
-#include <sys/ipc.h>
|
|
-#include <sys/shm.h>
|
|
-#include <unistd.h>
|
|
-#include <string.h>
|
|
-
|
|
-int main() {
|
|
- pid_t pid;
|
|
- int status;
|
|
- int ipc_id;
|
|
- char *shm;
|
|
- struct shmid_ds shmbuf;
|
|
-
|
|
- ipc_id = shmget(IPC_PRIVATE, 4096, (IPC_CREAT | SHM_R | SHM_W));
|
|
- if (ipc_id == -1) {
|
|
- return 1;
|
|
- }
|
|
-
|
|
- shm = shmat(ipc_id, NULL, 0);
|
|
- if (shm == (void *)-1) {
|
|
- shmctl(ipc_id, IPC_RMID, NULL);
|
|
- return 2;
|
|
- }
|
|
-
|
|
- if (shmctl(ipc_id, IPC_STAT, &shmbuf) != 0) {
|
|
- shmdt(shm);
|
|
- shmctl(ipc_id, IPC_RMID, NULL);
|
|
- return 3;
|
|
- }
|
|
-
|
|
- shmbuf.shm_perm.uid = getuid();
|
|
- shmbuf.shm_perm.gid = getgid();
|
|
- shmbuf.shm_perm.mode = 0600;
|
|
-
|
|
- if (shmctl(ipc_id, IPC_SET, &shmbuf) != 0) {
|
|
- shmdt(shm);
|
|
- shmctl(ipc_id, IPC_RMID, NULL);
|
|
- return 4;
|
|
- }
|
|
-
|
|
- shmctl(ipc_id, IPC_RMID, NULL);
|
|
-
|
|
- strcpy(shm, "hello");
|
|
-
|
|
- pid = fork();
|
|
- if (pid < 0) {
|
|
- return 5;
|
|
- } else if (pid == 0) {
|
|
- strcpy(shm, "bye");
|
|
- return 6;
|
|
- }
|
|
- if (wait(&status) != pid) {
|
|
- return 7;
|
|
- }
|
|
- if (!WIFEXITED(status) || WEXITSTATUS(status) != 6) {
|
|
- return 8;
|
|
- }
|
|
- if (strcmp(shm, "bye") != 0) {
|
|
- return 9;
|
|
- }
|
|
- return 0;
|
|
-}
|
|
-]])],[dnl
|
|
- AC_DEFINE(HAVE_SHM_IPC, 1, [Define if you have SysV IPC SHM support])
|
|
- have_shm_ipc=yes],[have_shm_ipc=no],[have_shm_ipc=no])
|
|
+ AC_DEFINE(HAVE_SHM_IPC, 1, [Define if you have SysV IPC SHM support])
|
|
+ have_shm_ipc=yes
|
|
AC_MSG_RESULT([$have_shm_ipc])
|
|
|
|
AC_MSG_CHECKING(for mmap() using MAP_ANON shared memory support)
|
|
- AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
|
-#include <sys/types.h>
|
|
-#include <sys/wait.h>
|
|
-#include <sys/mman.h>
|
|
-#include <unistd.h>
|
|
-#include <string.h>
|
|
-
|
|
-#ifndef MAP_ANON
|
|
-# ifdef MAP_ANONYMOUS
|
|
-# define MAP_ANON MAP_ANONYMOUS
|
|
-# endif
|
|
-#endif
|
|
-#ifndef MAP_FAILED
|
|
-# define MAP_FAILED ((void*)-1)
|
|
-#endif
|
|
-
|
|
-int main() {
|
|
- pid_t pid;
|
|
- int status;
|
|
- char *shm;
|
|
-
|
|
- shm = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
|
|
- if (shm == MAP_FAILED) {
|
|
- return 1;
|
|
- }
|
|
-
|
|
- strcpy(shm, "hello");
|
|
-
|
|
- pid = fork();
|
|
- if (pid < 0) {
|
|
- return 5;
|
|
- } else if (pid == 0) {
|
|
- strcpy(shm, "bye");
|
|
- return 6;
|
|
- }
|
|
- if (wait(&status) != pid) {
|
|
- return 7;
|
|
- }
|
|
- if (!WIFEXITED(status) || WEXITSTATUS(status) != 6) {
|
|
- return 8;
|
|
- }
|
|
- if (strcmp(shm, "bye") != 0) {
|
|
- return 9;
|
|
- }
|
|
- return 0;
|
|
-}
|
|
-]])],[dnl
|
|
- AC_DEFINE(HAVE_SHM_MMAP_ANON, 1, [Define if you have mmap(MAP_ANON) SHM support])
|
|
- have_shm_mmap_anon=yes],[have_shm_mmap_anon=no],[have_shm_mmap_anon=no])
|
|
+ AC_DEFINE(HAVE_SHM_MMAP_ANON, 1, [Define if you have mmap(MAP_ANON) SHM support])
|
|
+ have_shm_mmap_anon=yes
|
|
AC_MSG_RESULT([$have_shm_mmap_anon])
|
|
|
|
PHP_CHECK_FUNC_LIB(shm_open, rt, root)
|
|
AC_MSG_CHECKING(for mmap() using shm_open() shared memory support)
|
|
- AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
|
-#include <sys/types.h>
|
|
-#include <sys/wait.h>
|
|
-#include <sys/mman.h>
|
|
-#include <sys/stat.h>
|
|
-#include <fcntl.h>
|
|
-#include <unistd.h>
|
|
-#include <string.h>
|
|
-#include <stdlib.h>
|
|
-#include <stdio.h>
|
|
-
|
|
-#ifndef MAP_FAILED
|
|
-# define MAP_FAILED ((void*)-1)
|
|
-#endif
|
|
-
|
|
-int main() {
|
|
- pid_t pid;
|
|
- int status;
|
|
- int fd;
|
|
- char *shm;
|
|
- char tmpname[4096];
|
|
-
|
|
- sprintf(tmpname,"/opcache.test.shm.%dXXXXXX", getpid());
|
|
- if (mktemp(tmpname) == NULL) {
|
|
- return 1;
|
|
- }
|
|
- fd = shm_open(tmpname, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
|
|
- if (fd == -1) {
|
|
- return 2;
|
|
- }
|
|
- if (ftruncate(fd, 4096) < 0) {
|
|
- close(fd);
|
|
- shm_unlink(tmpname);
|
|
- return 3;
|
|
- }
|
|
-
|
|
- shm = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
|
- if (shm == MAP_FAILED) {
|
|
- return 4;
|
|
- }
|
|
- shm_unlink(tmpname);
|
|
- close(fd);
|
|
-
|
|
- strcpy(shm, "hello");
|
|
-
|
|
- pid = fork();
|
|
- if (pid < 0) {
|
|
- return 5;
|
|
- } else if (pid == 0) {
|
|
- strcpy(shm, "bye");
|
|
- return 6;
|
|
- }
|
|
- if (wait(&status) != pid) {
|
|
- return 7;
|
|
- }
|
|
- if (!WIFEXITED(status) || WEXITSTATUS(status) != 6) {
|
|
- return 8;
|
|
- }
|
|
- if (strcmp(shm, "bye") != 0) {
|
|
- return 9;
|
|
- }
|
|
- return 0;
|
|
-}
|
|
-]])],[dnl
|
|
- AC_DEFINE(HAVE_SHM_MMAP_POSIX, 1, [Define if you have POSIX mmap() SHM support])
|
|
- AC_MSG_RESULT([yes])
|
|
- have_shm_mmap_posix=yes
|
|
- PHP_CHECK_LIBRARY(rt, shm_unlink, [PHP_ADD_LIBRARY(rt,1,OPCACHE_SHARED_LIBADD)])
|
|
- ],[
|
|
- AC_MSG_RESULT([no])
|
|
- ],[
|
|
- AC_MSG_RESULT([no])
|
|
- ])
|
|
+ AC_DEFINE(HAVE_SHM_MMAP_POSIX, 1, [Define if you have POSIX mmap() SHM support])
|
|
+ AC_MSG_RESULT([yes])
|
|
+ have_shm_mmap_posix=yes
|
|
+ PHP_CHECK_LIBRARY(rt, shm_unlink, [PHP_ADD_LIBRARY(rt,1,OPCACHE_SHARED_LIBADD)])
|
|
|
|
PHP_NEW_EXTENSION(opcache,
|
|
ZendAccelerator.c \
|
|
--
|
|
2.25.1
|
|
|