From: Andrew Tridgell Date: Mon, 8 Jun 2026 10:29:40 +0000 (+1000) Subject: log: align the file_struct built in log_delete() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=497357800aff64414790bc936b952a8fb94b4e63;p=thirdparty%2Frsync.git log: align the file_struct built in log_delete() 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. --- diff --git a/Makefile.in b/Makefile.in index 8e8b2ef4..5216fb2f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -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 b948f16a..5f1f3a29 100644 --- 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;