From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: david@fromorbit.com
Cc: Eric Sandeen <sandeen@redhat.com>,
linux-xfs@vger.kernel.org, Dave Chinner <dchinner@redhat.com>
Subject: [PATCH v2 05/16] xfs: set XFS_DA_OP_OKNOENT in xfs_attr_get
Date: Tue, 22 Nov 2016 10:21:26 -0800 [thread overview]
Message-ID: <20161122182126.GM16813@birch.djwong.org> (raw)
In-Reply-To: <147830451072.26713.4807330905355527976.stgit@birch.djwong.org>
From: Eric Sandeen <sandeen@redhat.com>
Source kernel commit: c400ee3ed1b13d45adde68e12254dc6ab6977b59
It's entirely possible for userspace to ask for an xattr which
does not exist.
Normally, there is no problem whatsoever when we ask for such
a thing, but when we look at an obfuscated metadump image
on a debug kernel with selinux, we trip over this ASSERT in
xfs_da3_path_shift():
*result = -ENOENT; /* we're out of our tree */
ASSERT(args->op_flags & XFS_DA_OP_OKNOENT);
It (more or less) only shows up in the above scenario, because
xfs_metadump obfuscates attr names, but chooses names which
keep the same hash value - and xfs_da3_node_lookup_int does:
if (((retval == -ENOENT) || (retval == -ENOATTR)) &&
(blk->hashval == args->hashval)) {
error = xfs_da3_path_shift(state, &state->path, 1, 1,
&retval);
IOWS, we only get down to the xfs_da3_path_shift() ASSERT
if we are looking for an xattr which doesn't exist, but we
find xattrs on disk which have the same hash, and so might be
a hash collision, so we try the path shift. When *that*
fails to find what we're looking for, we hit the assert about
XFS_DA_OP_OKNOENT.
Simply setting XFS_DA_OP_OKNOENT in xfs_attr_get solves this
rather corner-case problem with no ill side effects. It's
fine for an attr name lookup to fail.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
---
libxfs/xfs_attr.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c
index c7f0afa..60513f9 100644
--- a/libxfs/xfs_attr.c
+++ b/libxfs/xfs_attr.c
@@ -135,6 +135,8 @@ xfs_attr_get(
args.value = value;
args.valuelen = *valuelenp;
+ /* Entirely possible to look up a name which doesn't exist */
+ args.op_flags = XFS_DA_OP_OKNOENT;
lock_mode = xfs_ilock_attr_map_shared(ip);
if (!xfs_inode_hasattr(ip))
next prev parent reply other threads:[~2016-11-22 18:21 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-05 0:07 [PATCH v2 00/16] xfsprogs: miscellaneous libxfs cleanups Darrick J. Wong
2016-11-05 0:08 ` [PATCH 01/16] xfs_repair: fix some potential null pointer deferences Darrick J. Wong
2016-11-15 10:14 ` Christoph Hellwig
2016-11-05 0:08 ` [PATCH 02/16] xfs_repair: fix bogus rmapbt record owner check Darrick J. Wong
2016-11-15 10:15 ` Christoph Hellwig
2016-11-05 0:08 ` [PATCH 03/16] xfs_io: fix libxfs naming violation Darrick J. Wong
2016-11-15 10:15 ` Christoph Hellwig
2016-11-05 0:08 ` [PATCH 04/16] libxfs: remove unnecessary hascrc test in btree verifiers Darrick J. Wong
2016-11-15 10:16 ` Christoph Hellwig
2016-11-05 0:08 ` [PATCH 05/16] xfs: set XFS_DA_OP_OKNOENT in xfs_attr_get Eric Sandeen
2016-11-15 10:16 ` Christoph Hellwig
2016-11-15 13:41 ` Eric Sandeen
2016-11-16 5:21 ` Dave Chinner
2016-11-22 18:21 ` Darrick J. Wong
2016-11-22 18:21 ` Darrick J. Wong [this message]
2016-11-05 0:08 ` [PATCH 06/16] libxfs: refactor btree crc verifier Darrick J. Wong
2016-11-15 10:17 ` Christoph Hellwig
2016-11-05 0:08 ` [PATCH 07/16] libxfs: fix whitespace to match the kernel Darrick J. Wong
2016-11-15 10:17 ` Christoph Hellwig
2016-11-05 0:08 ` [PATCH 08/16] libxfs: return bool from sb_version_hasmetauuid Darrick J. Wong
2016-11-15 10:17 ` Christoph Hellwig
2016-11-05 0:08 ` [PATCH 09/16] xfs: fix btree cursor error cleanups Brian Foster
2016-11-15 10:18 ` Christoph Hellwig
2016-11-22 18:23 ` [PATCH v2 " Darrick J. Wong
2016-11-05 0:09 ` [PATCH 10/16] libxfs: clean up _dir2_data_freescan Darrick J. Wong
2016-11-15 10:19 ` Christoph Hellwig
2016-11-05 0:09 ` [PATCH 11/16] tools: create libxfs-diff to compare libxfses Darrick J. Wong
2016-11-15 10:19 ` Christoph Hellwig
2016-11-05 0:09 ` [PATCH 12/16] libxfs: fix line lengths Darrick J. Wong
2016-11-15 10:20 ` Christoph Hellwig
2016-11-05 0:09 ` [PATCH 13/16] libxfs: synchronize dinode_verify with userspace Darrick J. Wong
2016-11-15 10:20 ` Christoph Hellwig
2016-11-05 0:09 ` [PATCH 14/16] libxfs: remove useless stuff from the kernel Darrick J. Wong
2016-11-15 10:20 ` Christoph Hellwig
2016-11-05 0:09 ` [PATCH 15/16] xfs: check return value of _trans_reserve_quota_nblks Darrick J. Wong
2016-11-15 10:21 ` Christoph Hellwig
2016-11-05 0:09 ` [PATCH 16/16] xfs: check minimum block size for CRC filesystems Darrick J. Wong
2016-11-15 10:22 ` Christoph Hellwig
2016-11-22 18:26 ` [PATCH 17/16] libxfs-apply: port to stgit Darrick J. Wong
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=20161122182126.GM16813@birch.djwong.org \
--to=darrick.wong@oracle.com \
--cc=david@fromorbit.com \
--cc=dchinner@redhat.com \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).