diff --git a/src/kernel_abi.cc b/src/kernel_abi.cc index e547affee6c..e8f5ca461a1 100644 --- a/src/kernel_abi.cc +++ b/src/kernel_abi.cc @@ -20,6 +20,8 @@ #include #include #include +#include +#include #include #include #include diff --git a/src/kernel_abi.h b/src/kernel_abi.h index a571717448a..eb410082f3c 100644 --- a/src/kernel_abi.h +++ b/src/kernel_abi.h @@ -525,12 +525,36 @@ struct BaseArch : public wordsize, ptr sival_ptr; }; + struct in_addr { + uint32_t s_addr; + }; + RR_VERIFY_TYPE(in_addr); + + struct in6_addr { + union { + /* don't call these s6_addrX - those are macros */ + uint8_t addr8[16]; + uint16_t addr16[8]; + uint32_t addr32[4]; + }; + }; + RR_VERIFY_TYPE(in_addr); + struct sockaddr { unsigned_short sa_family; char sa_data[14]; }; RR_VERIFY_TYPE(sockaddr); + struct sockaddr_in6 { + unsigned_short sin6_family; + unsigned_short sin6_port; + uint32_t sin6_flowinfo; + in6_addr sin6_addr; + uint32_t sin6_scope_id; + }; + RR_VERIFY_TYPE(sockaddr_in6); + struct sockaddr_storage { char sa_data[128]; }; @@ -1049,6 +1073,24 @@ struct BaseArch : public wordsize, }; RR_VERIFY_TYPE(iwreq); + struct sioc_sg_req { + in_addr src; + in_addr grp; + unsigned long pktcnt; + unsigned long bytecnt; + unsigned long wrong_if; + }; + RR_VERIFY_TYPE(sioc_sg_req); + + struct sioc_sg_req6 { + sockaddr_in6 src; + sockaddr_in6 grp; + unsigned long pktcnt; + unsigned long bytecnt; + unsigned long wrong_if; + }; + RR_VERIFY_TYPE(sioc_sg_req6); + struct _flock { signed_short l_type; signed_short l_whence; diff --git a/src/record_syscall.cc b/src/record_syscall.cc index d6740156027..89298dcf62a 100644 --- a/src/record_syscall.cc +++ b/src/record_syscall.cc @@ -23,6 +23,8 @@ #include #include #include +#include +#include #include #include #include @@ -1718,6 +1720,22 @@ static Switchable prepare_ioctl(RecordTask* t, syscall_state.after_syscall_action(record_page_below_stack_ptr); return PREVENT_SWITCH; +#if 0 + /* TODO: the IPv4 and IPv6 variants of this ioctl have the same value. + * (SIOCPROTOPRIVATE+1) - and there are other uses of this in other + * protocols. So this probably needs a dispatch by fd socket type :( + */ + case SIOCGETSGCNT: + syscall_state.reg_parameter(3); + syscall_state.after_syscall_action(record_page_below_stack_ptr); + return PREVENT_SWITCH; +#endif + + case SIOCGETSGCNT_IN6: + syscall_state.reg_parameter(3); + syscall_state.after_syscall_action(record_page_below_stack_ptr); + return PREVENT_SWITCH; + // https://github.com/torvalds/linux/blob/254ec036db1123b10e23e1412c191a3cf70dce71/net/bridge/br_ioctl.c#L316-L369 case SIOCGIFBR: { auto params = syscall_state.reg_parameter(3, IN);