php / php/php-src

opcache/zend_shared_alloc.c: needed but ineffective pre-processor instructions

Đang mở
#16,567 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Bug Extension: opcache Status: Verified
Ngôn ngữ chính
C
Star
40.4k
Fork
8.1k
Merge trung bình
2 ngày 13 giờ
Pull request đã merge (30 ngày)
96

Mô tả

Description

_GNU_SOURCE enabled sys/mman.h is needed for memfd_create and MFD_CLOEXEC, yet the needed pre-processor instructions at the top of zend_shared_alloc.c are useless since they are wrapped with ifdef HAVE_MEMFD_CREATE, which is defined in a *config.h not yet included.

See https://github.com/php/php-src/blob/master/ext/opcache/zend_shared_alloc.c#L22-L27

As a consequence, the build failed for me on Ubuntu-24.04 with GCC-13.

'./configure' \
'--disable-all' \
'--enable-debug' \
'--enable-cli' \
'--enable-opcache' 
make -j
/bin/bash /home/mike/src/php-src/libtool --silent --preserve-dup-deps --tag=CC --mode=compile cc -Iext/opcache/ -I/home/mike/src/php-src/ext/opcache/ -I/home/mike/src/php-src/main -I/home/mike/src/php-src -I/home/mike/src/php-src/ext/date/lib -I/home/mike/src/php-src/ext/raphf/src -I/home/mike/src/php-src/ext/raphf -I/home/mike/src/php-src/ext/http/src -I/home/mike/src/php-src/TSRM -I/home/mike/src/php-src/Zend    -fno-common -Wstrict-prototypes -Wformat-truncation -Wlogical-op -Wduplicated-cond -Wno-clobbered -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -g -ffp-contract=off -fvisibility=hidden -O0 -Wno-strict-prototypes -Wimplicit-fallthrough=1 -DZEND_SIGNALS    -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -Iext/opcache/jit/ir -DIR_TARGET_X64 -DIR_PHP -DIR_DEBUG -DZEND_COMPILE_DL_EXT=1 -c /home/mike/src/php-src/ext/opcache/zend_shared_alloc.c -o ext/opcache/zend_shared_alloc.lo  -MMD -MF ext/opcache/zend_shared_alloc.dep -MT ext/opcache/zend_shared_alloc.lo
In file included from /home/mike/src/php-src/Zend/zend.h:454,
                 from /home/mike/src/php-src/Zend/zend_objects.h:23,
                 from /home/mike/src/php-src/Zend/zend_globals.h:35,
                 from /home/mike/src/php-src/Zend/zend_compile.h:843,
                 from /home/mike/src/php-src/Zend/zend_extensions.h:23,
                 from /home/mike/src/php-src/ext/opcache/ZendAccelerator.h:51,
                 from /home/mike/src/php-src/ext/opcache/zend_shared_alloc.c:30:
/home/mike/src/php-src/Zend/zend_operators.h: In function ‘zend_memrchr’:
/home/mike/src/php-src/Zend/zend_operators.h:221:29: warning: implicit declaration of function ‘memrchr’; did you mean ‘memchr’? [-Wimplicit-function-declaration]
  221 |         return (const void*)memrchr(s, c, n);
      |                             ^~~~~~~
      |                             memchr
/home/mike/src/php-src/Zend/zend_operators.h:221:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  221 |         return (const void*)memrchr(s, c, n);
      |                ^
/home/mike/src/php-src/ext/opcache/zend_shared_alloc.c: In function ‘zend_shared_alloc_create_lock’:
/home/mike/src/php-src/ext/opcache/zend_shared_alloc.c:98:21: warning: implicit declaration of function ‘memfd_create’; did you mean ‘timer_create’? [-Wimplicit-function-declaration]
   98 |         lock_file = memfd_create("opcache_lock", MFD_CLOEXEC);
      |                     ^~~~~~~~~~~~
      |                     timer_create
/home/mike/src/php-src/ext/opcache/zend_shared_alloc.c:98:50: error: ‘MFD_CLOEXEC’ undeclared (first use in this function); did you mean ‘FD_CLOEXEC’?
   98 |         lock_file = memfd_create("opcache_lock", MFD_CLOEXEC);
      |                                                  ^~~~~~~~~~~
      |                                                  FD_CLOEXEC
/home/mike/src/php-src/ext/opcache/zend_shared_alloc.c:98:50: note: each undeclared identifier is reported only once for each function it appears in
make: *** [Makefile:794: ext/opcache/zend_shared_alloc.lo] Error 1
PHP Version

master

Operating System

Ubuntu 24.04

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Tệp bị ảnh hưởng là ext/opcache/zend_shared_alloc.c, với khối tiền xử lý gần các dòng 22-27. Hãy tái hiện bằng các tùy chọn configure đã được báo cáo và make -j trên Ubuntu 24.04, sau đó xác nhận rằng bản build opcache hoàn tất mà không có các lỗi memfd_create/MFD_CLOEXEC.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
c, php
Lĩnh vực
build-system
Loại issue
Lỗi
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
55/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.