Fanotify Patch

Blair Barnett posted 1 patch 4 years, 4 months ago
fs/notify/fanotify/fanotify_user.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Fanotify Patch
Posted by Blair Barnett 4 years, 4 months ago
From d358cbc008ebfe2aed50256074e97209bdf035f8 Mon Sep 17 00:00:00 2001
From: Blair Barnett <bbarnett@tachyum.com>
Date: Sun, 6 Feb 2022 21:03:31 -0800
Subject: [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.

I am not subscribed to this mailing list so please include
bbarnett@tachyum.com 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