linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Sean Tranchetti <stranche@codeaurora.org>,
	Steffen Klassert <steffen.klassert@secunet.com>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 4.4 006/114] xfrm: validate template mode
Date: Thu,  8 Nov 2018 13:50:21 -0800	[thread overview]
Message-ID: <20181108215059.533003683@linuxfoundation.org> (raw)
In-Reply-To: <20181108215059.051093652@linuxfoundation.org>

4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

[ 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




  parent reply	other threads:[~2018-11-08 21:58 UTC|newest]

Thread overview: 129+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-08 21:50 [PATCH 4.4 000/114] 4.4.163-stable review Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 001/114] xfrm: Validate address prefix lengths in the xfrm selector Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 002/114] xfrm6: call kfree_skb when skb is toobig Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 003/114] mac80211: Always report TX status Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 004/114] cfg80211: reg: Init wiphy_idx in regulatory_hint_core() Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 005/114] ARM: 8799/1: mm: fix pci_ioremap_io() offset check Greg Kroah-Hartman
2018-11-08 21:50 ` Greg Kroah-Hartman [this message]
2018-11-08 21:50 ` [PATCH 4.4 007/114] mac80211_hwsim: do not omit multicast announce of first added radio Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 008/114] Bluetooth: SMP: fix crash in unpairing Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 009/114] pxa168fb: prepare the clock Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 010/114] asix: Check for supported Wake-on-LAN modes Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 011/114] ax88179_178a: " Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 012/114] lan78xx: " Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 013/114] sr9800: " Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 014/114] r8152: Check for supported Wake-on-LAN Modes Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 015/114] smsc75xx: Check for Wake-on-LAN modes Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 016/114] smsc95xx: " Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 017/114] perf/ring_buffer: Prevent concurent ring buffer access Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 018/114] net: cxgb3_main: fix a missing-check bug Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 019/114] KEYS: put keyring if install_session_keyring_to_cred() fails Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 020/114] ipv6: suppress sparse warnings in IP6_ECN_set_ce() Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 021/114] net: drop write-only stack variable Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 022/114] ser_gigaset: use container_of() instead of detour Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 023/114] tracing: Skip more functions when doing stack tracing of events Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 024/114] ARM: dts: apq8064: add ahci ports-implemented mask Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 025/114] x86/mm/pat: Prevent hang during boot when mapping pages Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 026/114] btrfs: cleaner_kthread() doesnt need explicit freeze Greg Kroah-Hartman
2018-11-08 23:28   ` David Sterba
2018-11-09  0:04     ` Sasha Levin
2018-11-09  0:22       ` Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 027/114] radix-tree: fix radix_tree_iter_retry() for tagged iterators Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 028/114] af_iucv: Move sockaddr length checks to before accessing sa_family in bind and connect handlers Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 029/114] net/mlx4_en: Resolve dividing by zero in 32-bit system Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 030/114] ipv6: orphan skbs in reassembly unit Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 031/114] um: Avoid longjmp/setjmp symbol clashes with libpthread.a Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 032/114] sched/cgroup: Fix cgroup entity load tracking tear-down Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 033/114] btrfs: dont create or leak aliased root while cleaning up orphans Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 034/114] thermal: allow spear-thermal driver to be a module Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 035/114] thermal: allow u8500-thermal " Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 036/114] tpm: fix: return rc when devm_add_action() fails Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 037/114] x86/PCI: Mark Broadwell-EP Home Agent 1 as having non-compliant BARs Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 038/114] aacraid: Start adapter after updating number of MSIX vectors Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 039/114] perf/core: Dont leak event in the syscall error path Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 040/114] [media] usbvision: revert commit 588afcc1 Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 041/114] MIPS: Fix FCSR Cause bit handling for correct SIGFPE issue Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 042/114] ASoC: ak4613: Enable cache usage to fix crashes on resume Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 043/114] ASoC: wm8940: " Greg Kroah-Hartman
2018-11-08 21:50 ` [PATCH 4.4 044/114] CIFS: handle guest access errors to Windows shares Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 045/114] arm64: Fix potential race with hardware DBM in ptep_set_access_flags() Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 046/114] xfrm: Clear sk_dst_cache when applying per-socket policy Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 047/114] scsi: Add STARGET_CREATED_REMOVE state to scsi_target_state Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 048/114] sparc/pci: Refactor dev_archdata initialization into pci_init_dev_archdata Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 049/114] sch_red: update backlog as well Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 050/114] usb-storage: fix bogus hardware error messages for ATA pass-thru devices Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 051/114] bpf: generally move prog destruction to RCU deferral Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 052/114] drm/nouveau/fbcon: fix oops without fbdev emulation Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 053/114] fuse: Dont call set_page_dirty_lock() for ITER_BVEC pages for async_dio Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 054/114] ixgbevf: Fix handling of NAPI budget when multiple queues are enabled per vector Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 055/114] net/mlx5e: Fix LRO modify Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 056/114] net/mlx5e: Correctly handle RSS indirection table when changing number of channels Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 057/114] ixgbe: fix RSS limit for X550 Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 058/114] ixgbe: Correct X550EM_x revision check Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 059/114] ALSA: timer: Fix zero-division by continue of uninitialized instance Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 060/114] vti6: flush x-netns xfrm cache when vti interface is removed Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 061/114] gro: Allow tunnel stacking in the case of FOU/GUE Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 062/114] brcmfmac: Fix glom_skb leak in brcmf_sdiod_recv_chain Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 063/114] l2tp: hold socket before dropping lock in l2tp_ip{, 6}_recv() Greg Kroah-Hartman
2018-11-09 15:33   ` Guillaume Nault
2018-11-09 16:28     ` Greg Kroah-Hartman
2018-11-09 16:30       ` Guillaume Nault
2018-11-08 21:51 ` [PATCH 4.4 064/114] tty: serial: sprd: fix error return code in sprd_probe() Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 065/114] video: fbdev: pxa3xx_gcu: fix error return code in pxa3xx_gcu_probe() Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 066/114] sparc64 mm: Fix more TSB sizing issues Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 067/114] gpu: host1x: fix error return code in host1x_probe() Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 068/114] sparc64: Fix exception handling in UltraSPARC-III memcpy Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 069/114] gpio: msic: fix error return code in platform_msic_gpio_probe() Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 070/114] usb: imx21-hcd: fix error return code in imx21_probe() Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 071/114] usb: ehci-omap: fix error return code in ehci_hcd_omap_probe() Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 072/114] usb: dwc3: omap: fix error return code in dwc3_omap_probe() Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 073/114] spi/bcm63xx-hspi: fix error return code in bcm63xx_hsspi_probe() Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 074/114] MIPS: Handle non word sized instructions when examining frame Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 075/114] spi/bcm63xx: fix error return code in bcm63xx_spi_probe() Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 076/114] spi: xlp: fix error return code in xlp_spi_probe() Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 077/114] ASoC: spear: fix error return code in spdif_in_probe() Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 078/114] PM / devfreq: tegra: fix error return code in tegra_devfreq_probe() Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 079/114] bonding: avoid defaulting hard_header_len to ETH_HLEN on slave removal Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 080/114] scsi: aacraid: Fix typo in blink status Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 081/114] MIPS: microMIPS: Fix decoding of swsp16 instruction Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 082/114] igb: Remove superfluous reset to PHY and page 0 selection Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 083/114] MIPS: DEC: Fix an int-handler.S CPU_DADDI_WORKAROUNDS regression Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 084/114] ARM: dts: imx53-qsb: disable 1.2GHz OPP Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 085/114] fs/fat/fatent.c: add cond_resched() to fat_count_free_clusters() Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 086/114] mtd: spi-nor: Add support for is25wp series chips Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 087/114] perf tools: Disable parallelism for make clean Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 088/114] bridge: do not add port to router list when receives query with source 0.0.0.0 Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 089/114] net: bridge: remove ipv6 zero address check in mcast queries Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 090/114] ipv6: mcast: fix a use-after-free in inet6_mc_check Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 091/114] ipv6/ndisc: Preserve IPv6 control buffer if protocol error handlers are called Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 092/114] net/ipv6: Fix index counter for unicast addresses in in6_dump_addrs Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 093/114] net: sched: gred: pass the right attribute to gred_change_table_def() Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 094/114] net: socket: fix a missing-check bug Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 095/114] net: stmmac: Fix stmmac_mdio_reset() when building stmmac as modules Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 096/114] r8169: fix NAPI handling under high load Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 097/114] sctp: fix race on sctp_id2asoc Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 098/114] net: drop skb on failure in ip_check_defrag() Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 099/114] vhost: Fix Spectre V1 vulnerability Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 100/114] rtnetlink: Disallow FDB configuration for non-Ethernet device Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 101/114] mremap: properly flush TLB before releasing the page Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 102/114] crypto: shash - Fix a sleep-in-atomic bug in shash_setkey_unaligned Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 103/114] ahci: dont ignore result code of ahci_reset_controller() Greg Kroah-Hartman
2018-11-08 21:51 ` [PATCH 4.4 104/114] cachefiles: fix the race between cachefiles_bury_object() and rmdir(2) Greg Kroah-Hartman
2018-11-08 21:52 ` [PATCH 4.4 105/114] ptp: fix Spectre v1 vulnerability Greg Kroah-Hartman
2018-11-08 21:52 ` [PATCH 4.4 106/114] RDMA/ucma: Fix " Greg Kroah-Hartman
2018-11-08 21:52 ` [PATCH 4.4 107/114] IB/ucm: " Greg Kroah-Hartman
2018-11-08 21:52 ` [PATCH 4.4 108/114] cdc-acm: correct counting of UART states in serial state notification Greg Kroah-Hartman
2018-11-08 21:52 ` [PATCH 4.4 109/114] usb: gadget: storage: Fix Spectre v1 vulnerability Greg Kroah-Hartman
2018-11-08 21:52 ` [PATCH 4.4 110/114] USB: fix the usbfs flag sanitization for control transfers Greg Kroah-Hartman
2018-11-08 21:52 ` [PATCH 4.4 111/114] Input: elan_i2c - add ACPI ID for Lenovo IdeaPad 330-15IGM Greg Kroah-Hartman
2018-11-08 21:52 ` [PATCH 4.4 112/114] sched/fair: Fix throttle_list starvation with low CFS quota Greg Kroah-Hartman
2018-11-08 21:52 ` [PATCH 4.4 113/114] x86/percpu: Fix this_cpu_read() Greg Kroah-Hartman
2018-11-08 21:52 ` [PATCH 4.4 114/114] x86/time: Correct the attribute on jiffies definition Greg Kroah-Hartman
2018-11-09 13:50 ` [PATCH 4.4 000/114] 4.4.163-stable review Guenter Roeck
2018-11-09 14:14   ` Guenter Roeck
2018-11-09 16:15     ` Greg Kroah-Hartman
2018-11-09 14:46   ` Greg Kroah-Hartman
2018-11-09 19:44 ` Shuah Khan
2018-11-09 21:30 ` Guenter Roeck
2018-11-10 15:22   ` Greg Kroah-Hartman
2018-11-09 21:55 ` Dan Rue

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=20181108215059.533003683@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sashal@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;
as well as URLs for NNTP newsgroup(s).