Skip to content

Commit

Permalink
Workaround 'unexpected bus error at 0' abort on Serenity OS
Browse files Browse the repository at this point in the history
(fix of commit b48ee2b)

PR #689 (bdwgc).

For an unknown reason, enabling of incremental mode based on `mprotect`
causes a null pointer dereference in `GC_finish_collection()`.

This patch removes `define MPROTECT_VDB` for Serenity OS.

* include/private/gcconfig.h [SERENITY] (MPROTECT_VDB): Do not define.
* os_dep.c [MPROTECT_VDB && !DARWIN && !MSWIN32 && !MSWINCE
&& SERENITY] (CODE_OK): Likewise.
* os_dep.c [MPROTECT_VDB && !DARWIN && !USE_WINALLOC && !AIX
&& !CYGWIN32 && !HAIKU]: Include `sys/syscall.h` regardless of
`SERENITY`.
  • Loading branch information
linusg authored and ivmai committed Dec 15, 2024
1 parent 86d2983 commit 21dc24a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion include/private/gcconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,7 @@ extern int etext[], _end[];
# define DATASTART PTR_ALIGN_UP((ptr_t)etext, 0x1000)
# define DATAEND ((ptr_t)_end)
# define DYNAMIC_LOADING
# define MPROTECT_VDB
/* TODO: enable mprotect-based VDB */
# define USE_MMAP_ANON
#endif /* SERENITY */

Expand Down
6 changes: 2 additions & 4 deletions os_dep.c
Original file line number Diff line number Diff line change
Expand Up @@ -3259,8 +3259,7 @@ STATIC mach_port_t GC_task_self = 0;

# elif !defined(USE_WINALLOC)
# include <sys/mman.h>
# if !defined(AIX) && !defined(CYGWIN32) && !defined(HAIKU) \
&& !defined(SERENITY)
# if !defined(AIX) && !defined(CYGWIN32) && !defined(HAIKU)
# include <sys/syscall.h>
# endif

Expand Down Expand Up @@ -3377,8 +3376,7 @@ is_header_found_async(const void *p)
# elif defined(IRIX5)
# define CODE_OK (si->si_code == EACCES)
# elif defined(AIX) || defined(COSMO) || defined(CYGWIN32) \
|| defined(HAIKU) || defined(HURD) || defined(LINUX) \
|| defined(SERENITY)
|| defined(HAIKU) || defined(HURD) || defined(LINUX)
/* Linux: Empirically c.trapno == 14, on IA32, but is that useful? */
/* Should probably consider alignment issues on other architectures. */
# define CODE_OK TRUE
Expand Down

0 comments on commit 21dc24a

Please sign in to comment.