gvisor icon indicating copy to clipboard operation
gvisor copied to clipboard

Failed to stop overwriting a running binary

Open tanjianfeng opened this issue 7 years ago • 3 comments

runsc result:

$ stress -c 1 &
$ which stress
/usr/bin/stress
$ cp /bin/ls /usr/bin/stress
[1]+  Bus error               stress -c 1

Expected result in vanilla Linux:

$ stress -c 1 &
$ which stress
/usr/bin/stress
$ cp /bin/ls /usr/bin/stress
cp: cannot create regular file '/usr/bin/stress': Text file busy

tanjianfeng avatar Oct 14 '19 09:10 tanjianfeng

A friendly reminder that this issue had no activity for 120 days.

github-actions[bot] avatar Sep 15 '23 00:09 github-actions[bot]

I can still repro this issue with latest runsc build.

ayushr2 avatar Sep 15 '23 15:09 ayushr2

I'd like to work on this. Right now linuxerr.ETXTBSY is defined but never actually returned anywhere — there's no write-tracking for executing files. My plan: mark a file as in-use when the loader opens it for exec (pkg/sentry/loader), and check that in the VFS open/truncate path, returning ETXTBSY on conflict, similar to how Linux ties this to i_writecount. I'll add a regression test under test/syscalls too. Mind assigning it to me?

abdeltaehass avatar Aug 18 '26 20:08 abdeltaehass