From cf62ffc4ea46fb8e375e2c49b0e1ef905c08d24b Mon Sep 17 00:00:00 2001 From: Luca Guerra Date: Wed, 21 Feb 2024 15:04:10 +0000 Subject: [PATCH 1/2] fix(tests): fix warning for unshare Signed-off-by: Luca Guerra --- test/libsinsp_e2e/vtidcollision.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/libsinsp_e2e/vtidcollision.c b/test/libsinsp_e2e/vtidcollision.c index cd903eebb2..180ac5fe2d 100644 --- a/test/libsinsp_e2e/vtidcollision.c +++ b/test/libsinsp_e2e/vtidcollision.c @@ -16,6 +16,7 @@ limitations under the License. */ +#define _GNU_SOURCE #include #include #include @@ -26,7 +27,6 @@ limitations under the License. #include #include -#define _GNU_SOURCE #include /** From 3a73fb4f3be534c0f7fb4e717adf2f939be9885b Mon Sep 17 00:00:00 2001 From: Luca Guerra Date: Wed, 21 Feb 2024 15:04:41 +0000 Subject: [PATCH 2/2] cleanup(libsinsp): fix misaligned access to cmsghdr Signed-off-by: Luca Guerra --- userspace/libsinsp/parsers.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/userspace/libsinsp/parsers.cpp b/userspace/libsinsp/parsers.cpp index af83388f0c..6e4e919939 100644 --- a/userspace/libsinsp/parsers.cpp +++ b/userspace/libsinsp/parsers.cpp @@ -4151,8 +4151,9 @@ void sinsp_parser::parse_rw_exit(sinsp_evt *evt) parinfo = evt->get_param(4); if(parinfo->m_len > sizeof(cmsghdr)) { - cmsghdr *cmsg = (cmsghdr *)parinfo->m_val; - if(cmsg->cmsg_type == SCM_RIGHTS) + cmsghdr cmsg; + memcpy(&cmsg, parinfo->m_val, sizeof(cmsghdr)); + if(cmsg.cmsg_type == SCM_RIGHTS) { char error[SCAP_LASTERR_SIZE]; scap_threadinfo scap_tinfo {};