Skip to content

Commit d6956ef

Browse files
rmetrichstevegrubb
authored andcommitted
Map file with MAP_SHARED instead of MAP_PRIVATE
When setting up a user probe using ebpf or systemtap on a file, fapolicyd computes a different checksum, causing (usually) denial to occur. eBPF is used by Microsoft's MDATP, in particular for monitoring /usr/lib64/libpam.so.0 function calls. Through setting a user probe, mdatp and fapolicyd cannot be used concurrently. The reason for computing a different checksum is using mmap(MAP_PRIVATE) which makes the hooks set by ebpf and/or systemtap be visible: ~~~ 1140 char *get_hash_from_fd2(int fd, size_t size, file_hash_alg_t alg) 1141 { : 1165 mapped = mmap(0, size, PROT_READ, MAP_PRIVATE|MAP_POPULATE, fd, 0); 1166 if (mapped != MAP_FAILED) { : ~~~ A solution consists in using MAP_SHARED instead of MAP_PRIVATE. Fixes RHEL-142628.
1 parent ee5ab7e commit d6956ef

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/library/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,7 @@ char *get_hash_from_fd2(int fd, size_t size, file_hash_alg_t alg)
11621162
if (digest_length == 0)
11631163
return NULL;
11641164

1165-
mapped = mmap(0, size, PROT_READ, MAP_PRIVATE|MAP_POPULATE, fd, 0);
1165+
mapped = mmap(0, size, PROT_READ, MAP_SHARED|MAP_POPULATE, fd, 0);
11661166
if (mapped != MAP_FAILED) {
11671167
unsigned char hptr[SHA512_DIGEST_LENGTH];
11681168
int computed = 0;

0 commit comments

Comments
 (0)