On Tue, Jun 04, 2024 at 09:22:51AM +0800, Hongbo Li wrote: > I found the following issue on: > > HEAD commit: 587f7f5a4765a76f9ea05159963d14f8967cb45b(cmd_list_journal: open > with noexcl, so we can work on mounted filesystems) > > git tree: master > git repo: https://github.com/koverstreet/bcachefs-tools.git > util-linux: 2.37.2 > > IMPORTANT: If someone fix this issue, please kindly add the following tag to > the commit: > > Reported-by: Hongbo Li <[email protected]> > > [Tue Jun 4 09:16:44 2024] bcachefs (loop1): mounting version 1.9: > disk_accounting_v2 > [Tue Jun 4 09:16:44 2024] bcachefs (loop1): initializing new filesystem > [Tue Jun 4 09:16:44 2024] bcachefs (loop1): going read-write > [Tue Jun 4 09:16:44 2024] bcachefs (loop1): marking superblocks > [Tue Jun 4 09:16:44 2024] ------------[ cut here ]------------ > [Tue Jun 4 09:16:44 2024] memcpy: detected field-spanning write (size 4) of > single field "r" at fs/bcachefs/disk_accounting.c:185 (size 3) > [Tue Jun 4 09:16:44 2024] WARNING: CPU: 6 PID: 11 at
Thanks, this just needs an unsafe_memcpy() annotation commit 1c39379a4cddbf8d68c588ac9df7149840b9e4ff Author: Kent Overstreet <[email protected]> Date: Mon Jun 3 22:01:25 2024 -0400 fixup! bcachefs: Disk space accounting rewrite diff --git a/fs/bcachefs/disk_accounting.c b/fs/bcachefs/disk_accounting.c index 48d68db286a3..f118d5614e3a 100644 --- a/fs/bcachefs/disk_accounting.c +++ b/fs/bcachefs/disk_accounting.c @@ -182,7 +182,9 @@ static inline bool accounting_to_replicas(struct bch_replicas_entry_v1 *r, struc switch (acc_k.type) { case BCH_DISK_ACCOUNTING_replicas: - memcpy(r, &acc_k.replicas, replicas_entry_bytes(&acc_k.replicas)); + unsafe_memcpy(r, &acc_k.replicas, + replicas_entry_bytes(&acc_k.replicas), + "variable length struct"); return true; default: return false;
