lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1282682582-15980-1-git-send-email-eparis@redhat.com>
Date:	Tue, 24 Aug 2010 16:43:02 -0400
From:	Eric Paris <eparis@...hat.com>
To:	linux-kernel@...r.kernel.org
Cc:	Eric Paris <eparis@...hat.com>, Andreas Schwab <schwab@...hat.com>,
	Tvrtko Ursulin <tvrtko.ursulin@...hos.com>,
	Andreas Gruenbacher <agruen@...e.de>
Subject: [PATCH -v2] fanotify: drops the packed attribute from userspace event metadata

The userspace event metadata structure was packed so when sent from a kernel
with a certain set of alignment rules to a userspace listener with a different
set of alignment rules the userspace process would be able to use the
structure.  On some arches just using packed, even if it doesn't do anything
to the alignment can cause a severe performance hit.  From now on we are
not going to set the packed attribute and will just need to be very careful
to make sure the structure is naturally aligned.

Cc: Andreas Schwab <schwab@...hat.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@...hos.com>
Cc: Andreas Gruenbacher <agruen@...e.de>
Signed-off-by: Eric Paris <eparis@...hat.com>
---
 include/linux/fanotify.h |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/include/linux/fanotify.h b/include/linux/fanotify.h
index 0535461..b892e46 100644
--- a/include/linux/fanotify.h
+++ b/include/linux/fanotify.h
@@ -65,20 +65,23 @@
 				 FAN_ALL_PERM_EVENTS |\
 				 FAN_Q_OVERFLOW)
 
-#define FANOTIFY_METADATA_VERSION	1
-
+#define FANOTIFY_METADATA_VERSION	2
+/*
+ * These structures must be naturally aligned so that a 32 bit userspace process
+ * will find the offsets the same as a 64bit process.
+ */
 struct fanotify_event_metadata {
 	__u32 event_len;
 	__u32 vers;
-	__u64 mask;
+	aligned_u64 mask;
 	__s32 fd;
 	__s32 pid;
-} __attribute__ ((packed));
+};
 
 struct fanotify_response {
 	__s32 fd;
 	__u32 response;
-} __attribute__ ((packed));
+};
 
 /* Legit userspace responses to a _PERM event */
 #define FAN_ALLOW	0x01
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ