seccomp: Use own seccomp_metadata_t type

Submitted by Cyrill Gorcunov on May 18, 2018, 8:41 a.m.

Details

Message ID 20180518084149.11618-1-gorcunov@gmail.com
State New
Series "seccomp: Use own seccomp_metadata_t type"
Headers show

Commit Message

Cyrill Gorcunov May 18, 2018, 8:41 a.m.
On fedora rawhide seccomp_metadata for some
reason is not defined (while in kernel it introduced
together with PTRACE_SECCOMP_GET_METADATA). So
lets do a trick for a while -- define own alias.
Once system headers get settled down we might find
more suitable solution. Because it's a part of kernel
API we're on the safe side.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
 compel/include/uapi/ptrace.h | 4 ++--
 criu/seccomp.c               | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/compel/include/uapi/ptrace.h b/compel/include/uapi/ptrace.h
index fcc2d62b08e4..85c0a84e308d 100644
--- a/compel/include/uapi/ptrace.h
+++ b/compel/include/uapi/ptrace.h
@@ -53,10 +53,10 @@ 
 #ifndef PTRACE_SECCOMP_GET_METADATA
 # define PTRACE_SECCOMP_GET_METADATA	0x420d
 
-struct seccomp_metadata {
+typedef struct {
 	uint64_t	filter_off;	/* Input: which filter */
 	uint64_t	flags;		/* Output: filter's flags */
-};
+} seccomp_metadata_t;
 
 #endif /* PTRACE_SECCOMP_GET_METADATA */
 
diff --git a/criu/seccomp.c b/criu/seccomp.c
index d5da6475fcf8..78a87352d133 100644
--- a/criu/seccomp.c
+++ b/criu/seccomp.c
@@ -131,7 +131,7 @@  int seccomp_dump_thread(pid_t tid_real, ThreadCoreEntry *thread_core)
 
 static int collect_filter(struct seccomp_entry *entry)
 {
-	struct seccomp_metadata meta_buf, *meta = &meta_buf;
+	seccomp_metadata_t meta_buf, *meta = &meta_buf;
 	struct seccomp_filter_chain *chain, *prev;
 	struct sock_filter buf[BPF_MAXINSNS];
 	size_t i;

Comments

Andrei Vagin May 22, 2018, 8:14 p.m.
https://travis-ci.org/criupatchwork/criu/builds/380591639?utm_source=github_status&utm_medium=notification

On Fri, May 18, 2018 at 11:41:49AM +0300, Cyrill Gorcunov wrote:
> On fedora rawhide seccomp_metadata for some
> reason is not defined (while in kernel it introduced
> together with PTRACE_SECCOMP_GET_METADATA). So
> lets do a trick for a while -- define own alias.
> Once system headers get settled down we might find
> more suitable solution. Because it's a part of kernel
> API we're on the safe side.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
> ---
>  compel/include/uapi/ptrace.h | 4 ++--
>  criu/seccomp.c               | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/compel/include/uapi/ptrace.h b/compel/include/uapi/ptrace.h
> index fcc2d62b08e4..85c0a84e308d 100644
> --- a/compel/include/uapi/ptrace.h
> +++ b/compel/include/uapi/ptrace.h
> @@ -53,10 +53,10 @@
>  #ifndef PTRACE_SECCOMP_GET_METADATA
>  # define PTRACE_SECCOMP_GET_METADATA	0x420d
>  
> -struct seccomp_metadata {
> +typedef struct {
>  	uint64_t	filter_off;	/* Input: which filter */
>  	uint64_t	flags;		/* Output: filter's flags */
> -};
> +} seccomp_metadata_t;
>  
>  #endif /* PTRACE_SECCOMP_GET_METADATA */
>  
> diff --git a/criu/seccomp.c b/criu/seccomp.c
> index d5da6475fcf8..78a87352d133 100644
> --- a/criu/seccomp.c
> +++ b/criu/seccomp.c
> @@ -131,7 +131,7 @@ int seccomp_dump_thread(pid_t tid_real, ThreadCoreEntry *thread_core)
>  
>  static int collect_filter(struct seccomp_entry *entry)
>  {
> -	struct seccomp_metadata meta_buf, *meta = &meta_buf;
> +	seccomp_metadata_t meta_buf, *meta = &meta_buf;
>  	struct seccomp_filter_chain *chain, *prev;
>  	struct sock_filter buf[BPF_MAXINSNS];
>  	size_t i;
> -- 
> 2.14.3
>