Search code examples
bpfseccomp

In libseccomp, what is scmp_filter_ctx? And what is it used for?


What actually stores scmp_filter_ctx since it's defined as void? See seccomp header file.

In general what is a context ?


Solution

  • It's not defined as void but void *, so it's a generic pointer.

    From a quick glance at the file you link I would say it points to some object which structure you can't access (and don't need to know about). The context seems to be the object storing the information seccomp needs to work, and you only need to init, update or use it through the API functions exposed in that header file.

    If you really want to see what's inside, just read the source :). In src/api.c it's apparently casted as a struct db_filter_col *, which of course is not exposed to users.