The commit is pushed to "branch-rh7-3.10.0-1127.18.2.vz7.163.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git after rh7-3.10.0-1127.18.2.vz7.163.41 ------> commit 6bdca3581e557b7370e35e1d471b236afde05e4d Author: Andrey Zhadchenko <andrey.zhadche...@virtuozzo.com> Date: Thu Oct 29 17:00:59 2020 +0300
netlink: add an option to set sk->err from userspace Sometimes during dump criu can encounter sockets with overflown kernel buffer, which results in ENOBUFS error during next read. We need an reliable way to restore sk->sk_err. v2: add an option to return EINVAL https://jira.sw.ru/browse/PSBM-120976 Signed-off-by: Andrey Zhadchenko <andrey.zhadche...@virtuozzo.com> --- include/uapi/linux/netlink.h | 1 + net/netlink/af_netlink.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/include/uapi/linux/netlink.h b/include/uapi/linux/netlink.h index 3756be5..62f8b4b 100644 --- a/include/uapi/linux/netlink.h +++ b/include/uapi/linux/netlink.h @@ -115,6 +115,7 @@ struct nlmsgerr { #define NETLINK_CAP_ACK 10 #define NETLINK_REPAIR2 127 +#define NETLINK_SETERR 128 struct nl_pktinfo { __u32 group; diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 6c99bca..6e0af810 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -1542,6 +1542,16 @@ static int netlink_setsockopt(struct socket *sock, int level, int optname, nlk->flags &= ~NETLINK_F_REPAIR; err = 0; break; + case NETLINK_SETERR: + err = -ENOPROTOOPT; + if (nlk->flags & NETLINK_F_REPAIR) { + if (!val || val > MAX_ERRNO) + return -EINVAL; + sk->sk_err = val; + sk->sk_error_report(sk); + err = 0; + } + break; case NETLINK_PKTINFO: if (val) nlk->flags |= NETLINK_F_RECV_PKTINFO; _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel