Hi, David.
I can't repro the problem either, but I do have a patch authored by an engineer that left the company a while ago that seems to be at least related to your scenario. May I ask you to test it (just apply it to QEMU ToT and rerun the scenario to see if it changes the outcome) (feel free to experiment and modify the changes)? I never managed to understand the purpose of that patch (I lost the contact with the former engineer, and the patch is without any comment), so I never dared to send it to the list, but I hope your scenario may actually explain the purpose and the origin of the patch.
I am attaching the patch both as a file and inline.
From 377f99e807f4aa42ece9f0cd437f50af11611b4c Mon Sep 17 00:00:00 2001
From: Aleksandar Markovic <
address@hidden>
Date: Mon, 19 Aug 2019 15:20:29 +0200
Subject: [PATCH] linux-user: Special case /etc/
ld.cache.so and pretend it does
not exist
Prevent target executables from opening host ld.so.cache.
---
linux-user/syscall.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 8367cb1..f5bae6e 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -8820,6 +8820,10 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
if (!(p = lock_user_string(arg1))) {
return -TARGET_EFAULT;
}
+ if (strcmp("/etc/ld.so.cache", path(p)) == 0) {
+ unlock_user(p, arg1, 0);
+ return -TARGET_ENONET;
+ }
ret = get_errno(statfs(path(p), &stfs));
unlock_user(p, arg1, 0);
convert_statfs:
@@ -8859,6 +8863,10 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
if (!(p = lock_user_string(arg1))) {
return -TARGET_EFAULT;
}
+ if (strcmp("/etc/ld.so.cache", path(p)) == 0) {
+ unlock_user(p, arg1, 0);
+ return -TARGET_ENONET;
+ }
ret = get_errno(statfs(path(p), &stfs));
unlock_user(p, arg1, 0);
convert_statfs64:
@@ -9059,6 +9067,10 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
if (!(p = lock_user_string(arg1))) {
return -TARGET_EFAULT;
}
+ if (strcmp("/etc/ld.so.cache", path(p)) == 0) {
+ unlock_user(p, arg1, 0);
+ return -TARGET_ENONET;
+ }
ret = get_errno(stat(path(p), &st));
unlock_user(p, arg1, 0);
goto do_stat;
@@ -9068,6 +9080,10 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
if (!(p = lock_user_string(arg1))) {
return -TARGET_EFAULT;
}
+ if (strcmp("/etc/ld.so.cache", path(p)) == 0) {
+ unlock_user(p, arg1, 0);
+ return -TARGET_ENONET;
+ }
ret = get_errno(lstat(path(p), &st));
unlock_user(p, arg1, 0);
goto do_stat;
@@ -10268,6 +10284,10 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
if (!(p = lock_user_string(arg1))) {
return -TARGET_EFAULT;
}
+ if (strcmp("/etc/ld.so.cache", path(p)) == 0) {
+ unlock_user(p, arg1, 0);
+ return -TARGET_ENONET;
+ }
ret = get_errno(stat(path(p), &st));
unlock_user(p, arg1, 0);
if (!is_error(ret))
@@ -10279,6 +10299,10 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
if (!(p = lock_user_string(arg1))) {
return -TARGET_EFAULT;
}
+ if (strcmp("/etc/ld.so.cache", path(p)) == 0) {
+ unlock_user(p, arg1, 0);
+ return -TARGET_ENONET;
+ }
ret = get_errno(lstat(path(p), &st));
unlock_user(p, arg1, 0);
if (!is_error(ret))
@@ -10319,6 +10343,10 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
if (p == NULL) {
return -TARGET_EFAULT;
}
+ if (strcmp("/etc/ld.so.cache", path(p)) == 0) {
+ unlock_user(p, arg1, 0);
+ return -TARGET_ENONET;
+ }
#if defined(__NR_statx)
{
/*
--
2.7.4