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: <20190423161831.GA15387@bharath12345-Inspiron-5559>
Date:   Tue, 23 Apr 2019 21:48:31 +0530
From:   Bharath Vedartham <linux.bhar@...il.com>
To:     akpm@...ux-foundation.org, viro@...iv.linux.org.uk
Cc:     linux-kernel@...r.kernel.org, reiserfs-devel@...r.kernel.org,
        linux.bhar@...il.com
Subject: [PATCH] reiserfs: Add comment to explain endianness issue in
 xattr_hash

csum_partial() gives different results for little-endian and big-endian
hosts. This causes images created on little-endian hosts and mounted on
big endian hosts to see csum mismatches. This causes an endianness bug.
Sparse gives a warning as csum_partial returns a restricted integer type
__wsum_t and xattr_hash expects __u32. This warning acts as a reminder
for this bug and should not be suppressed.

This comment aims to convey these endianness issues.

Signed-off-by: Bharath Vedartham <linux.bhar@...il.com>
---
 fs/reiserfs/xattr.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index 32d8986..0ea6654 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -450,6 +450,16 @@ static struct page *reiserfs_get_page(struct inode *dir, size_t n)
 
 static inline __u32 xattr_hash(const char *msg, int len)
 {
+	/*
+	 * csum_partial() gives different results for little-endian and
+	 * big endian hosts. Images created on little-endian hosts and
+	 * mounted on big-endian hosts(and vice versa) will see csum mismatches
+	 * when trying to fetch xattrs. Treating the hash as __wsum_t would
+	 * lower the frequency of mismatch. This is an endianness bug in reiserfs.
+	 * The return statement would result in a sparse warning. Do not fix the sparse
+	 * warning so as to not hide the reminder of the bug.
+	 */
+
 	return csum_partial(msg, len, 0);
 }
 
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ