Skip to content

Commit 9ad8fad

Browse files
linericyangnikic
authored andcommitted
Fix bug #81472: Support large device major/minor number
Latest linux kernel use large number (12 bits for major device, 20 bits for minor device). Current code only supports previous standard (5 chars), which means 8 bits for major and 8 bits for minor device. It will fail if device number is out of that range. So this patch increases device number read from /proc/self/maps file. Closes GH-7512.
1 parent c0dcd14 commit 9ad8fad

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ PHP NEWS
2121
. Fixed bug #61700 (FILTER_FLAG_IPV6/FILTER_FLAG_NO_PRIV|RES_RANGE failing).
2222
(cmb, Nikita)
2323

24+
- Opcache:
25+
. Fixed bug #81472 (Cannot support large linux major/minor device number when
26+
read /proc/self/maps). (Lin Yang)
27+
2428
- PCRE:
2529
. Fixed bug #81424 (PCRE2 10.35 JIT performance regression). (cmb)
2630

ext/opcache/ZendAccelerator.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2803,11 +2803,11 @@ static void accel_move_code_to_huge_pages(void)
28032803
f = fopen("/proc/self/maps", "r");
28042804
if (f) {
28052805
long unsigned int start, end, offset, inode;
2806-
char perm[5], dev[6], name[MAXPATHLEN];
2806+
char perm[5], dev[10], name[MAXPATHLEN];
28072807
int ret;
28082808

28092809
while (1) {
2810-
ret = fscanf(f, "%lx-%lx %4s %lx %5s %ld %s\n", &start, &end, perm, &offset, dev, &inode, name);
2810+
ret = fscanf(f, "%lx-%lx %4s %lx %9s %ld %s\n", &start, &end, perm, &offset, dev, &inode, name);
28112811
if (ret == 7) {
28122812
if (perm[0] == 'r' && perm[1] == '-' && perm[2] == 'x' && name[0] == '/') {
28132813
long unsigned int seg_start = ZEND_MM_ALIGNED_SIZE_EX(start, huge_page_size);

0 commit comments

Comments
 (0)