Skip to content

Build fails due to setting xattrs that affect SELinux, "permission denied" #8601

Closed

Description

@decathorpe

I discovered this when running tests for syncthing v1.22, which fail on a system with SELinux enabled with this error message:

--- FAIL: TestXattr (0.00s)
    basicfs_test.go:597: set xattrs /tmp/TestXattr2645321982/001/test: Removexattr "security.selinux": permission denied
FAIL
FAIL	github.com/syncthing/syncthing/lib/fs	23.380s
FAIL

I assume that removing the security.selinux xattr from a file is not allowed unless the user has acquired superuser privileges first, so syncthing should probably leave attributes that are related to SELinux alone (as far as I can see, that's only the security.selinux attribute).


syncthing version: v1.22.0
operating system: tested on Fedora Linux 36 ,37, and Rawhide (development branch)
architecture: x86_64

Activity

  1. added
    bug
    needs-triage
    on Oct 11, 2022
  2. calmh commented on Oct 12, 2022

    @calmh
    Member

    Yes, lots of attributes will require elevated permissions, as noted in the docs. What isn't noted in the docs yet is that you can filter out attributes you don't want to sync;

    <folder id="...">
      ...
      <syncXattrs>true</syncXattrs>
      <xattrFilter>
        <entry match="security.*" permit="false"></entry>
        <entry match="*" permit="true"></entry>
      </xattrFilter>
    </folder>
    

    (the xattrfilter being a somewhat complicated config value means it's not currently supported in the config editor...)

  3. decathorpe commented on Oct 12, 2022

    @decathorpe
    Author

    So .. is the test failure harmless because this will not occur in real-world usage, or does the failure indicate that the feature is not ready for systems where SELinux is enabled?

  4. calmh commented on Oct 12, 2022

    @calmh
    Member

    The test failure is because the test doesn't expect there to be attributes on the newly created test file that it can't touch, because I didn't expect that when I wrote the test. In real world usage this will pop up when the user checks sync xattrs and isn't running as a privileged user and isn't filtering xattrs. I think that's expected. However it would be nice if it were possible to build on an selinux-enabled system as well...

  5. added
    build
    and removed
    bug
    needs-triage
    on Oct 12, 2022
  6. changed the title [-]v1.22: setting xattrs that affect SELinux fails with "permission denied"[/-] [+]Build fails due to setting xattrs that affect SELinux, "permission denied"[/+] on Oct 30, 2022
  7. added a commit that references this issue on Nov 8, 2022
    db49472
  8. added this to the v1.22.2 milestone on Nov 9, 2022
  9. added
    frozen-due-to-age
    on Nov 3, 2023
  10. locked and limited conversation to collaborators on Nov 3, 2023
  11. added a commit that references this issue on Jan 30, 2024
    bf1e418
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildfrozen-due-to-age

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions