Open ajhconway opened 3 years ago
Debugging further, the problem is :
Breakpoint 2, rc_allocator_init (al=0x7fffffffe1c8, cfg=0x7fffffffe478, io=0x55555559f200, hid=0x0, mid=0x0) at src/rc_allocator.c:356
356 rc = platform_buffer_init(&al->bh, buffer_size);
363 al->ref_count = platform_buffer_getaddr(&al->bh);
(gdb)
364 memset(al->ref_count, 0, buffer_size);
On L363, al->ref_count
is set to al->bh->addr
, but memset()
on L364 runs into a signal as the address mapped is bogus.
When the mmap inside platform_buffer_create fails, the check against MAP_FAILED doesn't trigger.
Checked on Ubuntu 20 LTS in a VM with clang 10 with huge pages enabled but not supported.
Updated: 10.Jan.2023: (agurajada)
Under PR #508,
platform_buffer_create()
is being renamed toplatform_buffer_init()
.The repro for this issue is as follows: On a Nimbus-VM (where probably Linux huge-pages is not supported / enabled), if you run this test, you will get a signal, with the stack shown below:
With debug binary (with code from above-mentioned PR), the stack looks like so:
The problem seems to be that call to:
seems to succeed, but
bh->addr
is bogus / inaccessible.On this test Nimbus-VM, huge-pages is not enabled:
mmap()
man pages https://man7.org/linux/man-pages/man2/mmap.2.html has no further information on error return status. On debugging,errno
is still 0 after this errantmmap()
call.So programmatically, we don't have enough info to check that the
mmap()
call has failed. Maybe one option is to check if the system has huge-pages configured & enabled, but I could not find a programatic way of probing from that using a system call. (Need to look into sysctl etc ...)