github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/docs/darwin/0001-fuzzing.patch (about)

     1  From 5ae86092cc5b4306a2145c56085e07f2eb5ddbe6 Mon Sep 17 00:00:00 2001
     2  From: Patrick Meyer <git@the-space.agency>
     3  Date: Wed, 1 Sep 2021 14:26:36 -0700
     4  Subject: [PATCH] fuzzing
     5  
     6  ---
     7   makedefs/MakeInc.def     | 8 +++++++-
     8   osfmk/i386/cpu_threads.c | 1 +
     9   osfmk/i386/cpuid.c       | 4 +++-
    10   san/kasan.c              | 1 +
    11   san/ksancov.h            | 4 ++--
    12   5 files changed, 14 insertions(+), 4 deletions(-)
    13  
    14  diff --git a/makedefs/MakeInc.def b/makedefs/MakeInc.def
    15  index bf2b6f8..dd509fa 100644
    16  --- a/makedefs/MakeInc.def
    17  +++ b/makedefs/MakeInc.def
    18  @@ -175,7 +175,13 @@ WARNFLAGS_STD := \
    19   	-Wno-used-but-marked-unused \
    20   	-Wno-variadic-macros \
    21   	-Wno-vla \
    22  -	-Wno-zero-length-array
    23  +	-Wno-zero-length-array \
    24  +	-Wno-void-pointer-to-int-cast \
    25  +	-Wno-pointer-to-int-cast \
    26  +	-Wno-suggest-override \
    27  +	-Wno-suggest-destructor-override \
    28  +	-Wno-unreachable-code
    29  +	# ^ last one is required for qemu hacks
    30   
    31   # When a new clang has new warnings disable them here until the kernel is fixed.
    32   WARNFLAGS_STD := $(WARNFLAGS_STD) \
    33  diff --git a/osfmk/i386/cpu_threads.c b/osfmk/i386/cpu_threads.c
    34  index f9317b1..2e705ff 100644
    35  --- a/osfmk/i386/cpu_threads.c
    36  +++ b/osfmk/i386/cpu_threads.c
    37  @@ -1019,6 +1019,7 @@ cpu_thread_halt(void)
    38   void
    39   x86_validate_topology(void)
    40   {
    41  +	return;
    42   	x86_pkg_t           *pkg;
    43   	x86_die_t           *die;
    44   	x86_core_t          *core;
    45  diff --git a/osfmk/i386/cpuid.c b/osfmk/i386/cpuid.c
    46  index 90844be..e0ceea4 100644
    47  --- a/osfmk/i386/cpuid.c
    48  +++ b/osfmk/i386/cpuid.c
    49  @@ -861,7 +861,9 @@ cpuid_set_generic_info(i386_cpu_info_t *info_p)
    50   static uint32_t
    51   cpuid_set_cpufamily(i386_cpu_info_t *info_p)
    52   {
    53  -	uint32_t cpufamily = CPUFAMILY_UNKNOWN;
    54  +	uint32_t cpufamily = CPUFAMILY_INTEL_PENRYN;
    55  +	info_p->cpuid_cpufamily = cpufamily;
    56  +	return cpufamily;
    57   
    58   	switch (info_p->cpuid_family) {
    59   	case 6:
    60  diff --git a/san/kasan.c b/san/kasan.c
    61  index 004393d..e0fde9a 100644
    62  --- a/san/kasan.c
    63  +++ b/san/kasan.c
    64  @@ -1467,6 +1467,7 @@ UNUSED_ABI(__asan_version_mismatch_check_apple_1000, void);
    65   UNUSED_ABI(__asan_version_mismatch_check_apple_1001, void);
    66   UNUSED_ABI(__asan_version_mismatch_check_apple_clang_1100, void);
    67   UNUSED_ABI(__asan_version_mismatch_check_apple_clang_1200, void);
    68  +UNUSED_ABI(__asan_version_mismatch_check_apple_clang_1205, void);
    69   
    70   void OS_NORETURN UNSUPPORTED_API(__asan_init_v5, void);
    71   void OS_NORETURN UNSUPPORTED_API(__asan_register_globals, uptr a, uptr b);
    72  diff --git a/san/ksancov.h b/san/ksancov.h
    73  index d2a836b..7659e66 100644
    74  --- a/san/ksancov.h
    75  +++ b/san/ksancov.h
    76  @@ -180,7 +180,7 @@ ksancov_map(int fd, uintptr_t *buf, size_t *sz)
    77   		*sz = mc.sz;
    78   	}
    79   
    80  -	struct ksancov_trace *trace = (void *)mc.ptr;
    81  +	struct ksancov_trace *trace = (ksancov_trace *)mc.ptr;
    82   	assert(trace->magic == KSANCOV_TRACE_MAGIC ||
    83   	    trace->magic == KSANCOV_COUNTERS_MAGIC);
    84   
    85  @@ -203,7 +203,7 @@ ksancov_map_edgemap(int fd, uintptr_t *buf, size_t *sz)
    86   		*sz = mc.sz;
    87   	}
    88   
    89  -	struct ksancov_trace *trace = (void *)mc.ptr;
    90  +	struct ksancov_trace *trace = (ksancov_trace *)mc.ptr;
    91   	assert(trace->magic == KSANCOV_EDGEMAP_MAGIC);
    92   
    93   	return 0;
    94  -- 
    95  2.30.1 (Apple Git-130)
    96