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

[LibOS] fs/encrypted: Fix crash on dropping a directory handle #564

Merged
merged 1 commit into from
May 4, 2022

Conversation

pwmarcz
Copy link
Contributor

@pwmarcz pwmarcz commented May 4, 2022

Description of the changes

The hdrop callback incorrectly assumed a that handle pointed to a regular file.

This commit also removes this assumption from other callbacks: while in most cases they should not be called for a directory handle, this is not yet a part of a documented contract.

Bug reported in #371 (comment).

How to test this PR?

This crashes on master, and is fixed in this PR.


This change is Reviewable

Copy link

@dimakuv dimakuv left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions, not enough approvals from maintainers (2 more required), not enough approvals from different teams (1 more required, approved so far: ITL) (waiting on @pwmarcz)

a discussion (no related file):
Please check Jenkins. It failed.



-- commits line 4 at r1:
a that -> that a

Copy link
Contributor Author

@pwmarcz pwmarcz left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions, not enough approvals from maintainers (2 more required), not enough approvals from different teams (1 more required, approved so far: ITL), "squash! " found in commit messages' one-liners (waiting on @dimakuv)

a discussion (no related file):

Previously, dimakuv (Dmitrii Kuvaiskii) wrote…

Please check Jenkins. It failed.

Yeah, I made a last minute change and it failed to compile... Fixed, hopefully.



-- commits line 4 at r1:

Previously, dimakuv (Dmitrii Kuvaiskii) wrote…

a that -> that a

I added a squash commit.

dimakuv
dimakuv previously approved these changes May 4, 2022
Copy link

@dimakuv dimakuv left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, all discussions resolved, not enough approvals from maintainers (1 more required), "squash! " found in commit messages' one-liners


LibOS/shim/src/fs/chroot/encrypted.c line 390 at r1 (raw file):

    assert(hdl->type == TYPE_CHROOT_ENCRYPTED);
    if (hdl->inode->type != S_IFREG)
        return 0;

Lol :)

boryspoplawski
boryspoplawski previously approved these changes May 4, 2022
Copy link
Contributor

@boryspoplawski boryspoplawski left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, all discussions resolved, "squash! " found in commit messages' one-liners


LibOS/shim/src/fs/chroot/encrypted.c line 389 at r2 (raw file):

static void chroot_encrypted_hdrop(struct shim_handle* hdl) {
    assert(hdl->type == TYPE_CHROOT_ENCRYPTED);
    if (hdl->inode->type != S_IFREG)

Don't we want to add an assert here, similar to other places? not blocking

Copy link
Contributor Author

@pwmarcz pwmarcz left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, all discussions resolved, "squash! " found in commit messages' one-liners


LibOS/shim/src/fs/chroot/encrypted.c line 389 at r2 (raw file):

Previously, boryspoplawski (Borys Popławski) wrote…

Don't we want to add an assert here, similar to other places? not blocking

I added the assertion in the other places because they return -EISDIR. In flush and hdrop, I think we don't care.

The `hdrop` callback incorrectly assumed that a handle pointed to a
regular file.

This commit also removes this assumption from other callbacks: while in
most cases they should not be called for a directory handle, this is not
yet a part of a documented contract.

Signed-off-by: Paweł Marczewski <[email protected]>
Copy link

@dimakuv dimakuv left a comment

Choose a reason for hiding this comment

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

Reviewed all commit messages.
Reviewable status: all files reviewed, all discussions resolved, not enough approvals from maintainers (1 more required)

Copy link
Contributor

@boryspoplawski boryspoplawski left a comment

Choose a reason for hiding this comment

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

Reviewed all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

Copy link
Member

@mkow mkow left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@mkow mkow merged commit 57b2cb3 into master May 4, 2022
@mkow mkow deleted the pawel/fix-enc branch May 4, 2022 23:27
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.

4 participants