@@ -28,8 +28,6 @@ const SECCOMP_DATA_ARGS_OFFSET: u32 = 16;
2828#[ cfg( target_arch = "x86_64" ) ]
2929const X32_SYSCALL_BIT : u32 = 0x4000_0000 ;
3030
31- const SECCOMP_FILTER_OPERATION : u32 = 1 ;
32- const PR_SET_SECCOMP_OPERATION : u32 = 22 ;
3331const CLOSE_RANGE_UNSHARE_FLAG : u32 = 1 << 1 ;
3432const F_SETOWN_COMMAND : u32 = 8 ;
3533const F_SETSIG_COMMAND : u32 = 10 ;
@@ -181,18 +179,9 @@ pub fn prepare(sandbox_tgid: u32) -> io::Result<ChildHardeningProgram> {
181179 append_argument_nonzero_deny ( & mut instructions, syscall, 0 ) ?;
182180 }
183181
184- append_argument_equal_deny (
185- & mut instructions,
186- libc:: SYS_seccomp ,
187- 0 ,
188- SECCOMP_FILTER_OPERATION ,
189- ) ?;
190- append_argument_equal_deny (
191- & mut instructions,
192- libc:: SYS_prctl ,
193- 0 ,
194- PR_SET_SECCOMP_OPERATION ,
195- ) ?;
182+ // The ordinary workload filter is installed after this program and owns
183+ // the final ban on further seccomp installation. Blocking it here would
184+ // prevent the sandbox from completing the prepared filter stack.
196185 append_argument_masked_deny (
197186 & mut instructions,
198187 libc:: SYS_close_range ,
@@ -390,18 +379,6 @@ mod tests {
390379 {
391380 unsafe { libc:: _exit ( 5 ) } ;
392381 }
393- if unsafe {
394- libc:: syscall (
395- libc:: SYS_seccomp ,
396- SECCOMP_SET_MODE_FILTER ,
397- 0 ,
398- std:: ptr:: null :: < libc:: sock_fprog > ( ) ,
399- )
400- } != -1
401- || io:: Error :: last_os_error ( ) . raw_os_error ( ) != Some ( libc:: EPERM )
402- {
403- unsafe { libc:: _exit ( 6 ) } ;
404- }
405382 if unsafe { libc:: fcntl ( libc:: STDIN_FILENO , libc:: F_SETOWN , sandbox_tgid) } != -1
406383 || io:: Error :: last_os_error ( ) . raw_os_error ( ) != Some ( libc:: EPERM )
407384 {
0 commit comments