mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 18:59:33 +03:00
Fix build with KASAN
The stock zstd code expects some helpers from ASAN if present. This works fine in userland, but in kernel, KASAN also gets detected, and lacks those helpers. So let's make some empty substitutes for that case. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Rich Ercolani <rincebrain@gmail.com> Closes #12232
This commit is contained in:
parent
5e2c8338bf
commit
2084e9f748
@ -202,6 +202,25 @@ static struct zstd_fallback_mem zstd_dctx_fallback;
|
|||||||
static struct zstd_pool *zstd_mempool_cctx;
|
static struct zstd_pool *zstd_mempool_cctx;
|
||||||
static struct zstd_pool *zstd_mempool_dctx;
|
static struct zstd_pool *zstd_mempool_dctx;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The library zstd code expects these if ADDRESS_SANITIZER gets defined,
|
||||||
|
* and while ASAN does this, KASAN defines that and does not. So to avoid
|
||||||
|
* changing the external code, we do this.
|
||||||
|
*/
|
||||||
|
#if defined(__has_feature)
|
||||||
|
#if __has_feature(address_sanitizer)
|
||||||
|
#define ADDRESS_SANITIZER 1
|
||||||
|
#endif
|
||||||
|
#elif defined(__SANITIZE_ADDRESS__)
|
||||||
|
#define ADDRESS_SANITIZER 1
|
||||||
|
#endif
|
||||||
|
#if defined(_KERNEL) && defined(ADDRESS_SANITIZER)
|
||||||
|
void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
|
||||||
|
void __asan_poison_memory_region(void const volatile *addr, size_t size);
|
||||||
|
void __asan_unpoison_memory_region(void const volatile *addr, size_t size) {};
|
||||||
|
void __asan_poison_memory_region(void const volatile *addr, size_t size) {};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
zstd_mempool_reap(struct zstd_pool *zstd_mempool)
|
zstd_mempool_reap(struct zstd_pool *zstd_mempool)
|
||||||
|
Loading…
Reference in New Issue
Block a user