Skip to content

Commit

Permalink
IsolateTracer: fix _access_check's handling of /proc/self
Browse files Browse the repository at this point in the history
When `real == proc_dir`, `os.path.relpath(real, proc_dir)` returns `.`
  • Loading branch information
hieplpvip committed May 19, 2024
1 parent fab8cf2 commit a2f7218
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion dmoj/cptbox/isolate.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,9 @@ def _access_check(self, debugger: Debugger, file: str, fs_jail: FilesystemPolicy

if normalized != real:
proc_dir = f'/proc/{debugger.tid}'
if real.startswith(proc_dir):
if real == proc_dir:
real = '/proc/self'
elif real.startswith(proc_dir):
real = os.path.join('/proc/self', os.path.relpath(real, proc_dir))

if not fs_jail.check(real):
Expand Down

0 comments on commit a2f7218

Please sign in to comment.