From 0650a4ee30e34ba039940032fdff3719c1b4b000 Mon Sep 17 00:00:00 2001
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date: Sun, 20 Dec 2020 01:41:55 +0100
Subject: vm_map: Fix taking into account high bits in mask

glibc's sysdeps/mach/hurd/dl-sysdep.c has been wanting to use this for
decades.

* include/string.h (ffs): New declaration.
* vm/vm_map.c: Include <string.h>.
(vm_map_find_entry_anywhere): Separate out high bits from mask, to
compute the maximum offset instead of map->max_offset.
* doc/mach.texi (vm_map): Update documentation accordingly.
---
 include/string.h | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'include')

diff --git a/include/string.h b/include/string.h
index c31b4292..cddcbeb9 100644
--- a/include/string.h
+++ b/include/string.h
@@ -54,4 +54,6 @@ extern size_t strlen (const char *s) __attribute__ ((pure));
 
 extern char *strstr(const char *haystack, const char *needle);
 
+extern int ffs(int i);
+
 #endif /* _MACH_SA_SYS_STRING_H_ */
-- 
cgit v1.2.3