[libc-commits] [libc] [libc] Leave mmap offsets with the top bit set to the kernel (PR #239985)

Pavel Labath via libc-commits libc-commits at lists.llvm.org
Wed Nov 11 03:57:13 PST 2026


================
@@ -34,6 +34,9 @@ LIBC_INLINE ErrorOr<void *> mmap(void *addr, size_t size, int prot, int flags,
   offset /= MMAP2_FACTOR;
   long syscall_number = SYS_mmap2;
 #elif defined(SYS_mmap)
+  // The kernel takes the offset as unsigned, and drivers use the top bits to
+  // say what a mapping is: KFD's doorbells are at 0xebff000000000000. Leave
----------------
labath wrote:

I'm not sure how many people know what's a KFD doorbell (I didn't). It might be enough to say that some drivers (block devices?) expect to be able to map large (unsigned) offsets

https://github.com/llvm/llvm-project/pull/239985


More information about the libc-commits mailing list