]> git.ipfire.org Git - thirdparty/rsync.git/commitdiff
log: align the file_struct built in log_delete()
authorAndrew Tridgell <andrew@tridgell.net>
Mon, 8 Jun 2026 10:29:40 +0000 (20:29 +1000)
committerAndrew Tridgell <andrew@tridgell.net>
Mon, 8 Jun 2026 10:54:57 +0000 (20:54 +1000)
log_delete() builds a struct file_struct inside a char buffer offset by the
(EXTRA_LEN-granular) extra data.  The EXTRA_ROUNDING block that rounds that
offset up to the struct's alignment (exactly as flist.c does for its pool
allocations) was dead code here: log.c never included rounding.h, so
EXTRA_ROUNDING was undefined and the rounding never ran, leaving the
file_struct pointer potentially under-aligned.  That trips UBSan's alignment
check and would fault on strict-alignment arches.

Include rounding.h (and add the Makefile dependency) so the existing rounding
actually applies -- fixing the alignment at the source rather than suppressing
the sanitizer.

Makefile.in
log.c

index 8e8b2ef4c475715e7d2516aac454066f3c0550dc..5216fb2f71990cf0d8de7e5df34fee95f294a2aa 100644 (file)
@@ -139,6 +139,7 @@ usage.o: version.h latest-year.h help-rsync.h help-rsyncd.h git-version.h defaul
 loadparm.o: default-dont-compress.h daemon-parm.h
 
 flist.o: rounding.h
+log.o: rounding.h
 
 default-cvsignore.h default-dont-compress.h: rsync.1.md define-from-md.awk
        $(AWK) -f $(srcdir)/define-from-md.awk -v hfile=$@ $(srcdir)/rsync.1.md
diff --git a/log.c b/log.c
index b948f16a1013d691408d72ed27241fef4fe31b63..5f1f3a29ca61151e2ab38ce7d29b42abb15fcad5 100644 (file)
--- a/log.c
+++ b/log.c
@@ -22,6 +22,7 @@
 #include "rsync.h"
 #include "itypes.h"
 #include "inums.h"
+#include "rounding.h"  /* EXTRA_ROUNDING, so log_delete() aligns its file_struct */
 
 extern int dry_run;
 extern int am_daemon;