For performance reasons eventpoll_init() currently checks that the size of struct epitem is kept under 128 bytes. It avoids making this check for 128-bit and larger systems, as on those systems struct epitem would be above 128 bytes in size.
On a CONFIG_CHERI_PURECAP_UABI kernel on a CHERI system, 'long' and 'void *' remain 64-bit but 'void __user *' is 128-bit which causes struct epitem to go over 128 bytes in size. Relax the check for such systems as well.
Signed-off-by: Kristina Martsenko kristina.martsenko@arm.com --- fs/eventpoll.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/eventpoll.c b/fs/eventpoll.c index e2daa940ebce..e5c9a29f0da1 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -2376,7 +2376,8 @@ static int __init eventpoll_init(void) * We can have many thousands of epitems, so prevent this from * using an extra cache line on 64-bit (and smaller) CPUs */ - BUILD_BUG_ON(sizeof(void *) <= 8 && sizeof(struct epitem) > 128); + if (sizeof(void *) <= 8 && sizeof(void __user *) <= 8) + BUILD_BUG_ON(sizeof(struct epitem) > 128);
/* Allocates slab cache used to allocate "struct epitem" items */ epi_cache = kmem_cache_create("eventpoll_epi", sizeof(struct epitem),