hfsplus: use struct_group_attr() for memcpy() region
authorKees Cook <keescook@chromium.org>
Thu, 30 Dec 2021 09:29:12 +0000 (20:29 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Sun, 16 Jan 2022 07:39:38 +0000 (18:39 +1100)
commit3a367a8c50924b5eedbf38cab31e92f6258a6c69
treef427e5b16468bc8eba38ac61a76146a78a5b4569
parent2a3301e55bedc45237953245d8e1464fea556a2c
hfsplus: use struct_group_attr() for memcpy() region

In preparation for FORTIFY_SOURCE performing compile-time and run-time
field bounds checking for memset(), avoid intentionally writing across
neighboring fields.

Add struct_group() to mark the "info" region (containing struct DInfo and
struct DXInfo structs) in struct hfsplus_cat_folder and struct
hfsplus_cat_file that are written into directly, so the compiler can
correctly reason about the expected size of the writes.

"pahole" shows no size nor member offset changes to struct
hfsplus_cat_folder nor struct hfsplus_cat_file.  "objdump -d" shows no
object code changes.

Link: https://lkml.kernel.org/r/20211119192851.1046717-1-keescook@chromium.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
Cc: Zhen Lei <thunder.leizhen@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
fs/hfsplus/hfsplus_raw.h
fs/hfsplus/xattr.c