From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Sean Tranchetti <stranche@codeaurora.org>,
Steffen Klassert <steffen.klassert@secunet.com>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH AUTOSEL 4.4 07/25] xfrm: validate template mode
Date: Tue, 16 Oct 2018 00:15:48 -0400 [thread overview]
Message-ID: <20181016041606.135876-7-sashal@kernel.org> (raw)
In-Reply-To: <20181016041606.135876-1-sashal@kernel.org>
From: Sean Tranchetti <stranche@codeaurora.org>
[ Upstream commit 32bf94fb5c2ec4ec842152d0e5937cd4bb6738fa ]
XFRM mode parameters passed as part of the user templates
in the IP_XFRM_POLICY are never properly validated. Passing
values other than valid XFRM modes can cause stack-out-of-bounds
reads to occur later in the XFRM processing:
[ 140.535608] ================================================================
[ 140.543058] BUG: KASAN: stack-out-of-bounds in xfrm_state_find+0x17e4/0x1cc4
[ 140.550306] Read of size 4 at addr ffffffc0238a7a58 by task repro/5148
[ 140.557369]
[ 140.558927] Call trace:
[ 140.558936] dump_backtrace+0x0/0x388
[ 140.558940] show_stack+0x24/0x30
[ 140.558946] __dump_stack+0x24/0x2c
[ 140.558949] dump_stack+0x8c/0xd0
[ 140.558956] print_address_description+0x74/0x234
[ 140.558960] kasan_report+0x240/0x264
[ 140.558963] __asan_report_load4_noabort+0x2c/0x38
[ 140.558967] xfrm_state_find+0x17e4/0x1cc4
[ 140.558971] xfrm_resolve_and_create_bundle+0x40c/0x1fb8
[ 140.558975] xfrm_lookup+0x238/0x1444
[ 140.558977] xfrm_lookup_route+0x48/0x11c
[ 140.558984] ip_route_output_flow+0x88/0xc4
[ 140.558991] raw_sendmsg+0xa74/0x266c
[ 140.558996] inet_sendmsg+0x258/0x3b0
[ 140.559002] sock_sendmsg+0xbc/0xec
[ 140.559005] SyS_sendto+0x3a8/0x5a8
[ 140.559008] el0_svc_naked+0x34/0x38
[ 140.559009]
[ 140.592245] page dumped because: kasan: bad access detected
[ 140.597981] page_owner info is not active (free page?)
[ 140.603267]
[ 140.653503] ================================================================
Signed-off-by: Sean Tranchetti <stranche@codeaurora.org>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/xfrm/xfrm_user.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index c2e98dcba9fe..476f1fc6d655 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -1408,6 +1408,9 @@ static int validate_tmpl(int nr, struct xfrm_user_tmpl *ut, u16 family)
(ut[i].family != prev_family))
return -EINVAL;
+ if (ut[i].mode >= XFRM_MODE_MAX)
+ return -EINVAL;
+
prev_family = ut[i].family;
switch (ut[i].family) {
--
2.17.1
next prev parent reply other threads:[~2018-10-16 4:15 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-16 4:15 [PATCH AUTOSEL 4.4 01/25] xfrm: Validate address prefix lengths in the xfrm selector Sasha Levin
2018-10-16 4:15 ` [PATCH AUTOSEL 4.4 02/25] xfrm6: call kfree_skb when skb is toobig Sasha Levin
2018-10-16 4:15 ` [PATCH AUTOSEL 4.4 03/25] mac80211: Always report TX status Sasha Levin
2018-10-16 4:15 ` [PATCH AUTOSEL 4.4 04/25] cfg80211: reg: Init wiphy_idx in regulatory_hint_core() Sasha Levin
2018-10-16 4:15 ` [PATCH AUTOSEL 4.4 05/25] cfg80211: Address some corner cases in scan result channel updating Sasha Levin
2018-11-02 9:19 ` Greg KH
2018-10-16 4:15 ` [PATCH AUTOSEL 4.4 06/25] ARM: 8799/1: mm: fix pci_ioremap_io() offset check Sasha Levin
2018-10-16 4:15 ` Sasha Levin [this message]
2018-10-16 4:15 ` [PATCH AUTOSEL 4.4 08/25] mac80211_hwsim: do not omit multicast announce of first added radio Sasha Levin
2018-10-16 4:15 ` [PATCH AUTOSEL 4.4 09/25] Bluetooth: SMP: fix crash in unpairing Sasha Levin
2018-10-16 4:15 ` [PATCH AUTOSEL 4.4 10/25] pxa168fb: prepare the clock Sasha Levin
2018-10-16 4:15 ` [PATCH AUTOSEL 4.4 11/25] bonding: avoid possible dead-lock Sasha Levin
2018-10-16 4:15 ` [PATCH AUTOSEL 4.4 12/25] bnxt_en: Fix TX timeout during netpoll Sasha Levin
2018-10-16 4:15 ` [PATCH AUTOSEL 4.4 13/25] asix: Check for supported Wake-on-LAN modes Sasha Levin
2018-10-16 4:15 ` [PATCH AUTOSEL 4.4 14/25] ax88179_178a: " Sasha Levin
2018-10-16 4:15 ` [PATCH AUTOSEL 4.4 15/25] lan78xx: " Sasha Levin
2018-10-16 4:15 ` [PATCH AUTOSEL 4.4 16/25] sr9800: " Sasha Levin
2018-10-16 4:15 ` [PATCH AUTOSEL 4.4 17/25] r8152: Check for supported Wake-on-LAN Modes Sasha Levin
2018-10-16 4:15 ` [PATCH AUTOSEL 4.4 18/25] smsc75xx: Check for Wake-on-LAN modes Sasha Levin
2018-10-16 4:16 ` [PATCH AUTOSEL 4.4 19/25] smsc95xx: " Sasha Levin
2018-10-16 4:16 ` [PATCH AUTOSEL 4.4 20/25] qlcnic: fix Tx descriptor corruption on 82xx devices Sasha Levin
2018-10-16 4:16 ` [PATCH AUTOSEL 4.4 21/25] i2c: i2c-scmi: fix for i2c_smbus_write_block_data Sasha Levin
2018-10-16 4:16 ` [PATCH AUTOSEL 4.4 22/25] perf/ring_buffer: Prevent concurent ring buffer access Sasha Levin
2018-10-16 4:16 ` [PATCH AUTOSEL 4.4 23/25] net/usb: cancel pending work when unbinding smsc75xx Sasha Levin
2018-10-16 4:16 ` [PATCH AUTOSEL 4.4 24/25] net: cxgb3_main: fix a missing-check bug Sasha Levin
2018-10-16 4:16 ` [PATCH AUTOSEL 4.4 25/25] mm/vmstat.c: fix outdated vmstat_text Sasha Levin
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=20181016041606.135876-7-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=steffen.klassert@secunet.com \
--cc=stranche@codeaurora.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox