Bug 972292 - lgetxattrs can't show the file attribute list with ntfs FS in rhel7
lgetxattrs can't show the file attribute list with ntfs FS in rhel7
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs (Show other bugs)
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Richard W.M. Jones
Virtualization Bugs
Depends On:
  Show dependency treegraph
Reported: 2013-06-08 03:52 EDT by bfan
Modified: 2014-04-25 05:21 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2014-04-25 05:21:14 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description bfan 2013-06-08 03:52:46 EDT
Description of problem:
lgetxattrs can't show the file attribute list with ntfs FS though execute no error

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
# guestfish -N fs:ntfs

Welcome to guestfish, the guest filesystem shell for
editing virtual machine filesystems and disk images.

Type: 'help' for help on commands
      'man' to read the manual
      'quit' to quit the shell

><fs> trace 1
><fs> mount-options user_xattr /dev/sda1 /
libguestfs: trace: mount_options "user_xattr" "/dev/sda1" "/"
libguestfs: trace: mount_options = 0
><fs> touch /test.txt
libguestfs: trace: touch "/test.txt"
libguestfs: trace: touch = 0
><fs> lsetxattr security.name "hello" 5 /test.txt
libguestfs: trace: lsetxattr "security.name" "hello" 5 "/test.txt"
libguestfs: trace: lsetxattr = 0
><fs> lsetxattr security.type "ascii file" 10 /test.txt
libguestfs: trace: lsetxattr "security.type" "ascii file" 10 "/test.txt"
libguestfs: trace: lsetxattr = 0
><fs> lgetxattrs /test.txt
libguestfs: trace: lgetxattrs "/test.txt"
libguestfs: trace: lgetxattrs = <struct guestfs_xattr_list *>

Actual results:
lgetxattrs don't have output

Expected results:
lgetxattrs can show the attribute list
><fs> lgetxattrs /test.txt
[0] = {
  attrname: security.name
  attrval: hello
[1] = {
  attrname: security.type
  attrval: ascii file

Additional info:
1. lgetxattrs work with ext FS
2. has same issue with libguestfs-1.20.8-4.el6.x86_64 in rhel6
Comment 1 Richard W.M. Jones 2013-06-10 11:24:57 EDT
I'm pretty sure I've seen the same bug in ntfs-3g itself.
The problem was that ntfs-3g wouldn't return all the xattrs
when you use listxattr(2).
Comment 2 Richard W.M. Jones 2013-07-18 18:09:45 EDT
Should we expect that security.* xattrs can be set arbitrarily?
The security.* namespace is reserved by kernel security modules.
From attr(5):

   Extended security attributes
       The  security  attribute  namespace is used by kernel security modules,
       such as Security Enhanced Linux.  Read and write access permissions  to
       security  attributes depend on the policy implemented for each security
       attribute by the security module.  When no security module  is  loaded,
       all  processes  have  read  access to extended security attributes, and
       write access is limited to processes that have the CAP_SYS_ADMIN  capa‐

So the fact this worked for ext4 is just luck.

If you use the user.* namespace instead, then everything works
fine even on NTFS:

$ guestfish -N fs:ntfs -m /dev/sda1:/:user_xattr <<EOF
touch /test.txt
lsetxattr user.name "hello" 5 /test.txt
lsetxattr user.type "ascii file" 10 /test.txt
lgetxattr /test.txt user.name
lgetxattrs /test.txt
[0] = {
  attrname: user.name
  attrval: hello
[1] = {
  attrname: user.type
  attrval: ascii file

So I would say this is not a bug.
Comment 4 Richard W.M. Jones 2014-04-25 05:21:14 EDT
I looked at the description again, and it's not expected that
you should be able to set arbitrary security.* xattrs.  That
namespace is reserved for the kernel.  Try setting user.* xattrs
instead -- those should work.

Note You need to log in before you can comment on or make changes to this bug.