[PATCH] Since struct fanotify_event_metadata contains an element "mask" that is aligned on __aligned_u64, it's best to align the structure on this size, rather than the current 4B.

From: Blair Barnett
Date: Mon Feb 07 2022 - 00:03:31 EST


I am not subscribed to this mailing list so please include
bbarnett@xxxxxxxxxxx as
a CC in the replies.

This fix resolves an unaligned access fault in many of the
fanotify LTP tests on the Tachyum processor
---
fs/notify/fanotify/fanotify_user.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/notify/fanotify/fanotify_user.c
b/fs/notify/fanotify/fanotify_user.c
index 6facdf476255..f028332738c5 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -109,7 +109,7 @@ struct kmem_cache *fanotify_fid_event_cachep __read_mostly;
struct kmem_cache *fanotify_path_event_cachep __read_mostly;
struct kmem_cache *fanotify_perm_event_cachep __read_mostly;

-#define FANOTIFY_EVENT_ALIGN 4
+#define FANOTIFY_EVENT_ALIGN sizeof(__aligned_u64)
#define FANOTIFY_FID_INFO_HDR_LEN \
(sizeof(struct fanotify_event_info_fid) + sizeof(struct file_handle))
#define FANOTIFY_PIDFD_INFO_HDR_LEN \
--
2.33.0