Skip to content

Commit

Permalink
Import the CheriBSD patch
Browse files Browse the repository at this point in the history
  • Loading branch information
kwitaszczyk committed Aug 11, 2023
1 parent b05bbcd commit 8efb1ec
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/EGL/libegl.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
#include <unistd.h>
#include <sys/mman.h>

#ifdef __CHERI_PURE_CAPABILITY__
#include <cheri/cheric.h>
#endif

#if defined(ENABLE_EGL_X11)
#include <X11/Xlib.h>
#endif
Expand Down Expand Up @@ -145,7 +149,12 @@ static EGLBoolean _eglPointerIsDereferencable(void *p)
* depending on what system we're building on. Since we don't actually need
* that result, just cast it to a void* so that it works either way.
*/
#ifdef __CHERI_PURE_CAPABILITY__
return (mincore((void *) p, cheri_getlength(p), (void *) &unused) >= 0);
#else
return (mincore((void *) addr, page_size, (void *) &unused) >= 0);
#endif

#else
return EGL_FALSE;
#endif
Expand Down

0 comments on commit 8efb1ec

Please sign in to comment.