Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rofiles-fuse: also pass mode for O_RDONLY #1200

Closed
wants to merge 1 commit into from

Conversation

jlebon
Copy link
Member

@jlebon jlebon commented Sep 20, 2017

In the O_RDONLY case, we were calling openat without a mode
argument. However, it's perfectly legal (albeit unusual) to do
open(O_RDONLY|O_CREAT). One such application that makes use of this is
flock(1).

This was actually caught by _FORTIFY_SOURCE=2, and once we run
rofiles-fuse with -f, the message is clear:

*** invalid openat64 call: O_CREAT or O_TMPFILE without mode ***:
rofiles-fuse terminated
======= Backtrace: =========
/lib64/libc.so.6(+0x7c8dc)[0x7f36d9f188dc]
/lib64/libc.so.6(__fortify_fail+0x37)[0x7f36d9fbfaa7]
/lib64/libc.so.6(+0x10019a)[0x7f36d9f9c19a]
rofiles-fuse[0x401768]
...

Without _FORTIFY_SOURCE, the file gets created, but its mode is
completely random.

I ran into this while investigating coreos/rpm-ostree#1003.

@jlebon
Copy link
Member Author

jlebon commented Sep 20, 2017

Requires #1199.

Copy link
Member

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe make the last bugfix a separate PR while we discuss reworking tests?

tests/libtest.sh Outdated
@@ -514,8 +514,15 @@ os_repository_new_commit ()
cd ${test_tmpdir}
}

assert_has_setfattr () {
if ! which setfattr 2>/dev/null; then
assert_no_reached "no setfattr available to determine xattr support"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing a t in not right? Could just use fatal.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank! This is fixed in #1199.

.papr.yml Outdated
- ci/ci-commitmessage-submodules.sh
- ci/build-check.sh
- ci/ci-release-build.sh
- docker run -e TEST_TMPDIR -e CFLAGS -e GI_SCANNERFLAGS -e ASAN_OPTIONS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm...the more we do this though the harder it is to migrate tests to run in e.g. Kubernetes. It's tricky; my recent attempt to use strace fault injection was blocked by the default docker seccomp policy, and going down this route would allow us to also easily disable that seccomp policy.

OTOH, ah just found this on Kubernetes seccomp.
Also what we're doing here maps to Kubernetes emptyDir volumes right?

So...dunno.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I understand. Though at the same time, we really should strive for maximum coverage in our CI, right? Given that the majority of use cases of ostree are not on overlay/tmpfs, it seems like a big one to get right.

I think due to the position in the stack of many of the projects hooked to PAPR, we can't expect great coverage from running inside unprivileged Docker containers. I don't expect the common pattern of provisioning a VM and running privileged code there to diminish after migrating to Kubernetes/OCP, right?

@rh-atomic-bot
Copy link

☔ The latest upstream changes (presumably 75150fe) made this pull request unmergeable. Please resolve the merge conflicts.

In the `O_RDONLY` case, we were calling `openat` without a mode
argument. However, it's perfectly legal (albeit unusual) to do
`open(O_RDONLY|O_CREAT)`. One such application that makes use of this is
`flock(1)`.

This was actually caught by `_FORTIFY_SOURCE=2`, and once we run
`rofiles-fuse` with `-f`, the message is clear:

```
*** invalid openat64 call: O_CREAT or O_TMPFILE without mode ***:
rofiles-fuse terminated
======= Backtrace: =========
/lib64/libc.so.6(+0x7c8dc)[0x7f36d9f188dc]
/lib64/libc.so.6(__fortify_fail+0x37)[0x7f36d9fbfaa7]
/lib64/libc.so.6(+0x10019a)[0x7f36d9f9c19a]
rofiles-fuse[0x401768]
...
```

Without `_FORTIFY_SOURCE`, the file gets created, but its mode is
completely random.

I ran into this while investigating
coreos/rpm-ostree#1003.
@jlebon
Copy link
Member Author

jlebon commented Sep 21, 2017

OK, now this PR is just about the rofiles-fuse bug!

@cgwalters
Copy link
Member

@rh-atomic-bot r+ c922c34

@rh-atomic-bot
Copy link

⌛ Testing commit c922c34 with merge d4c7093...

@rh-atomic-bot
Copy link

☀️ Test successful - status-atomicjenkins
Approved by: cgwalters
Pushing d4c7093 to master...

@jlebon jlebon deleted the pr/rofiles-open branch June 14, 2018 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants