Commit 4ed28639519c ("fs, elf: drop MAP_FIXED usage from elf_map") is printing spurious messages under memory pressure due to map_addr == -ENOMEM. 9794 (a.out): Uhuuh, elf segment at 00007f2e34738000(fffffffffffffff4) requested but the memory is mapped already 14104 (a.out): Uhuuh, elf segment at 00007f34fd76c000(fffffffffffffff4) requested but the memory is mapped already 16843 (a.out): Uhuuh, elf segment at 00007f930ecc7000(fffffffffffffff4) requested but the memory is mapped already Complain only if -EEXIST, and use %px for printing the address.
Unified · Split
| @@ -377,10 +377,10 @@ static unsigned long elf_map(struct file *filep, unsigned long addr, · 376 unmodified lines | |||
| 377 | } else | 377 | } else |
| 378 | map_addr = vm_mmap(filep, addr, size, prot, type, off); | 378 | map_addr = vm_mmap(filep, addr, size, prot, type, off); |
| 379 | 379 | ||
| 380 | if ((type & MAP_FIXED_NOREPLACE) && BAD_ADDR(map_addr)) | 380 | if ((type & MAP_FIXED_NOREPLACE) && |
| 381 | pr_info("%d (%s): Uhuuh, elf segment at %p requested but the memory is mapped already\n", | 381 | PTR_ERR((void *)map_addr) == -EEXIST) |
| 382 | task_pid_nr(current), current->comm, | 382 | pr_info("%d (%s): Uhuuh, elf segment at %px requested but the memory is mapped already\n", |
| 383 | (void *)addr); | 383 | task_pid_nr(current), current->comm, (void *)addr); |
| 384 | 384 | ||
| 385 | return(map_addr); | 385 | return(map_addr); |
| 386 | } | 386 | } |