Message ID | 8ebe7816326a74d7188c0a5a566ad4180a8fb4a3.1638487717.git.luke.nowakowskikrijger@canonical.com |
---|---|
State | New |
Headers | show |
Series | Fix storage size of 'md' isn't known issue in selftests/seccomp for B/5.4 | expand |
On 03.12.21 00:43, Luke Nowakowski-Krijger wrote: > BugLink: https://bugs.launchpad.net/bugs/1896420 > > There is a build issue on Bionic/5.4 kernels due to > PTRACE_SECCOMP_GET_METADATA being defined in glibc header sys/ptrace.h, > which then stops struct seccomp_metadata from being defined leading to: > seccomp_bpf.c:3028:26: error: storage size of 'md' isn't known > > The solution here is to unconditonally define the seccomp_metadata > definition that we need, and remove the linux/ptrace.h header where a > definition of seccomp_metadata exists in Focal. > > Signed-off-by: Luke Nowakowski-Krijger <luke.nowakowskikrijger@canonical.com> Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com> Thanks > --- > v2: Added comment to explain why there is a header definiton being > defined in the file and to suggest to future developers that they > might have to do the same for future fixes for defintion issues like > this. > > tools/testing/selftests/seccomp/seccomp_bpf.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c > index e9a00d26666f..64f2b43bc59b 100644 > --- a/tools/testing/selftests/seccomp/seccomp_bpf.c > +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c > @@ -26,7 +26,6 @@ > #include <sys/ptrace.h> > #include <sys/user.h> > #include <linux/prctl.h> > -#include <linux/ptrace.h> > #include <linux/seccomp.h> > #include <pthread.h> > #include <semaphore.h> > @@ -158,12 +157,17 @@ struct seccomp_data { > > #ifndef PTRACE_SECCOMP_GET_METADATA > #define PTRACE_SECCOMP_GET_METADATA 0x420d > +#endif > > +/* > + * There are conflicting definitions in ptrace system headers that lead to > + * struct seccomp_metadata to not be defined. So until those conflicts get > + * sorted out, we should rely on some of our own in-tree ptrace definitions. > + */ > struct seccomp_metadata { > __u64 filter_off; /* Input: which filter */ > __u64 flags; /* Output: filter's flags */ > }; > -#endif > > #ifndef SECCOMP_FILTER_FLAG_NEW_LISTENER > #define SECCOMP_FILTER_FLAG_NEW_LISTENER (1UL << 3)
On 03.12.21 00:43, Luke Nowakowski-Krijger wrote: > BugLink: https://bugs.launchpad.net/bugs/1896420 > > There is a build issue on Bionic/5.4 kernels due to > PTRACE_SECCOMP_GET_METADATA being defined in glibc header sys/ptrace.h, > which then stops struct seccomp_metadata from being defined leading to: > seccomp_bpf.c:3028:26: error: storage size of 'md' isn't known > > The solution here is to unconditonally define the seccomp_metadata > definition that we need, and remove the linux/ptrace.h header where a > definition of seccomp_metadata exists in Focal. > > Signed-off-by: Luke Nowakowski-Krijger <luke.nowakowskikrijger@canonical.com> Acked-by: Stefan Bader <stefan.bader@canonical.com> > --- > v2: Added comment to explain why there is a header definiton being > defined in the file and to suggest to future developers that they > might have to do the same for future fixes for defintion issues like > this. > > tools/testing/selftests/seccomp/seccomp_bpf.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c > index e9a00d26666f..64f2b43bc59b 100644 > --- a/tools/testing/selftests/seccomp/seccomp_bpf.c > +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c > @@ -26,7 +26,6 @@ > #include <sys/ptrace.h> > #include <sys/user.h> > #include <linux/prctl.h> > -#include <linux/ptrace.h> > #include <linux/seccomp.h> > #include <pthread.h> > #include <semaphore.h> > @@ -158,12 +157,17 @@ struct seccomp_data { > > #ifndef PTRACE_SECCOMP_GET_METADATA > #define PTRACE_SECCOMP_GET_METADATA 0x420d > +#endif > > +/* > + * There are conflicting definitions in ptrace system headers that lead to > + * struct seccomp_metadata to not be defined. So until those conflicts get > + * sorted out, we should rely on some of our own in-tree ptrace definitions. > + */ > struct seccomp_metadata { > __u64 filter_off; /* Input: which filter */ > __u64 flags; /* Output: filter's flags */ > }; > -#endif > > #ifndef SECCOMP_FILTER_FLAG_NEW_LISTENER > #define SECCOMP_FILTER_FLAG_NEW_LISTENER (1UL << 3) >
diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c index e9a00d26666f..64f2b43bc59b 100644 --- a/tools/testing/selftests/seccomp/seccomp_bpf.c +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c @@ -26,7 +26,6 @@ #include <sys/ptrace.h> #include <sys/user.h> #include <linux/prctl.h> -#include <linux/ptrace.h> #include <linux/seccomp.h> #include <pthread.h> #include <semaphore.h> @@ -158,12 +157,17 @@ struct seccomp_data { #ifndef PTRACE_SECCOMP_GET_METADATA #define PTRACE_SECCOMP_GET_METADATA 0x420d +#endif +/* + * There are conflicting definitions in ptrace system headers that lead to + * struct seccomp_metadata to not be defined. So until those conflicts get + * sorted out, we should rely on some of our own in-tree ptrace definitions. + */ struct seccomp_metadata { __u64 filter_off; /* Input: which filter */ __u64 flags; /* Output: filter's flags */ }; -#endif #ifndef SECCOMP_FILTER_FLAG_NEW_LISTENER #define SECCOMP_FILTER_FLAG_NEW_LISTENER (1UL << 3)
BugLink: https://bugs.launchpad.net/bugs/1896420 There is a build issue on Bionic/5.4 kernels due to PTRACE_SECCOMP_GET_METADATA being defined in glibc header sys/ptrace.h, which then stops struct seccomp_metadata from being defined leading to: seccomp_bpf.c:3028:26: error: storage size of 'md' isn't known The solution here is to unconditonally define the seccomp_metadata definition that we need, and remove the linux/ptrace.h header where a definition of seccomp_metadata exists in Focal. Signed-off-by: Luke Nowakowski-Krijger <luke.nowakowskikrijger@canonical.com> --- v2: Added comment to explain why there is a header definiton being defined in the file and to suggest to future developers that they might have to do the same for future fixes for defintion issues like this. tools/testing/selftests/seccomp/seccomp_bpf.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)