Skip to content

Commit

Permalink
Attempt mmap() with MAP_RESILIENT_CODESIGN first
Browse files Browse the repository at this point in the history
  • Loading branch information
CRKatri committed Aug 4, 2023
1 parent 62637ee commit d38b9ed
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ldid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1342,6 +1342,12 @@ class Map {
_syscall(fstat(file, &stat));
size_ = stat.st_size;

#ifdef MAP_RESILIENT_CODESIGN
data_ = mmap(NULL, size_, pflag, mflag | MAP_RESILIENT_CODESIGN, file, 0);
if (data_ != MAP_FAILED)
return;
#endif

data_ = mmap(NULL, size_, pflag, mflag, file, 0);
if (data_ == MAP_FAILED) {
fprintf(stderr, "ldid: mmap: %s\n", strerror(errno));
Expand Down

0 comments on commit d38b9ed

Please sign in to comment.