File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change 3030#include "macro.h"
3131#include "nsflags.h"
3232#include "seccomp-util.h"
33+ #include "set.h"
3334#include "string-util.h"
35+ #include "strv.h"
3436#include "util.h"
3537#include "errno-list.h"
3638
@@ -1313,3 +1315,33 @@ int seccomp_restrict_archs(Set *archs) {
13131315
13141316 return seccomp_load (seccomp );
13151317}
1318+
1319+ int parse_syscall_archs (char * * l , Set * * archs ) {
1320+ _cleanup_set_free_ Set * _archs ;
1321+ char * * s ;
1322+ int r ;
1323+
1324+ assert (l );
1325+ assert (archs );
1326+
1327+ r = set_ensure_allocated (& _archs , NULL );
1328+ if (r < 0 )
1329+ return r ;
1330+
1331+ STRV_FOREACH (s , l ) {
1332+ uint32_t a ;
1333+
1334+ r = seccomp_arch_from_string (* s , & a );
1335+ if (r < 0 )
1336+ return - EINVAL ;
1337+
1338+ r = set_put (_archs , UINT32_TO_PTR (a + 1 ));
1339+ if (r < 0 )
1340+ return - ENOMEM ;
1341+ }
1342+
1343+ * archs = _archs ;
1344+ _archs = NULL ;
1345+
1346+ return 0 ;
1347+ }
Original file line number Diff line number Diff line change @@ -84,3 +84,5 @@ extern const uint32_t seccomp_local_archs[];
8484 (arch) = seccomp_local_archs[++_i])
8585
8686DEFINE_TRIVIAL_CLEANUP_FUNC (scmp_filter_ctx , seccomp_release );
87+
88+ int parse_syscall_archs (char * * l , Set * * archs );
You can’t perform that action at this time.
0 commit comments