From: Dan Carpenter <dan.carpenter@oracle.com>
To: steffen.klassert@secunet.com
Cc: kernel-janitors@vger.kernel.org
Subject: [bug report] xfrm: Add possibility to set the default to block if we have no policy
Date: Mon, 26 Jul 2021 13:30:25 +0300 [thread overview]
Message-ID: <20210726103025.GA26690@kili> (raw)
Hello Steffen Klassert,
The patch 2d151d39073a: "xfrm: Add possibility to set the default to
block if we have no policy" from Jul 18, 2021, leads to the following
static checker warning:
net/xfrm/xfrm_user.c:1969 xfrm_set_default()
error: undefined (user controlled) shift '1 << up->dirmask'
net/xfrm/xfrm_user.c
1964 static int xfrm_set_default(struct sk_buff *skb, struct nlmsghdr *nlh,
1965 struct nlattr **attrs)
1966 {
1967 struct net *net = sock_net(skb->sk);
1968 struct xfrm_userpolicy_default *up = nlmsg_data(nlh);
--> 1969 u8 dirmask = (1 << up->dirmask) & XFRM_POL_DEFAULT_MASK;
^^^^^^^^^^^^^^^^
I believe this does come from the user so it can shift wrap leading to
a syzbot/UBSan warning. I don't know that the shift wrapping will have
any other real world impact.
1970 u8 old_default = net->xfrm.policy_default;
1971
1972 net->xfrm.policy_default = (old_default & (0xff ^ dirmask))
1973 | (up->action << up->dirmask);
1974
1975 rt_genid_bump_all(net);
1976
1977 return 0;
1978 }
regards,
dan carpenter
reply other threads:[~2021-07-26 10:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210726103025.GA26690@kili \
--to=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=steffen.klassert@secunet.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.