]> git.saurik.com Git - apple/xnu.git/blobdiff - san/kasan_dynamic_blacklist.c
xnu-4903.270.47.tar.gz
[apple/xnu.git] / san / kasan_dynamic_blacklist.c
index f4ad0fa059969246e6e6cf9c8313ba3248524a78..04d0973dca80b5564321d5eeaeb2d216743af241 100644 (file)
@@ -43,7 +43,7 @@ static void
 dybl_lock(boolean_t *b)
 {
        *b = ml_set_interrupts_enabled(false);
-       simple_lock(&_dybl_lock);
+       simple_lock(&_dybl_lock, LCK_GRP_NULL);
 }
 
 static void
@@ -314,7 +314,6 @@ addr_to_func(uintptr_t addr, const kernel_mach_header_t *mh)
         * iterate the symbols, looking for the closest one to `addr'
         */
        for (i = 0; i < (int)st->nsyms; i++) {
-
                uint8_t n_type = syms[i].n_type;
                const char *name = strings + syms[i].n_un.n_strx;
 
@@ -350,7 +349,7 @@ addr_to_func(uintptr_t addr, const kernel_mach_header_t *mh)
        return cur_name;
 }
 
-bool __attribute__((noinline))
+bool OS_NOINLINE
 kasan_is_blacklisted(access_t type)
 {
        uint32_t nframes = 0;
@@ -390,7 +389,7 @@ kasan_is_blacklisted(access_t type)
                        blhe->count++;
                        blhe->ble->count++;
                        // printf("KASan: blacklist cache hit (%s:%s [0x%lx] 0x%x)\n",
-                       //              ble->kext_name ?: "" , ble->func_name ?: "", VM_KERNEL_UNSLIDE(bt[i]), mask);
+                       //              ble->kext_name ?: "" , ble->func_name ?: "", VM_KERNEL_UNSLIDE(bt[i]), mask);
                        dybl_unlock(flag);
                        return true;
                }
@@ -398,7 +397,6 @@ kasan_is_blacklisted(access_t type)
 
        /* no hits - slowpath */
        for (uint32_t i = 0; i < nframes; i++) {
-
                const char *kextname = NULL;
                const char *funcname = NULL;
 
@@ -452,7 +450,7 @@ kasan_is_blacklisted(access_t type)
 
                        if (count == 0) {
                                printf("KASan: ignoring blacklisted violation (%s:%s [0x%lx] %d 0x%x)\n",
-                                               kextname, funcname, VM_KERNEL_UNSLIDE(bt[i]), i, type);
+                                   kextname, funcname, VM_KERNEL_UNSLIDE(bt[i]), i, type);
                        }
 
                        return true;
@@ -525,9 +523,9 @@ static const struct {
 
        /* convenience aliases */
        { .type = TYPE_POISON_GLOBAL, .str = "GLOB" },
-       { .type = TYPE_POISON_HEAP,   .str = "HEAP" },
+       { .type = TYPE_POISON_HEAP, .str = "HEAP" },
 };
-static size_t typemap_sz = sizeof(typemap)/sizeof(typemap[0]);
+static size_t typemap_sz = sizeof(typemap) / sizeof(typemap[0]);
 
 static inline access_t
 map_type(const char *str)