-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[LibOS] Fix NULL pointer dereference in pseudo fs
`inode::data` field keeps specific file system data. In case of pseudo fs it is a `pseudo_node`. However, when a lookup is done the `dentry` might not be fully initialized. Signed-off-by: Mariusz Zaborski <oshogbo@invisiblethingslab.com>
- Loading branch information
Showing
7 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* SPDX-License-Identifier: LGPL-3.0-or-later */ | ||
/* Copyright (C) 2023 Intel Corporation | ||
* Mariusz Zaborski <oshogbo@invisiblethingslab.com> | ||
*/ | ||
|
||
#include <fcntl.h> | ||
#include <stdio.h> | ||
#include <unistd.h> | ||
|
||
#include "common.h" | ||
|
||
int main(int argc, const char** argv) { | ||
if (argc != 2) { | ||
fprintf(stderr, "This test requires a file to test"); | ||
return 1; | ||
} | ||
|
||
int fd = CHECK(open(argv[1], O_RDONLY)); | ||
CHECK(close(fd)); | ||
|
||
puts("TEST OK"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{% set entrypoint = "open_file" -%} | ||
|
||
loader.entrypoint = "file:{{ gramine.libos }}" | ||
libos.entrypoint = "{{ entrypoint }}" | ||
|
||
loader.env.LD_LIBRARY_PATH = "/lib" | ||
loader.argv = [ "{{ entrypoint }}", "/proc/test/nested/dirs/exec" ] | ||
|
||
fs.mounts = [ | ||
{ path = "/lib", uri = "file:{{ gramine.runtimedir(libc) }}" }, | ||
{ path = "/{{ entrypoint }}", uri = "file:{{ binary_dir }}/{{ entrypoint }}" }, | ||
|
||
# Let's shadow some file in /proc as it is a pseudo fs. | ||
{ path = "/proc/test/nested/dirs/exec", uri = "file:{{ binary_dir }}/{{ entrypoint }}" }, | ||
] | ||
|
||
sgx.debug = true | ||
sgx.edmm_enable = {{ 'true' if env.get('EDMM', '0') == '1' else 'false' }} | ||
|
||
sgx.trusted_files = [ | ||
"file:{{ gramine.libos }}", | ||
"file:{{ binary_dir }}/{{ entrypoint }}", | ||
"file:{{ gramine.runtimedir(libc) }}/", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters