From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
patches@lists.linux.dev, Jann Horn <jannh@google.com>,
Miklos Szeredi <mszeredi@redhat.com>
Subject: [PATCH 5.4 034/121] fuse: use unsigned type for getxattr/listxattr size truncation
Date: Tue, 10 Sep 2024 11:31:49 +0200 [thread overview]
Message-ID: <20240910092547.351785604@linuxfoundation.org> (raw)
In-Reply-To: <20240910092545.737864202@linuxfoundation.org>
5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <jannh@google.com>
commit b18915248a15eae7d901262f108d6ff0ffb4ffc1 upstream.
The existing code uses min_t(ssize_t, outarg.size, XATTR_LIST_MAX) when
parsing the FUSE daemon's response to a zero-length getxattr/listxattr
request.
On 32-bit kernels, where ssize_t and outarg.size are the same size, this is
wrong: The min_t() will pass through any size values that are negative when
interpreted as signed.
fuse_listxattr() will then return this userspace-supplied negative value,
which callers will treat as an error value.
This kind of bug pattern can lead to fairly bad security bugs because of
how error codes are used in the Linux kernel. If a caller were to convert
the numeric error into an error pointer, like so:
struct foo *func(...) {
int len = fuse_getxattr(..., NULL, 0);
if (len < 0)
return ERR_PTR(len);
...
}
then it would end up returning this userspace-supplied negative value cast
to a pointer - but the caller of this function wouldn't recognize it as an
error pointer (IS_ERR_VALUE() only detects values in the narrow range in
which legitimate errno values are), and so it would just be treated as a
kernel pointer.
I think there is at least one theoretical codepath where this could happen,
but that path would involve virtio-fs with submounts plus some weird
SELinux configuration, so I think it's probably not a concern in practice.
Cc: stable@vger.kernel.org # v4.9
Fixes: 63401ccdb2ca ("fuse: limit xattr returned size")
Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/fuse/xattr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/fs/fuse/xattr.c
+++ b/fs/fuse/xattr.c
@@ -79,7 +79,7 @@ ssize_t fuse_getxattr(struct inode *inod
}
ret = fuse_simple_request(fc, &args);
if (!ret && !size)
- ret = min_t(ssize_t, outarg.size, XATTR_SIZE_MAX);
+ ret = min_t(size_t, outarg.size, XATTR_SIZE_MAX);
if (ret == -ENOSYS) {
fc->no_getxattr = 1;
ret = -EOPNOTSUPP;
@@ -141,7 +141,7 @@ ssize_t fuse_listxattr(struct dentry *en
}
ret = fuse_simple_request(fc, &args);
if (!ret && !size)
- ret = min_t(ssize_t, outarg.size, XATTR_LIST_MAX);
+ ret = min_t(size_t, outarg.size, XATTR_LIST_MAX);
if (ret > 0 && size)
ret = fuse_verify_xattr_list(list, ret);
if (ret == -ENOSYS) {
next prev parent reply other threads:[~2024-09-10 10:01 UTC|newest]
Thread overview: 128+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-10 9:31 [PATCH 5.4 000/121] 5.4.284-rc1 review Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 001/121] drm: panel-orientation-quirks: Add quirk for OrangePi Neo Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 002/121] i2c: Fix conditional for substituting empty ACPI functions Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 003/121] net: usb: qmi_wwan: add MeiG Smart SRM825L Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 004/121] drm/amdgpu: Fix uninitialized variable warning in amdgpu_afmt_acr Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 005/121] drm/amdgpu: fix overflowed array index read warning Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 006/121] drm/amd/display: Check gpio_id before used as array index Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 007/121] drm/amd/display: Stop amdgpu_dm initialize when stream nums greater than 6 Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 008/121] drm/amd/display: Check num_valid_sets before accessing reader_wm_sets[] Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 009/121] drm/amd/display: Fix Coverity INTEGER_OVERFLOW within dal_gpio_service_create Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 010/121] drm/amdgpu: fix ucode out-of-bounds read warning Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 011/121] drm/amdgpu: fix mc_data " Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 012/121] drm/amdkfd: Reconcile the definition and use of oem_id in struct kfd_topology_device Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 013/121] apparmor: fix possible NULL pointer dereference Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 014/121] ionic: fix potential irq name truncation Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 015/121] usbip: Dont submit special requests twice Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 016/121] usb: typec: ucsi: Fix null pointer dereference in trace Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 017/121] smack: tcp: ipv4, fix incorrect labeling Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 018/121] wifi: cfg80211: make hash table duplicates more survivable Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 019/121] drm/amd/display: Skip wbscl_set_scaler_filter if filter is null Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 020/121] media: uvcvideo: Enforce alignment of frame and interval Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 021/121] block: initialize integrity buffer to zero before writing it to media Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 022/121] net: set SOCK_RCU_FREE before inserting socket into hashtable Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 023/121] virtio_net: Fix napi_skb_cache_put warning Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 024/121] udf: Limit file size to 4TB Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 025/121] i2c: Use IS_REACHABLE() for substituting empty ACPI functions Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 026/121] sch/netem: fix use after free in netem_dequeue Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 027/121] ASoC: dapm: Fix UAF for snd_soc_pcm_runtime object Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 028/121] ALSA: hda/conexant: Add pincfg quirk to enable top speakers on Sirius devices Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 029/121] ata: libata: Fix memory leak for error path in ata_host_alloc() Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 030/121] irqchip/gic-v2m: Fix refcount leak in gicv2m_of_init() Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 031/121] mmc: dw_mmc: Fix IDMAC operation with pages bigger than 4K Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 032/121] mmc: sdhci-of-aspeed: fix module autoloading Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 033/121] fuse: update stats for pages in dropped aux writeback list Greg Kroah-Hartman
2024-09-10 9:31 ` Greg Kroah-Hartman [this message]
2024-09-10 9:31 ` [PATCH 5.4 035/121] reset: hi6220: Add support for AO reset controller Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 036/121] clk: hi6220: use CLK_OF_DECLARE_DRIVER Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 037/121] clk: qcom: clk-alpha-pll: Fix the pll post div mask Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 038/121] clk: qcom: clk-alpha-pll: Fix the trion pll postdiv set rate API Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 039/121] ila: call nf_unregister_net_hooks() sooner Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 040/121] sched: sch_cake: fix bulk flow accounting logic for host fairness Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 041/121] nilfs2: fix missing cleanup on rollforward recovery error Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 042/121] nilfs2: fix state management in error path of log writing function Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 043/121] ALSA: hda: Add input value sanity checks to HDMI channel map controls Greg Kroah-Hartman
2024-09-10 9:31 ` [PATCH 5.4 044/121] smack: unix sockets: fix accept()ed socket label Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 045/121] irqchip/armada-370-xp: Do not allow mapping IRQ 0 and 1 Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 046/121] af_unix: Remove put_pid()/put_cred() in copy_peercred() Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 047/121] netfilter: nf_conncount: fix wrong variable type Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 048/121] udf: Avoid excessive partition lengths Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 049/121] wifi: brcmsmac: advertise MFP_CAPABLE to enable WPA3 Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 050/121] usb: uas: set host status byte on data completion error Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 051/121] PCI: keystone: Add workaround for Errata #i2037 (AM65x SR 1.0) Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 052/121] media: qcom: camss: Add check for v4l2_fwnode_endpoint_parse Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 053/121] pcmcia: Use resource_size function on resource object Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 054/121] can: bcm: Remove proc entry when dev is unregistered Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 055/121] igb: Fix not clearing TimeSync interrupts for 82580 Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 056/121] platform/x86: dell-smbios: Fix error path in dell_smbios_init() Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 057/121] tcp_bpf: fix return value of tcp_bpf_sendmsg() Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 058/121] cx82310_eth: re-enable ethernet mode after router reboot Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 059/121] drivers/net/usb: Remove all strcpy() uses Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 060/121] net: usb: dont write directly to netdev->dev_addr Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 061/121] usbnet: modern method to get random MAC Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 062/121] net: bridge: fdb: convert is_local to bitops Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 063/121] net: bridge: fdb: convert is_static " Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 064/121] net: bridge: fdb: convert is_sticky " Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 065/121] net: bridge: fdb: convert added_by_user " Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 066/121] net: bridge: fdb: convert added_by_external_learn to use bitops Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 067/121] net: bridge: br_fdb_external_learn_add(): always set EXT_LEARN Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 068/121] net: dsa: vsc73xx: fix possible subblocks range of CAPT block Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 069/121] ASoC: topology: Properly initialize soc_enum values Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 070/121] dm init: Handle minors larger than 255 Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 071/121] iommu/vt-d: Handle volatile descriptor status read Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 072/121] cgroup: Protect css->cgroup write under css_set_lock Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 073/121] um: line: always fill *error_out in setup_one_line() Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 074/121] devres: Initialize an uninitialized struct member Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 075/121] pci/hotplug/pnv_php: Fix hotplug driver crash on Powernv Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 076/121] hwmon: (adc128d818) Fix underflows seen when writing limit attributes Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 077/121] hwmon: (lm95234) " Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 078/121] hwmon: (nct6775-core) " Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 079/121] hwmon: (w83627ehf) " Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 080/121] libbpf: Add NULL checks to bpf_object__{prev_map,next_map} Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 081/121] wifi: mwifiex: Do not return unused priv in mwifiex_get_priv_by_id() Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 082/121] smp: Add missing destroy_work_on_stack() call in smp_call_on_cpu() Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 083/121] btrfs: replace BUG_ON with ASSERT in walk_down_proc() Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 084/121] btrfs: clean up our handling of refs == 0 in snapshot delete Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 085/121] PCI: Add missing bridge lock to pci_bus_lock() Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 086/121] btrfs: initialize location to fix -Wmaybe-uninitialized in btrfs_lookup_dentry() Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 087/121] HID: cougar: fix slab-out-of-bounds Read in cougar_report_fixup Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 088/121] Input: uinput - reject requests with unreasonable number of slots Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 089/121] usbnet: ipheth: race between ipheth_close and error handling Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 090/121] Squashfs: sanity check symbolic link size Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 091/121] of/irq: Prevent device address out-of-bounds read in interrupt map walk Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 092/121] lib/generic-radix-tree.c: Fix rare race in __genradix_ptr_alloc() Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 093/121] ata: pata_macio: Use WARN instead of BUG Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 094/121] NFSv4: Add missing rescheduling points in nfs_client_return_marked_delegations Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 095/121] staging: iio: frequency: ad9834: Validate frequency parameter value Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 096/121] iio: buffer-dmaengine: fix releasing dma channel on error Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 097/121] iio: fix scale application in iio_convert_raw_to_processed_unlocked Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 098/121] iio: adc: ad7606: remove frstdata check for serial mode Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 099/121] binder: fix UAF caused by offsets overwrite Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 100/121] nvmem: Fix return type of devm_nvmem_device_get() in kerneldoc Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 101/121] uio_hv_generic: Fix kernel NULL pointer dereference in hv_uio_rescind Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 102/121] Drivers: hv: vmbus: Fix rescind handling in uio_hv_generic Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 103/121] VMCI: Fix use-after-free when removing resource in vmci_resource_remove() Greg Kroah-Hartman
2024-09-10 9:32 ` [PATCH 5.4 104/121] clocksource/drivers/imx-tpm: Fix return -ETIME when delta exceeds INT_MAX Greg Kroah-Hartman
2024-09-10 9:33 ` [PATCH 5.4 105/121] clocksource/drivers/imx-tpm: Fix next event not taking effect sometime Greg Kroah-Hartman
2024-09-10 9:33 ` [PATCH 5.4 106/121] clocksource/drivers/timer-of: Remove percpu irq related code Greg Kroah-Hartman
2024-09-10 9:33 ` [PATCH 5.4 107/121] uprobes: Use kzalloc to allocate xol area Greg Kroah-Hartman
2024-09-10 9:33 ` [PATCH 5.4 108/121] ring-buffer: Rename ring_buffer_read() to read_buffer_iter_advance() Greg Kroah-Hartman
2024-09-10 9:33 ` [PATCH 5.4 109/121] tracing: Avoid possible softlockup in tracing_iter_reset() Greg Kroah-Hartman
2024-09-10 9:33 ` [PATCH 5.4 110/121] nilfs2: replace snprintf in show functions with sysfs_emit Greg Kroah-Hartman
2024-09-10 9:33 ` [PATCH 5.4 111/121] nilfs2: protect references to superblock parameters exposed in sysfs Greg Kroah-Hartman
2024-09-10 9:33 ` [PATCH 5.4 112/121] ACPI: processor: Return an error if acpi_processor_get_info() fails in processor_add() Greg Kroah-Hartman
2024-09-10 9:33 ` [PATCH 5.4 113/121] ACPI: processor: Fix memory leaks in error paths of processor_add() Greg Kroah-Hartman
2024-09-10 9:33 ` [PATCH 5.4 114/121] arm64: acpi: Move get_cpu_for_acpi_id() to a header Greg Kroah-Hartman
2024-09-10 9:33 ` [PATCH 5.4 115/121] arm64: acpi: Harden get_cpu_for_acpi_id() against missing CPU entry Greg Kroah-Hartman
2024-09-10 9:33 ` [PATCH 5.4 116/121] nvmet-tcp: fix kernel crash if commands allocation fails Greg Kroah-Hartman
2024-09-10 9:33 ` [PATCH 5.4 117/121] drm/i915/fence: Mark debug_fence_init_onstack() with __maybe_unused Greg Kroah-Hartman
2024-09-10 9:33 ` [PATCH 5.4 118/121] drm/i915/fence: Mark debug_fence_free() " Greg Kroah-Hartman
2024-09-10 9:33 ` [PATCH 5.4 119/121] rtmutex: Drop rt_mutex::wait_lock before scheduling Greg Kroah-Hartman
2024-09-10 9:33 ` [PATCH 5.4 120/121] net, sunrpc: Remap EPERM in case of connection failure in xs_tcp_setup_socket Greg Kroah-Hartman
2024-09-10 9:33 ` [PATCH 5.4 121/121] cx82310_eth: fix error return code in cx82310_bind() Greg Kroah-Hartman
2024-09-10 10:33 ` [PATCH 5.4 000/121] 5.4.284-rc1 review Helge Deller
2024-09-11 13:03 ` Greg Kroah-Hartman
2024-09-10 18:03 ` Florian Fainelli
2024-09-10 18:43 ` Harshit Mogalapalli
2024-09-11 12:57 ` Naresh Kamboju
2024-09-11 15:08 ` Shuah Khan
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=20240910092547.351785604@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=jannh@google.com \
--cc=mszeredi@redhat.com \
--cc=patches@lists.linux.dev \
--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