From: Kamal Mostafa <kamal@canonical.com>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
kernel-team@lists.ubuntu.com
Cc: Lennert Buytenhek <buytenh@wantstofly.org>,
Marcel Holtmann <marcel@holtmann.org>,
Luis Henriques <luis.henriques@canonical.com>,
Kamal Mostafa <kamal@canonical.com>
Subject: [PATCH 3.19.y-ckt 001/107] ieee802154: Fix sockaddr_ieee802154 implicit padding information leak.
Date: Wed, 5 Aug 2015 14:47:53 -0700 [thread overview]
Message-ID: <1438811379-384-2-git-send-email-kamal@canonical.com> (raw)
In-Reply-To: <1438811379-384-1-git-send-email-kamal@canonical.com>
3.19.8-ckt5 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Lennert Buytenhek <buytenh@wantstofly.org>
commit 8a70cefa3037d62e7c0b6068a66675def1a330c9 upstream.
The AF_IEEE802154 sockaddr looks like this:
struct sockaddr_ieee802154 {
sa_family_t family; /* AF_IEEE802154 */
struct ieee802154_addr_sa addr;
};
struct ieee802154_addr_sa {
int addr_type;
u16 pan_id;
union {
u8 hwaddr[IEEE802154_ADDR_LEN];
u16 short_addr;
};
};
On most architectures there will be implicit structure padding here,
in two different places:
* In struct sockaddr_ieee802154, two bytes of padding between 'family'
(unsigned short) and 'addr', so that 'addr' starts on a four byte
boundary.
* In struct ieee802154_addr_sa, two bytes at the end of the structure,
to make the structure 16 bytes.
When calling recvmsg(2) on a PF_IEEE802154 SOCK_DGRAM socket, the
ieee802154 stack constructs a struct sockaddr_ieee802154 on the
kernel stack without clearing these padding fields, and, depending
on the addr_type, between four and ten bytes of uncleared kernel
stack will be copied to userspace.
We can't just insert two 'u16 __pad's in the right places and zero
those before copying an address to userspace, as not all architectures
insert this implicit padding -- from a quick test it seems that avr32,
cris and m68k don't insert this padding, while every other architecture
that I have cross compilers for does insert this padding.
The easiest way to plug the leak is to just memset the whole struct
sockaddr_ieee802154 before filling in the fields we want to fill in,
and that's what this patch does.
Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Acked-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
[ luis: backported to 3.16:
- file rename: net/ieee802154/socket.c -> net/ieee802154/dgram.c ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
net/ieee802154/dgram.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/ieee802154/dgram.c b/net/ieee802154/dgram.c
index d1930b7..6101194 100644
--- a/net/ieee802154/dgram.c
+++ b/net/ieee802154/dgram.c
@@ -326,6 +326,12 @@ static int dgram_recvmsg(struct kiocb *iocb, struct sock *sk,
sock_recv_ts_and_drops(msg, sk, skb);
if (saddr) {
+ /* Clear the implicit padding in struct sockaddr_ieee802154
+ * (16 bits between 'family' and 'addr') and in struct
+ * ieee802154_addr_sa (16 bits at the end of the structure).
+ */
+ memset(saddr, 0, sizeof(*saddr));
+
saddr->family = AF_IEEE802154;
ieee802154_addr_to_sa(&saddr->addr, &mac_cb(skb)->source);
*addr_len = sizeof(*saddr);
--
1.9.1
next prev parent reply other threads:[~2015-08-05 21:49 UTC|newest]
Thread overview: 111+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-05 21:47 [3.19.y-ckt stable] Linux 3.19.8-ckt5 stable review Kamal Mostafa
2015-08-05 21:47 ` Kamal Mostafa [this message]
2015-08-05 21:47 ` [PATCH 3.19.y-ckt 002/107] evm: labeling pseudo filesystems exception Kamal Mostafa
2015-08-05 21:47 ` [PATCH 3.19.y-ckt 003/107] x86/asm/entry/64: Fold the 'test_in_nmi' macro into its only user Kamal Mostafa
2015-08-05 21:47 ` [PATCH 3.19.y-ckt 004/107] x86/asm/entry/64: Remove a redundant jump Kamal Mostafa
2015-08-05 21:47 ` [PATCH 3.19.y-ckt 005/107] x86/nmi: Enable nested do_nmi handling for 64-bit kernels Kamal Mostafa
2015-08-05 21:47 ` [PATCH 3.19.y-ckt 006/107] x86/nmi/64: Remove asm code that saves cr2 Kamal Mostafa
2015-08-05 21:47 ` [PATCH 3.19.y-ckt 007/107] x86/nmi/64: Switch stacks on userspace NMI entry Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 008/107] x86/nmi/64: Improve nested NMI comments Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 009/107] x86/nmi/64: Reorder nested NMI checks Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 010/107] x86/nmi/64: Use DF to avoid userspace RSP confusing nested NMI detection Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 011/107] KEYS: ensure we free the assoc array edit if edit is valid Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 012/107] sg_start_req(): make sure that there's not too many elements in iovec Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 013/107] Btrfs: use kmem_cache_free when freeing entry in inode cache Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 014/107] Btrfs: fix race between caching kthread and returning inode to " Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 015/107] Btrfs: fix fsync data loss after append write Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 016/107] bufferhead: Add _gfp version for sb_getblk() Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 017/107] ext4: avoid deadlocks in the writeback path by using sb_getblk_gfp Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 018/107] ext4: fix reservation release on invalidatepage for delalloc fs Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 019/107] ext4: be more strict when migrating to non-extent based file Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 020/107] ext4: correctly migrate a file with a hole at the beginning Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 021/107] ext4: replace open coded nofail allocation in ext4_free_blocks() Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 022/107] ARM: dts: am57xx-beagle-x15: Provide supply for usb2_phy2 Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 023/107] ACPI / PNP: Reserve ACPI resources at the fs_initcall_sync stage Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 024/107] powerpc/powernv: Fix race in updating core_idle_state Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 025/107] cxl: Fix off by one error allowing subsequent mmap page to be accessed Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 026/107] drm/radeon: fix HDP flushing Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 027/107] drm/i915: Declare the swizzling unknown for L-shaped configurations Kamal Mostafa
2015-08-06 16:52 ` Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 028/107] MIPS: kernel: smp-cps: Fix 64-bit compatibility errors due to pointer casting Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 029/107] MIPS: kernel: cps-vec: Replace 'la' macro with PTR_LA Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 030/107] MIPS: kernel: cps-vec: Replace mips32r2 ISA level with mips64r2 Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 031/107] MIPS: kernel: cps-vec: Use ta0-ta3 pseudo-registers for 64-bit Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 032/107] MIPS: kernel: cps-vec: Replace KSEG0 with CKSEG0 Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 033/107] MIPS: cps-vec: Use macros for various arithmetics and memory operations Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 034/107] drm/radeon: Clean up reference counting and pinning of the cursor BOs Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 035/107] drm/radeon: unpin cursor BOs on suspend and pin them again on resume (v2) Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 036/107] mm: avoid setting up anonymous pages into file mapping Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 037/107] selinux: don't waste ebitmap space when importing NetLabel categories Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 038/107] hpfs: kstrdup() out of memory handling Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 039/107] hpfs: hpfs_error: Remove static buffer, use vsprintf extension %pV instead Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 040/107] cxl: Check if afu is not null in cxl_slbia Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 041/107] parisc: Fix some PTE/TLB race conditions and optimize __flush_tlb_range based on timing results Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 042/107] 9p: don't leave a half-initialized inode sitting around Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 043/107] freeing unlinked file indefinitely delayed Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 044/107] clk: qcom: Use parent rate when set rate to pixel RCG clock Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 045/107] drivers: clk: st: Incorrect register offset used for lock_status Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 046/107] drivers: clk: st: Fix mux bit-setting for Cortex A9 clocks Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 047/107] ARM: 8393/1: smp: Fix suspicious RCU usage with ipi tracepoints Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 048/107] drivers: clk: st: Fix flexgen lock init Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 049/107] iio: adc: rockchip_saradc: add missing MODULE_* data Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 050/107] iio: twl4030-madc: Pass the IRQF_ONESHOT flag Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 051/107] iio: inv-mpu: Specify the expected format/precision for write channels Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 052/107] iio: DAC: ad5624r_spi: fix bit shift of output data value Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 053/107] iio: adc: at91_adc: allow to use full range of startup time Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 054/107] iio: light: tcs3414: Fix bug preventing to set integration time Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 055/107] ALSA: usb-audio: Add MIDI support for Steinberg MI2/MI4 Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 056/107] iio: tmp006: Check channel info on write Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 057/107] dm btree remove: fix bug in redistribute3 Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 058/107] dm thin: allocate the cell_sort_array dynamically Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 059/107] kbuild: Allow arch Makefiles to override {cpp,ld,c}flags Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 060/107] ARC: Override toplevel default -O2 with -O3 Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 061/107] crypto: omap-des - Fix unmapping of dma channels Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 062/107] USB: option: add 2020:4000 ID Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 063/107] USB: cp210x: add ID for Aruba Networks controllers Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 064/107] dm btree: silence lockdep lock inversion in dm_btree_del() Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 065/107] usb: musb: host: rely on port_mode to call musb_start() Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 066/107] usb: f_mass_storage: limit number of reported LUNs Kamal Mostafa
2015-08-05 21:48 ` [PATCH 3.19.y-ckt 067/107] s390/sclp: clear upper register halves in _sclp_print_early Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 068/107] drm/rockchip: use drm_gem_mmap helpers Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 069/107] drm: add a check for x/y in drm_mode_setcrtc Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 070/107] bio integrity: do not assume bio_integrity_pool exists if bioset exists Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 071/107] ARM: dts: mx23: fix iio-hwmon support Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 072/107] tracing: Have branch tracer use recursive field of task struct Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 073/107] drivers: net: cpsw: fix crash while accessing second slave ethernet interface Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 074/107] USB: serial: Destroy serial_minors IDR on module exit Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 075/107] KVM: VMX: fix vmwrite to invalid VMCS Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 076/107] Btrfs: fix memory leak in the extent_same ioctl Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 077/107] Btrfs: fix list transaction->pending_ordered corruption Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 078/107] can: rcar_can: fix IRQ check Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 079/107] can: c_can: Fix default pinmux glitch at init Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 080/107] ARM: dts: dra7x-evm: Prevent glitch on DCAN1 pinmux Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 081/107] ARC: make sure instruction_pointer() returns unsigned value Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 082/107] s390/process: fix sfpc inline assembly Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 083/107] Revert "drm/i915: Declare the swizzling unknown for L-shaped configurations" Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 084/107] Btrfs: fix file corruption after cloning inline extents Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 085/107] staging: vt6655: check ieee80211_bss_conf bssid not NULL Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 086/107] staging: vt6656: " Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 087/107] st: null pointer dereference panic caused by use after kref_put by st_open Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 088/107] scsi: fix host max depth checking for the 'queue_depth' sysfs interface Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 089/107] drm/radeon: add a dpm quirk for Sapphire Radeon R9 270X 2GB GDDR5 Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 090/107] drm/radeon: Don't flush the GART TLB if rdev->gart.ptr == NULL Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 091/107] drm/radeon: fix user ptr race condition Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 092/107] drm/radeon/ci: silence a harmless PCC warning Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 093/107] genirq: Prevent resend to interrupts marked IRQ_NESTED_THREAD Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 094/107] ARM: 8404/1: dma-mapping: fix off-by-one error in bitmap size check Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 095/107] dma-debug: skip debug_dma_assert_idle() when disabled Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 096/107] fsnotify: fix oops in fsnotify_clear_marks_by_group_flags() Kamal Mostafa
2015-08-06 15:12 ` Jan Kara
2015-08-06 15:56 ` Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 097/107] ipv6: Make MLD packets to only be processed locally Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 098/107] net: call rcu_read_lock early in process_backlog Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 099/107] ip_tunnel: fix ipv4 pmtu check to honor inner ip header df Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 100/107] bridge: mdb: start delete timer for temp static entries Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 101/107] bridge: mdb: zero out the local br_ip variable before use Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 102/107] net: do not process device backlog during unregistration Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 103/107] net: graceful exit from netif_alloc_netdev_queues() Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 104/107] net: dsa: Fix off-by-one in switch address parsing Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 105/107] perf hists browser: Take the --comm, --dsos, etc filters into account Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 106/107] net: dsa: Test array index before use Kamal Mostafa
2015-08-05 21:49 ` [PATCH 3.19.y-ckt 107/107] rds: rds_ib_device.refcount overflow Kamal Mostafa
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=1438811379-384-2-git-send-email-kamal@canonical.com \
--to=kamal@canonical.com \
--cc=buytenh@wantstofly.org \
--cc=kernel-team@lists.ubuntu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luis.henriques@canonical.com \
--cc=marcel@holtmann.org \
--cc=stable@vger.kernel.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
all inboxes | Powered by JetHome®