[Lldb-commits] [lldb] [lldb][Windows] Enforce exec permission using Platform::Install() from Windows host (PR #91887)
Dmitry Vasilyev via lldb-commits
lldb-commits at lists.llvm.org
Sun May 12 07:30:36 PDT 2024
https://github.com/slydiman created https://github.com/llvm/llvm-project/pull/91887
Target::Install() set 0700 permissions for the main executable file. Platform::Install() just copies permissions from the source. But the permission eFilePermissionsUserExecute is missing on the Windows host. A lot of tests failed in case of Windows host and Linux target because of this issue. There is no API to provide the exec flag. This patch set the permission eFilePermissionsUserExecute for all files installed via Platform::Install() from the Windows host. It fixes a lot of tests in case of Windows host and Linux target.
>From 94f75bd21aac412b9971ccc8dc8382e4a75dc1cd Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev <dvassiliev at accesssoftek.com>
Date: Sun, 12 May 2024 18:29:09 +0400
Subject: [PATCH] [lldb][Windows] Enforce exec permission using
Platform::Install() from Windows host
Target::Install() set 0700 permissions for the main executable file. Platform::Install() just copies permissions from the source. But the permission eFilePermissionsUserExecute is missing on the Windows host. A lot of tests failed in case of Windows host and Linux target because of this issue. There is no API to provide the exec flag. This patch set the permission eFilePermissionsUserExecute for all files installed via Platform::Install() from the Windows host. It fixes a lot of tests in case of Windows host and Linux target.
---
lldb/source/Target/Platform.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index 4af4aa68ccd01..0e7739b3712d7 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -1227,6 +1227,10 @@ Status Platform::PutFile(const FileSpec &source, const FileSpec &destination,
if (permissions == 0)
permissions = lldb::eFilePermissionsFileDefault;
+#if defined(_WIN32)
+ permissions |= lldb::eFilePermissionsUserExecute;
+#endif
+
lldb::user_id_t dest_file = OpenFile(
destination, File::eOpenOptionCanCreate | File::eOpenOptionWriteOnly |
File::eOpenOptionTruncate | File::eOpenOptionCloseOnExec,
More information about the lldb-commits
mailing list