@@ -530,23 +530,28 @@ static int assess_restrict_namespaces(
530530 return 0 ;
531531}
532532
533+ #if HAVE_SECCOMP
534+
533535static int assess_system_call_architectures (
534536 const struct security_assessor * a ,
535537 const SecurityInfo * info ,
536538 const void * data ,
537539 uint64_t * ret_badness ,
538540 char * * ret_description ) {
539541
542+ uint32_t native = 0 ;
540543 char * d ;
541544 uint64_t b ;
542545
543546 assert (ret_badness );
544547 assert (ret_description );
545548
549+ assert_se (seccomp_arch_from_string ("native" , & native ) >= 0 );
550+
546551 if (set_isempty (info -> system_call_architectures )) {
547552 b = 10 ;
548553 d = strdup ("Service may execute system calls with all ABIs" );
549- } else if (set_contains (info -> system_call_architectures , " native" ) &&
554+ } else if (set_contains (info -> system_call_architectures , UINT32_TO_PTR ( native + 1 ) ) &&
550555 set_size (info -> system_call_architectures ) == 1 ) {
551556 b = 0 ;
552557 d = strdup ("Service may execute system calls only with native ABI" );
@@ -564,8 +569,6 @@ static int assess_system_call_architectures(
564569 return 0 ;
565570}
566571
567- #if HAVE_SECCOMP
568-
569572static bool syscall_names_in_filter (Hashmap * s , bool allow_list , const SyscallFilterSet * f , const char * * ret_offending_syscall ) {
570573 const char * syscall ;
571574
@@ -587,7 +590,7 @@ static bool syscall_names_in_filter(Hashmap *s, bool allow_list, const SyscallFi
587590 if (id < 0 )
588591 continue ;
589592
590- if (hashmap_contains (s , syscall ) = = allow_list ) {
593+ if (hashmap_contains (s , syscall ) ! = allow_list ) {
591594 log_debug ("Offending syscall filter item: %s" , syscall );
592595 if (ret_offending_syscall )
593596 * ret_offending_syscall = syscall ;
@@ -1476,6 +1479,7 @@ static const struct security_assessor security_assessor_table[] = {
14761479 .assess = assess_bool ,
14771480 .offset = offsetof(SecurityInfo , restrict_address_family_other ),
14781481 },
1482+ #if HAVE_SECCOMP
14791483 {
14801484 .id = "SystemCallArchitectures=" ,
14811485 .json_field = "SystemCallArchitectures" ,
@@ -1484,7 +1488,6 @@ static const struct security_assessor security_assessor_table[] = {
14841488 .range = 10 ,
14851489 .assess = assess_system_call_architectures ,
14861490 },
1487- #if HAVE_SECCOMP
14881491 {
14891492 .id = "SystemCallFilter=~@swap" ,
14901493 .json_field = "SystemCallFilter_swap" ,
0 commit comments