rr-debugger / rr

Record and Replay Framework
http://rr-project.org/
Other
8.77k stars 564 forks source link

Permission error when running a FUSE filesystem #2501

Closed gaul closed 4 years ago

gaul commented 4 years ago

When running s3fs I see this error:

$ rr record --chaos s3fs -o storage_class=standard_ia gaulbackup "${HOME}/gaulbackup" -f 
rr: Saving execution to trace directory `/home/gaul/.local/share/rr/s3fs-6'.
[WARNING] rr: Executed file with setuid or file capabilities set.
          Capabilities did not take effect. Errors may follow.
          To record this execution faithfully, re-run rr as:

             sudo -EP rr record --setuid-sudo

fusermount: mount failed: Operation not permitted

Following the instructions gives a different error:

$ sudo -EP rr record --setuid-sudo --chaos s3fs -o storage_class=standard_ia gaulbackup "${HOME}/gaulbackup" -f 
[sudo] password for gaul: 
[FATAL /builddir/build/BUILD/rr-4513b23c8092097dc42c73f3cbaf4cfaebd04efe/src/util.cc:1383:ensure_dir() errno: EACCES] Can't write to trace directory `/root/.local/share'.
=== Start rr backtrace:
rr(_ZN2rr13dump_rr_stackEv+0x5a)[0x5650c63c894a]
rr(_ZN2rr15notifying_abortEv+0x4f)[0x5650c63c89df]
rr(_ZN2rr12FatalOstreamD1Ev+0x5d)[0x5650c62da27d]
rr(_ZN2rr10ensure_dirERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPKcj+0x319)[0x5650c63c9279]
rr(_ZN2rr10ensure_dirERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPKcj+0x524)[0x5650c63c9484]
rr(_ZN2rr11TraceWriterC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiS8_NS_14TicksSemanticsE+0x5ec)[0x5650c63baf8c]
rr(_ZN2rr13RecordSessionC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIS6_SaIS6_EESD_RKNS_20DisableCPUIDFeaturesENS0_16SyscallBufferingEiNS_7BindCPUES8_PKNS_9TraceUuidEb+0x93)[0x5650c630bfd3]
rr(_ZN2rr13RecordSession6createERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS7_EESB_RKNS_20DisableCPUIDFeaturesENS0_16SyscallBufferingEhNS_7BindCPUERKS7_PKNS_9TraceUuidEb+0x8de)[0x5650c630cc5e]
rr(_ZN2rr13RecordCommand3runERSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS7_EE+0xbea)[0x5650c62fe74a]
rr(main+0x16e)[0x5650c627303e]
/lib64/libc.so.6(__libc_start_main+0xf2)[0x7f7a4f603042]
rr(_start+0x2e)[0x5650c62731de]
=== End rr backtrace
Aborted

This directory exists:

$ sudo ls -ld /root/.local/share
drwxr-xr-x. 3 root root 4096 Sep 29  2018 /root/.local/share

Any pointers to what I am doing wrong? Is there some issue related to fusermount?

Keno commented 4 years ago

Does sudo -EHP work?

gaul commented 4 years ago

Same error:

$ sudo -EHP rr record --setuid-sudo --chaos s3fs -o storage_class=standard_ia gaulbackup "${HOME}/gaulbackup" -f 
[FATAL /builddir/build/BUILD/rr-4513b23c8092097dc42c73f3cbaf4cfaebd04efe/src/util.cc:1383:ensure_dir() errno: EACCES] Can't write to trace directory `/root/.local/share'.
=== Start rr backtrace:
rr(_ZN2rr13dump_rr_stackEv+0x5a)[0x564d8f17794a]
rr(_ZN2rr15notifying_abortEv+0x4f)[0x564d8f1779df]
rr(_ZN2rr12FatalOstreamD1Ev+0x5d)[0x564d8f08927d]
rr(_ZN2rr10ensure_dirERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPKcj+0x319)[0x564d8f178279]
rr(_ZN2rr10ensure_dirERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPKcj+0x524)[0x564d8f178484]
rr(_ZN2rr11TraceWriterC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiS8_NS_14TicksSemanticsE+0x5ec)[0x564d8f169f8c]
rr(_ZN2rr13RecordSessionC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIS6_SaIS6_EESD_RKNS_20DisableCPUIDFeaturesENS0_16SyscallBufferingEiNS_7BindCPUES8_PKNS_9TraceUuidEb+0x93)[0x564d8f0bafd3]
rr(_ZN2rr13RecordSession6createERKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS7_EESB_RKNS_20DisableCPUIDFeaturesENS0_16SyscallBufferingEhNS_7BindCPUERKS7_PKNS_9TraceUuidEb+0x8de)[0x564d8f0bbc5e]
rr(_ZN2rr13RecordCommand3runERSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS7_EE+0xbea)[0x564d8f0ad74a]
rr(main+0x16e)[0x564d8f02203e]
/lib64/libc.so.6(__libc_start_main+0xf2)[0x7f56220f0042]
rr(_start+0x2e)[0x564d8f0221de]
=== End rr backtrace
Aborted
Keno commented 4 years ago

Ah, I meant the opposite of course sudo -EP --preserve-env=HOME. Looks like sudo has changed its default here to always set HOME to that of the root user.

Keno commented 4 years ago

@gaul I wouldn't be surprised if you run into additional issues with privileged operations that rr doesn't handle yet. Please do feel free to open a new issue if you do, even if this particular issue is solved.