libseccomp icon indicating copy to clipboard operation
libseccomp copied to clipboard

RFE: Resolve SCMP_ARCH_* constants to architecture name

Open r10r opened this issue 3 years ago • 4 comments

What about adding seccomp_arch_name (inverse of seccomp_arch_resolve_name) to the API ?

It would be nice (e.g to debug rule generation) if the SCMP_ARCH_* constants can be resolved to the architecture names. I noticed that this is already implemented and would require only a small amount of refactoring: https://github.com/seccomp/libseccomp/blob/3734fdc1f6a863cbef0377db1fe239791794be84/src/gen_pfc.c#L51-L95 So why not expose this in the API ? e.g.

const char * seccomp_arch_name(uint32_t arch);

r10r avatar Oct 13 '20 12:10 r10r

Hi @r10r.

Sure, that sounds reasonable. The right thing to do would probably be to add a const char *name field to struct arch_def and then just leverage the existing arch_def_lookup() to create a new API function seccomp_arch_resolve_token() or similar. Does that sound okay to you?

@drakenclimber any thoughts?

pcmoore avatar Oct 13 '20 13:10 pcmoore

That sounds good. Does it help when I make the changes (on top of master) and send you a pull request?

r10r avatar Oct 13 '20 14:10 r10r

@drakenclimber any thoughts?

Yes, this sounds like a good API to add, and I think your proposed implementation should work well.

Does it help when I make the changes (on top of master) and send you a pull request?

Yes, that would be awesome! Once it's in master, we can handle getting it into the v2.5 release branch.

Thanks so much for the help :)

drakenclimber avatar Oct 13 '20 16:10 drakenclimber

Once it's in master, we can handle getting it into the v2.5 release branch.

Since this is adding a new function to the API, I would suggest that this should be a candidate for v2.6.0 and not v2.5.x.

pcmoore avatar Oct 15 '20 00:10 pcmoore