]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] Use 16K map cache header for mmap alignment on ARM64
authorVsevolod Stakhov <vsevolod@rspamd.com>
Wed, 25 Feb 2026 14:59:53 +0000 (14:59 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Wed, 25 Feb 2026 14:59:53 +0000 (14:59 +0000)
Apple Silicon requires mmap offsets to be 16K-aligned (page size is
16384, not 4096). Bump RSPAMD_MAP_CACHE_HEADER_SIZE to 16384 to work
on all common architectures.

src/libserver/maps/map_private.h

index 47ef3951717f38b52e8686679393eb03eb533684..72a42870a17a27dfda02c96f27d747ff65199af0 100644 (file)
@@ -240,8 +240,10 @@ static const char rspamd_http_file_magic[] =
  * so no_file_read consumers can mmap the file at that fixed offset.
  * Etag (variable-length) is stored within the header page after the
  * fixed fields; max etag length is RSPAMD_MAP_CACHE_HEADER_SIZE - sizeof(this struct).
+ * Size is 16K to satisfy mmap alignment on all common architectures
+ * (4K on x86_64, 16K on Apple Silicon aarch64).
  */
-#define RSPAMD_MAP_CACHE_HEADER_SIZE 4096
+#define RSPAMD_MAP_CACHE_HEADER_SIZE 16384
 
 struct rspamd_http_file_data {
        unsigned char magic[sizeof(rspamd_http_file_magic)];