From: Eric Sandeen <sandeen@redhat.com>
To: "fstests@vger.kernel.org" <fstests@vger.kernel.org>
Cc: Christian Brauner <brauner@kernel.org>
Subject: [PATCH] fix vfs/utils.c for big-endian systems
Date: Mon, 27 Jan 2025 15:43:24 -0600 [thread overview]
Message-ID: <fb7ad928-bbe9-4488-a6b7-a2786782bccd@redhat.com> (raw)
generic/633 was failing with EINVAL on the fsxgetattr call on s390.
Looks like this is due to a failure to properly endian swap the
arguments to the syscall, so fix that, and the magic_etc compare
in expected_dummy_vfs_caps_uid() as well while we're at it.
Fixes: 0d1af68e ("generic: add fstests for idmapped mounts")
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
diff --git a/src/vfs/utils.c b/src/vfs/utils.c
index c1c7951c..52bb7e42 100644
--- a/src/vfs/utils.c
+++ b/src/vfs/utils.c
@@ -650,7 +650,7 @@ bool expected_dummy_vfs_caps_uid(int fd, uid_t expected_uid)
if (ret < 0 || ret == 0)
return false;
- if (ns_xattr.magic_etc & VFS_CAP_REVISION_3) {
+ if (le32_to_cpu(ns_xattr.magic_etc) & VFS_CAP_REVISION_3) {
if (le32_to_cpu(ns_xattr.rootid) != expected_uid) {
errno = EINVAL;
@@ -673,10 +673,12 @@ int set_dummy_vfs_caps(int fd, int flags, int rootuid)
ns_cap_data.data[(x) >> 5].permitted |= (1 << ((x)&31))
struct vfs_ns_cap_data ns_xattr;
+ __le32 magic_etc;
memset(&ns_xattr, 0, sizeof(ns_xattr));
__raise_cap_permitted(CAP_NET_RAW, ns_xattr);
- ns_xattr.magic_etc |= VFS_CAP_REVISION_3 | VFS_CAP_FLAGS_EFFECTIVE;
+ magic_etc = (VFS_CAP_REVISION_3 | VFS_CAP_FLAGS_EFFECTIVE);
+ ns_xattr.magic_etc |= cpu_to_le32(magic_etc);
ns_xattr.rootid = cpu_to_le32(rootuid);
return fsetxattr(fd, "security.capability",
next reply other threads:[~2025-01-27 21:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-27 21:43 Eric Sandeen [this message]
2025-01-27 21:54 ` [PATCH] fix vfs/utils.c for big-endian systems Darrick J. Wong
2025-01-31 8:10 ` Christoph Hellwig
2025-01-31 15:36 ` Eric Sandeen
2025-02-04 12:52 ` Christian Brauner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fb7ad928-bbe9-4488-a6b7-a2786782bccd@redhat.com \
--to=sandeen@redhat.com \
--cc=brauner@kernel.org \
--cc=fstests@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox