aboutsummaryrefslogtreecommitdiff
path: root/openmp/runtime
diff options
context:
space:
mode:
authorTerry Wilmarth <terry.l.wilmarth@intel.com>2024-03-27 11:27:28 -0400
committerGitHub <noreply@github.com>2024-03-27 11:27:28 -0400
commitaa2c14de1adcd265bf0c0fb44f97b5d6c1c38710 (patch)
tree24337b3523fc96e76be3f0484c9d0ad091747c66 /openmp/runtime
parent51f7b262425959d4e2bd6bc79fed283586d0472e (diff)
downloadllvm-aa2c14de1adcd265bf0c0fb44f97b5d6c1c38710.zip
llvm-aa2c14de1adcd265bf0c0fb44f97b5d6c1c38710.tar.gz
llvm-aa2c14de1adcd265bf0c0fb44f97b5d6c1c38710.tar.bz2
[OpenMP] Close up permissions on /tmp files (#85469)
The SHM or /tmp files that might be created during library registration don't need to have such open permissions, so this change fixes that.
Diffstat (limited to 'openmp/runtime')
-rw-r--r--openmp/runtime/src/kmp_runtime.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/openmp/runtime/src/kmp_runtime.cpp b/openmp/runtime/src/kmp_runtime.cpp
index a60bdb9..a242049 100644
--- a/openmp/runtime/src/kmp_runtime.cpp
+++ b/openmp/runtime/src/kmp_runtime.cpp
@@ -6752,11 +6752,11 @@ void __kmp_register_library_startup(void) {
int fd1 = -1;
shm_name = __kmp_str_format("/%s", name);
int shm_preexist = 0;
- fd1 = shm_open(shm_name, O_CREAT | O_EXCL | O_RDWR, 0666);
+ fd1 = shm_open(shm_name, O_CREAT | O_EXCL | O_RDWR, 0600);
if ((fd1 == -1) && (errno == EEXIST)) {
// file didn't open because it already exists.
// try opening existing file
- fd1 = shm_open(shm_name, O_RDWR, 0666);
+ fd1 = shm_open(shm_name, O_RDWR, 0600);
if (fd1 == -1) { // file didn't open
KMP_WARNING(FunctionError, "Can't open SHM");
__kmp_shm_available = false;
@@ -6800,11 +6800,11 @@ void __kmp_register_library_startup(void) {
int fd1 = -1;
temp_reg_status_file_name = __kmp_str_format("/tmp/%s", name);
int tmp_preexist = 0;
- fd1 = open(temp_reg_status_file_name, O_CREAT | O_EXCL | O_RDWR, 0666);
+ fd1 = open(temp_reg_status_file_name, O_CREAT | O_EXCL | O_RDWR, 0600);
if ((fd1 == -1) && (errno == EEXIST)) {
// file didn't open because it already exists.
// try opening existing file
- fd1 = open(temp_reg_status_file_name, O_RDWR, 0666);
+ fd1 = open(temp_reg_status_file_name, O_RDWR, 0600);
if (fd1 == -1) { // file didn't open if (fd1 == -1) {
KMP_WARNING(FunctionError, "Can't open TEMP");
__kmp_tmp_available = false;
@@ -6944,7 +6944,7 @@ void __kmp_unregister_library(void) {
int fd1;
if (__kmp_shm_available) {
shm_name = __kmp_str_format("/%s", name);
- fd1 = shm_open(shm_name, O_RDONLY, 0666);
+ fd1 = shm_open(shm_name, O_RDONLY, 0600);
if (fd1 != -1) { // File opened successfully
char *data1 = (char *)mmap(0, SHM_SIZE, PROT_READ, MAP_SHARED, fd1, 0);
if (data1 != MAP_FAILED) {