Use os.open with setpag

When we open the ioctl file to run the openafs setpag syscall,
we previously used the high-level open method, which apparently
issues an unwanted TCGETS ioctl which crashes the program with
a kernel error under certain versions of python+openafs+linux
(3.10.6, 1.8.9, 5.15.0, respectively).

Switch to a low-level open to avoid this call.

Change-Id: I5e08a6020cf6cd4ad2a0084effb697aa39dae9c6
This commit is contained in:
James E. Blair 2023-06-05 10:25:00 -07:00
parent 318df3a9ba
commit eb550597b0
1 changed files with 3 additions and 2 deletions

View File

@ -85,8 +85,9 @@ class BubblewrapExecutionContext(BaseExecutionContext):
# invocation ends up in its own PAG.
# http://asa.scripts.mit.edu/trac/attachment/ticket/145/setpag.txt#L315
if os.path.exists("/proc/fs/openafs/afs_ioctl"):
fcntl.ioctl(open("/proc/fs/openafs/afs_ioctl"), 0x40084301,
struct.pack("lllll", 0, 0, 0, 0, 21))
f = os.open("/proc/fs/openafs/afs_ioctl", os.O_RDONLY)
fcntl.ioctl(f, 0x40084301, struct.pack("lllll", 0, 0, 0, 0, 21))
os.close(f)
def getPopen(self, **kwargs):
self.setpag()