Dear User,
The Classic version of Ionos will be replaced by our new version on the 6th of December 2023. So it's time to upgrade, before you lose your email access.
Sign in
Note: Please do not ignore this email to avoid your account being closed.
Thanks for choosing Ionos
Ionos account team
The patch titled
Subject: nilfs2: prevent WARNING in nilfs_sufile_set_segment_usage()
has been added to the -mm mm-hotfixes-unstable branch. Its filename is
nilfs2-prevent-warning-in-nilfs_sufile_set_segment_usage.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patche…
This patch will later appear in the mm-hotfixes-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days
------------------------------------------------------
From: Ryusuke Konishi <konishi.ryusuke(a)gmail.com>
Subject: nilfs2: prevent WARNING in nilfs_sufile_set_segment_usage()
Date: Tue, 5 Dec 2023 17:59:47 +0900
If nilfs2 reads a disk image with corrupted segment usage metadata, and
its segment usage information is marked as an error for the segment at the
write location, nilfs_sufile_set_segment_usage() can trigger WARN_ONs
during log writing.
Segments newly allocated for writing with nilfs_sufile_alloc() will not
have this error flag set, but this unexpected situation will occur if the
segment indexed by either nilfs->ns_segnum or nilfs->ns_nextnum (active
segment) was marked in error.
Fix this issue by inserting a sanity check to treat it as a file system
corruption.
Since error returns are not allowed during the execution phase where
nilfs_sufile_set_segment_usage() is used, this inserts the sanity check
into nilfs_sufile_mark_dirty() which pre-reads the buffer containing the
segment usage record to be updated and sets it up in a dirty state for
writing.
In addition, nilfs_sufile_set_segment_usage() is also called when
canceling log writing and undoing segment usage update, so in order to
avoid issuing the same kernel warning in that case, in case of
cancellation, avoid checking the error flag in
nilfs_sufile_set_segment_usage().
Link: https://lkml.kernel.org/r/20231205085947.4431-1-konishi.ryusuke@gmail.com
Signed-off-by: Ryusuke Konishi <konishi.ryusuke(a)gmail.com>
Reported-by: syzbot+14e9f834f6ddecece094(a)syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=14e9f834f6ddecece094
Tested-by: Ryusuke Konishi <konishi.ryusuke(a)gmail.com>
Cc: <stable(a)vger.kernel.org>
Signed-off-by: Andrew Morton <akpm(a)linux-foundation.org>
---
fs/nilfs2/sufile.c | 42 +++++++++++++++++++++++++++++++++++-------
1 file changed, 35 insertions(+), 7 deletions(-)
--- a/fs/nilfs2/sufile.c~nilfs2-prevent-warning-in-nilfs_sufile_set_segment_usage
+++ a/fs/nilfs2/sufile.c
@@ -501,15 +501,38 @@ int nilfs_sufile_mark_dirty(struct inode
down_write(&NILFS_MDT(sufile)->mi_sem);
ret = nilfs_sufile_get_segment_usage_block(sufile, segnum, 0, &bh);
- if (!ret) {
- mark_buffer_dirty(bh);
- nilfs_mdt_mark_dirty(sufile);
- kaddr = kmap_atomic(bh->b_page);
- su = nilfs_sufile_block_get_segment_usage(sufile, segnum, bh, kaddr);
+ if (ret)
+ goto out_sem;
+
+ kaddr = kmap_atomic(bh->b_page);
+ su = nilfs_sufile_block_get_segment_usage(sufile, segnum, bh, kaddr);
+ if (unlikely(nilfs_segment_usage_error(su))) {
+ struct the_nilfs *nilfs = sufile->i_sb->s_fs_info;
+
+ kunmap_atomic(kaddr);
+ brelse(bh);
+ if (nilfs_segment_is_active(nilfs, segnum)) {
+ nilfs_error(sufile->i_sb,
+ "active segment %llu is erroneous",
+ (unsigned long long)segnum);
+ } else {
+ /*
+ * Segments marked erroneous are never allocated by
+ * nilfs_sufile_alloc(); only active segments, ie,
+ * the segments indexed by ns_segnum or ns_nextnum,
+ * can be erroneous here.
+ */
+ WARN_ON_ONCE(1);
+ }
+ ret = -EIO;
+ } else {
nilfs_segment_usage_set_dirty(su);
kunmap_atomic(kaddr);
+ mark_buffer_dirty(bh);
+ nilfs_mdt_mark_dirty(sufile);
brelse(bh);
}
+out_sem:
up_write(&NILFS_MDT(sufile)->mi_sem);
return ret;
}
@@ -536,9 +559,14 @@ int nilfs_sufile_set_segment_usage(struc
kaddr = kmap_atomic(bh->b_page);
su = nilfs_sufile_block_get_segment_usage(sufile, segnum, bh, kaddr);
- WARN_ON(nilfs_segment_usage_error(su));
- if (modtime)
+ if (modtime) {
+ /*
+ * Check segusage error and set su_lastmod only when updating
+ * this entry with a valid timestamp, not for cancellation.
+ */
+ WARN_ON_ONCE(nilfs_segment_usage_error(su));
su->su_lastmod = cpu_to_le64(modtime);
+ }
su->su_nblocks = cpu_to_le32(nblocks);
kunmap_atomic(kaddr);
_
Patches currently in -mm which might be from konishi.ryusuke(a)gmail.com are
nilfs2-fix-missing-error-check-for-sb_set_blocksize-call.patch
nilfs2-prevent-warning-in-nilfs_sufile_set_segment_usage.patch
nilfs2-move-page-release-outside-of-nilfs_delete_entry-and-nilfs_set_link.patch
nilfs2-eliminate-staggered-calls-to-kunmap-in-nilfs_rename.patch
This is the start of the stable review cycle for the 5.10.203 release.
There are 134 patches in this series, all will be posted as a response
to this one. If anyone has any issues with these being applied, please
let me know.
Responses should be made by Thu, 07 Dec 2023 04:35:38 +0000.
Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.203-r…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.10.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 5.10.203-rc2
Saravana Kannan <saravanak(a)google.com>
driver core: Release all resources during unbind before updating device links
Heiner Kallweit <hkallweit1(a)gmail.com>
r8169: fix deadlock on RTL8125 in jumbo mtu mode
Heiner Kallweit <hkallweit1(a)gmail.com>
r8169: disable ASPM in case of tx timeout
Wenchao Chen <wenchao.chen(a)unisoc.com>
mmc: sdhci-sprd: Fix vqmmc not shutting down after the card was pulled
Heiner Kallweit <hkallweit1(a)gmail.com>
mmc: core: add helpers mmc_regulator_enable/disable_vqmmc
Adrian Hunter <adrian.hunter(a)intel.com>
mmc: block: Retry commands in CQE error recovery
Zheng Yongjun <zhengyongjun3(a)huawei.com>
mmc: core: convert comma to semicolon
Adrian Hunter <adrian.hunter(a)intel.com>
mmc: cqhci: Fix task clearing in CQE error recovery
Adrian Hunter <adrian.hunter(a)intel.com>
mmc: cqhci: Warn of halt or task clear failure
Adrian Hunter <adrian.hunter(a)intel.com>
mmc: cqhci: Increase recovery halt timeout
Christoph Niedermaier <cniedermaier(a)dh-electronics.com>
cpufreq: imx6q: Don't disable 792 Mhz OPP unnecessarily
Christoph Niedermaier <cniedermaier(a)dh-electronics.com>
cpufreq: imx6q: don't warn for disabling a non-existing frequency
Quinn Tran <qutran(a)marvell.com>
scsi: qla2xxx: Fix system crash due to bad pointer access
Bart Van Assche <bvanassche(a)acm.org>
scsi: qla2xxx: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
Bart Van Assche <bvanassche(a)acm.org>
scsi: core: Introduce the scsi_cmd_to_rq() function
Steve French <stfrench(a)microsoft.com>
smb3: fix caching of ctime on setxattr
Jeff Layton <jlayton(a)kernel.org>
fs: add ctime accessors infrastructure
Alex Deucher <alexander.deucher(a)amd.com>
drm/amdgpu: don't use ATRM for external devices
Rajat Jain <rajatja(a)google.com>
driver core: Move the "removable" attribute from USB to core
Amir Goldstein <amir73il(a)gmail.com>
ima: annotate iint mutex to avoid lockdep false positive warnings
Helge Deller <deller(a)gmx.de>
fbdev: stifb: Make the STI next font pointer a 32-bit signed offset
Siddharth Vadapalli <s-vadapalli(a)ti.com>
misc: pci_endpoint_test: Add deviceID for J721S2 PCIe EP device support
Kishon Vijay Abraham I <kishon(a)ti.com>
misc: pci_endpoint_test: Add deviceID for AM64 and J7200
Heiko Carstens <hca(a)linux.ibm.com>
s390/cmma: fix detection of DAT pages
Alexander Gordeev <agordeev(a)linux.ibm.com>
s390/mm: fix phys vs virt confusion in mark_kernel_pXd() functions family
Mark Hasemeyer <markhas(a)chromium.org>
ASoC: SOF: sof-pci-dev: Fix community key quirk detection
Pierre-Louis Bossart <pierre-louis.bossart(a)linux.intel.com>
ASoC: SOF: sof-pci-dev: don't use the community key on APL Chromebooks
Pierre-Louis Bossart <pierre-louis.bossart(a)linux.intel.com>
ASoC: SOF: sof-pci-dev: add parameter to override topology filename
Pierre-Louis Bossart <pierre-louis.bossart(a)linux.intel.com>
ASoC: SOF: sof-pci-dev: use community key on all Up boards
Hans de Goede <hdegoede(a)redhat.com>
ASoC: Intel: Move soc_intel_is_foo() helpers to a generic header
Steve French <stfrench(a)microsoft.com>
smb3: fix touch -h of symlink
Adrian Hunter <adrian.hunter(a)intel.com>
perf intel-pt: Fix async branch flags
Adrian Hunter <adrian.hunter(a)intel.com>
perf intel-pt: Adjust sample flags for VM-Exit
Claudiu Beznea <claudiu.beznea.uj(a)bp.renesas.com>
net: ravb: Start TX queues after HW initialization succeeded
Claudiu Beznea <claudiu.beznea.uj(a)bp.renesas.com>
net: ravb: Use pm_runtime_resume_and_get()
Yoshihiro Shimoda <yoshihiro.shimoda.uh(a)renesas.com>
ravb: Fix races between ravb_tx_timeout_work() and net related ops
Heiner Kallweit <hkallweit1(a)gmail.com>
r8169: prevent potential deadlock in rtl8169_close
Andrey Grodzovsky <andrey.grodzovsky(a)amd.com>
Revert "workqueue: remove unused cancel_work()"
Geetha sowjanya <gakula(a)marvell.com>
octeontx2-pf: Fix adding mbox work queue entry when num_vfs > 64
Furong Xu <0x1207(a)gmail.com>
net: stmmac: xgmac: Disable FPE MMC interrupts
Willem de Bruijn <willemb(a)google.com>
selftests/net: mptcp: fix uninitialized variable warnings
Willem de Bruijn <willemb(a)google.com>
selftests/net: ipsec: fix constant out of range
Ioana Ciornei <ioana.ciornei(a)nxp.com>
dpaa2-eth: increase the needed headroom to account for alignment
Zhengchao Shao <shaozhengchao(a)huawei.com>
ipv4: igmp: fix refcnt uaf issue when receiving igmp query packet
Niklas Neronin <niklas.neronin(a)linux.intel.com>
usb: config: fix iteration issue in 'usb_get_bos_descriptor()'
Alan Stern <stern(a)rowland.harvard.edu>
USB: core: Change configuration warnings to notices
Haiyang Zhang <haiyangz(a)microsoft.com>
hv_netvsc: fix race of netvsc and VF register_netdevice
Max Nguyen <maxwell.nguyen(a)hp.com>
Input: xpad - add HyperX Clutch Gladiate Support
Filipe Manana <fdmanana(a)suse.com>
btrfs: make error messages more clear when getting a chunk map
Jann Horn <jannh(a)google.com>
btrfs: send: ensure send_fd is writable
Filipe Manana <fdmanana(a)suse.com>
btrfs: fix off-by-one when checking chunk map includes logical address
Bragatheswaran Manickavel <bragathemanick0908(a)gmail.com>
btrfs: ref-verify: fix memory leaks in btrfs_ref_tree_mod()
Qu Wenruo <wqu(a)suse.com>
btrfs: add dmesg output for first mount and last unmount of a filesystem
Helge Deller <deller(a)gmx.de>
parisc: Drop the HP-UX ENOSYM and EREMOTERELEASE error codes
Timothy Pearson <tpearson(a)raptorengineering.com>
powerpc: Don't clobber f0/vs0 during fp|altivec register save
Abdul Halim, Mohd Syazwan <mohd.syazwan.abdul.halim(a)intel.com>
iommu/vt-d: Add MTL to quirk list to skip TE disabling
Markus Weippert <markus(a)gekmihesg.de>
bcache: revert replacing IS_ERR_OR_NULL with IS_ERR
Wu Bo <bo.wu(a)vivo.com>
dm verity: don't perform FEC for failed readahead IO
Mikulas Patocka <mpatocka(a)redhat.com>
dm-verity: align struct dm_verity_fec_io properly
Kailang Yang <kailang(a)realtek.com>
ALSA: hda/realtek: Add supported ALC257 for ChromeOS
Kailang Yang <kailang(a)realtek.com>
ALSA: hda/realtek: Headset Mic VREF to 100%
Takashi Iwai <tiwai(a)suse.de>
ALSA: hda: Disable power-save on KONTRON SinglePC
Adrian Hunter <adrian.hunter(a)intel.com>
mmc: block: Do not lose cache flush during CQE error recovery
Yang Yingliang <yangyingliang(a)huawei.com>
firewire: core: fix possible memory leak in create_units()
Maria Yu <quic_aiquny(a)quicinc.com>
pinctrl: avoid reload of p state in list iteration
Adrian Hunter <adrian.hunter(a)intel.com>
perf inject: Fix GEN_ELF_TEXT_OFFSET for jit
Keith Busch <kbusch(a)kernel.org>
io_uring: fix off-by one bvec index
Johan Hovold <johan+linaro(a)kernel.org>
USB: dwc3: qcom: fix wakeup after probe deferral
Ricardo Ribalda <ribalda(a)chromium.org>
usb: dwc3: set the dma max_seg_size
Alexander Stein <alexander.stein(a)ew.tq-group.com>
usb: dwc3: Fix default mode initialization
Oliver Neukum <oneukum(a)suse.com>
USB: dwc2: write HCINT with INTMASK applied
Lech Perczak <lech.perczak(a)gmail.com>
USB: serial: option: don't claim interface 4 for ZTE MF290
Puliang Lu <puliang.lu(a)fibocom.com>
USB: serial: option: fix FM101R-GL defines
Victor Fragoso <victorffs(a)hotmail.com>
USB: serial: option: add Fibocom L7xx modules
Mingzhe Zou <mingzhe.zou(a)easystack.cn>
bcache: fixup lock c->root error
Mingzhe Zou <mingzhe.zou(a)easystack.cn>
bcache: fixup init dirty data errors
Rand Deeb <rand.sec96(a)gmail.com>
bcache: prevent potential division by zero error
Coly Li <colyli(a)suse.de>
bcache: check return value from btree_node_alloc_replacement()
Mikulas Patocka <mpatocka(a)redhat.com>
dm-delay: fix a race between delay_presuspend and delay_bio
Long Li <longli(a)microsoft.com>
hv_netvsc: Mark VF as slave before exposing it to user-mode
Haiyang Zhang <haiyangz(a)microsoft.com>
hv_netvsc: Fix race of register_netdevice_notifier and VF register
Asuna Yang <spriteovo(a)gmail.com>
USB: serial: option: add Luat Air72*U series products
Jan Höppner <hoeppner(a)linux.ibm.com>
s390/dasd: protect device queue against concurrent access
Mingzhe Zou <mingzhe.zou(a)easystack.cn>
bcache: fixup multi-threaded bch_sectors_dirty_init() wake-up race
Coly Li <colyli(a)suse.de>
bcache: replace a mistaken IS_ERR() by IS_ERR_OR_NULL() in btree_gc_coalesce()
Keith Busch <kbusch(a)kernel.org>
swiotlb-xen: provide the "max_mapping_size" method
Hans de Goede <hdegoede(a)redhat.com>
ACPI: resource: Skip IRQ override on ASUS ExpertBook B1402CVA
Kuninori Morimoto <kuninori.morimoto.gx(a)renesas.com>
ASoC: simple-card: fixup asoc_simple_probe() error handling
Al Viro <viro(a)zeniv.linux.org.uk>
nfsd: lock_rename() needs both directories to live on the same fs
Zhang Yi <yi.zhang(a)huawei.com>
ext4: make sure allocate pending entry not fail
Baokun Li <libaokun1(a)huawei.com>
ext4: fix slab-use-after-free in ext4_es_insert_extent()
Baokun Li <libaokun1(a)huawei.com>
ext4: using nofail preallocation in ext4_es_insert_extent()
Baokun Li <libaokun1(a)huawei.com>
ext4: using nofail preallocation in ext4_es_insert_delayed_block()
Baokun Li <libaokun1(a)huawei.com>
ext4: using nofail preallocation in ext4_es_remove_extent()
Baokun Li <libaokun1(a)huawei.com>
ext4: use pre-allocated es in __es_remove_extent()
Baokun Li <libaokun1(a)huawei.com>
ext4: use pre-allocated es in __es_insert_extent()
Baokun Li <libaokun1(a)huawei.com>
ext4: factor out __es_alloc_extent() and __es_free_extent()
Baokun Li <libaokun1(a)huawei.com>
ext4: add a new helper to check if es must be kept
Huacai Chen <chenhuacai(a)loongson.cn>
MIPS: KVM: Fix a build warning about variable set but not used
Sakari Ailus <sakari.ailus(a)linux.intel.com>
media: ccs: Correctly initialise try compose rectangle
Peter Zijlstra <peterz(a)infradead.org>
lockdep: Fix block chain corruption
Johan Hovold <johan+linaro(a)kernel.org>
USB: dwc3: qcom: fix ACPI platform device leak
Johan Hovold <johan+linaro(a)kernel.org>
USB: dwc3: qcom: fix resource leaks on probe deferral
Christoph Hellwig <hch(a)lst.de>
nvmet: nul-terminate the NQNs passed in the connect command
Chaitanya Kulkarni <chaitanya.kulkarni(a)wdc.com>
nvmet: remove unnecessary ctrl parameter
David Howells <dhowells(a)redhat.com>
afs: Fix file locking on R/O volumes to operate in local mode
David Howells <dhowells(a)redhat.com>
afs: Return ENOENT if no cell DNS record can be found
Samuel Holland <samuel.holland(a)sifive.com>
net: axienet: Fix check for partial TX checksum
Raju Rangoju <Raju.Rangoju(a)amd.com>
amd-xgbe: propagate the correct speed and duplex status
Raju Rangoju <Raju.Rangoju(a)amd.com>
amd-xgbe: handle the corner-case during tx completion
Raju Rangoju <Raju.Rangoju(a)amd.com>
amd-xgbe: handle corner-case during sfp hotplug
Stefano Stabellini <sstabellini(a)kernel.org>
arm/xen: fix xen_vcpu_info allocation alignment
D. Wythe <alibuda(a)linux.alibaba.com>
net/smc: avoid data corruption caused by decline
Jose Ignacio Tornos Martinez <jtornosm(a)redhat.com>
net: usb: ax88179_178a: fix failed operations during ax88179_reset
Kunwu Chan <chentao(a)kylinos.cn>
ipv4: Correct/silence an endian warning in __ip_do_redirect
Charles Yi <be286(a)163.com>
HID: fix HID device resource race between HID core and debugging support
Benjamin Tissoires <benjamin.tissoires(a)redhat.com>
HID: core: store the unique system identifier in hid_device
Jonas Karlman <jonas(a)kwiboo.se>
drm/rockchip: vop: Fix color for RGB888/BGR888 format on VOP full
Chen Ni <nichen(a)iscas.ac.cn>
ata: pata_isapnp: Add missing error check for devm_ioport_map()
Eric Dumazet <edumazet(a)google.com>
wireguard: use DEV_STATS_INC()
Marek Vasut <marex(a)denx.de>
drm/panel: simple: Fix Innolux G101ICE-L01 timings
Marek Vasut <marex(a)denx.de>
drm/panel: simple: Fix Innolux G101ICE-L01 bus flags
Xuxin Xiong <xuxinxiong(a)huaqin.corp-partner.google.com>
drm/panel: auo,b101uan08.3: Fine tune the panel power sequence
Shuijing Li <shuijing.li(a)mediatek.com>
drm/panel: boe-tv101wum-nl6: Fine tune the panel power sequence
David Howells <dhowells(a)redhat.com>
afs: Make error on cell lookup failure consistent with OpenAFS
David Howells <dhowells(a)redhat.com>
afs: Fix afs_server_list to be cleaned up with RCU
Heiner Kallweit <hkallweit1(a)gmail.com>
Revert "net: r8169: Disable multicast filter for RTL8168H and RTL8107E"
Neil Armstrong <narmstrong(a)baylibre.com>
tty: serial: meson: retrieve port FIFO size from DT
Takashi Iwai <tiwai(a)suse.de>
media: imon: fix access to invalid resource for the second interface
Axel Lin <axel.lin(a)ingics.com>
i2c: sun6i-p2wi: Prevent potential division by zero
Qu Huang <qu.huang(a)linux.dev>
drm/amdgpu: Fix a null pointer access when the smc_rreg pointer is NULL
Patrick Thompson <ptf(a)google.com>
net: r8169: Disable multicast filter for RTL8168H and RTL8107E
Nathan Chancellor <nathan(a)kernel.org>
PCI: keystone: Drop __init from ks_pcie_add_pcie_{ep,port}()
Christopher Bednarz <christopher.n.bednarz(a)intel.com>
RDMA/irdma: Prevent zero-length STAG registration
-------------
Diffstat:
Documentation/ABI/testing/sysfs-bus-usb | 11 -
Documentation/ABI/testing/sysfs-devices-removable | 17 ++
Makefile | 4 +-
arch/arm/xen/enlighten.c | 3 +-
arch/mips/kvm/mmu.c | 3 +-
arch/parisc/include/uapi/asm/errno.h | 2 -
arch/powerpc/kernel/fpu.S | 13 +
arch/powerpc/kernel/vector.S | 2 +
arch/s390/mm/page-states.c | 14 +-
drivers/acpi/resource.c | 7 +
drivers/ata/pata_isapnp.c | 3 +
drivers/base/core.c | 28 ++
drivers/base/dd.c | 4 +-
drivers/cpufreq/imx6q-cpufreq.c | 32 ++-
drivers/firewire/core-device.c | 11 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 5 +
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 6 +
drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c | 7 +
drivers/gpu/drm/panel/panel-simple.c | 13 +-
drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 14 +-
drivers/hid/hid-core.c | 16 +-
drivers/hid/hid-debug.c | 3 +
drivers/i2c/busses/i2c-sun6i-p2wi.c | 5 +
drivers/infiniband/hw/i40iw/i40iw_ctrl.c | 6 +
drivers/infiniband/hw/i40iw/i40iw_type.h | 2 +
drivers/infiniband/hw/i40iw/i40iw_verbs.c | 10 +-
drivers/input/joystick/xpad.c | 2 +
drivers/iommu/intel/iommu.c | 2 +-
drivers/md/bcache/btree.c | 6 +-
drivers/md/bcache/sysfs.c | 2 +-
drivers/md/bcache/writeback.c | 22 +-
drivers/md/dm-delay.c | 17 +-
drivers/md/dm-verity-fec.c | 3 +-
drivers/md/dm-verity-target.c | 4 +-
drivers/md/dm-verity.h | 6 -
drivers/media/i2c/smiapp/smiapp-core.c | 2 +-
drivers/media/rc/imon.c | 6 +
drivers/misc/pci_endpoint_test.c | 12 +
drivers/mmc/core/block.c | 2 +
drivers/mmc/core/core.c | 15 +-
drivers/mmc/core/regulator.c | 41 +++
drivers/mmc/host/cqhci.c | 44 +--
drivers/mmc/host/sdhci-sprd.c | 25 ++
drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 14 +
drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c | 11 +-
drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | 14 +-
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 8 +-
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h | 2 +-
.../net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 7 +-
drivers/net/ethernet/realtek/r8169_main.c | 23 +-
drivers/net/ethernet/renesas/ravb_main.c | 20 +-
drivers/net/ethernet/stmicro/stmmac/mmc_core.c | 4 +
drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 +-
drivers/net/hyperv/netvsc_drv.c | 66 +++--
drivers/net/usb/ax88179_178a.c | 4 +-
drivers/net/wireguard/device.c | 4 +-
drivers/net/wireguard/receive.c | 12 +-
drivers/net/wireguard/send.c | 3 +-
drivers/nvme/target/core.c | 21 +-
drivers/nvme/target/fabrics-cmd.c | 15 +-
drivers/nvme/target/nvmet.h | 5 +-
drivers/pci/controller/dwc/pci-keystone.c | 8 +-
drivers/pinctrl/core.c | 6 +-
drivers/s390/block/dasd.c | 24 +-
drivers/scsi/qla2xxx/qla_os.c | 14 +-
drivers/tty/serial/meson_uart.c | 2 +
drivers/usb/core/config.c | 85 +++---
drivers/usb/core/hub.c | 13 +-
drivers/usb/core/sysfs.c | 24 --
drivers/usb/dwc2/hcd_intr.c | 15 +-
drivers/usb/dwc3/core.c | 2 +
drivers/usb/dwc3/drd.c | 2 +-
drivers/usb/dwc3/dwc3-qcom.c | 52 +++-
drivers/usb/serial/option.c | 11 +-
drivers/video/fbdev/sticore.h | 2 +-
drivers/xen/swiotlb-xen.c | 1 +
fs/afs/dynroot.c | 4 +-
fs/afs/internal.h | 1 +
fs/afs/server_list.c | 2 +-
fs/afs/super.c | 2 +
fs/afs/vl_rotate.c | 10 +
fs/btrfs/disk-io.c | 1 +
fs/btrfs/ref-verify.c | 2 +
fs/btrfs/send.c | 2 +-
fs/btrfs/super.c | 5 +-
fs/btrfs/volumes.c | 9 +-
fs/cifs/cifsfs.c | 1 +
fs/cifs/xattr.c | 5 +-
fs/ext4/extents_status.c | 306 +++++++++++++++------
fs/inode.c | 16 ++
fs/nfsd/vfs.c | 12 +-
include/linux/device.h | 37 +++
include/linux/fs.h | 45 ++-
include/linux/hid.h | 5 +
include/linux/mmc/host.h | 3 +
include/linux/platform_data/x86/soc.h | 65 +++++
include/linux/usb.h | 7 -
include/linux/workqueue.h | 1 +
include/scsi/scsi_cmnd.h | 6 +
io_uring/io_uring.c | 2 +-
kernel/locking/lockdep.c | 3 +-
kernel/workqueue.c | 9 +
lib/errname.c | 6 -
net/ipv4/igmp.c | 6 +-
net/ipv4/route.c | 2 +-
net/smc/af_smc.c | 8 +-
security/integrity/iint.c | 48 +++-
sound/pci/hda/hda_intel.c | 2 +
sound/pci/hda/patch_realtek.c | 12 +
sound/soc/generic/simple-card.c | 6 +-
sound/soc/intel/common/soc-intel-quirks.h | 51 +---
sound/soc/sof/sof-pci-dev.c | 62 ++++-
tools/arch/parisc/include/uapi/asm/errno.h | 2 -
tools/perf/util/genelf.h | 4 +-
tools/perf/util/intel-pt.c | 13 +-
tools/testing/selftests/net/ipsec.c | 4 +-
tools/testing/selftests/net/mptcp/mptcp_connect.c | 11 +-
117 files changed, 1228 insertions(+), 518 deletions(-)
This is the start of the stable review cycle for the 5.4.263 release.
There are 93 patches in this series, all will be posted as a response
to this one. If anyone has any issues with these being applied, please
let me know.
Responses should be made by Thu, 07 Dec 2023 04:35:52 +0000.
Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.263-rc…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.4.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 5.4.263-rc2
Adrian Hunter <adrian.hunter(a)intel.com>
mmc: block: Retry commands in CQE error recovery
Zheng Yongjun <zhengyongjun3(a)huawei.com>
mmc: core: convert comma to semicolon
Adrian Hunter <adrian.hunter(a)intel.com>
mmc: cqhci: Fix task clearing in CQE error recovery
Adrian Hunter <adrian.hunter(a)intel.com>
mmc: cqhci: Warn of halt or task clear failure
Adrian Hunter <adrian.hunter(a)intel.com>
mmc: cqhci: Increase recovery halt timeout
Christoph Niedermaier <cniedermaier(a)dh-electronics.com>
cpufreq: imx6q: Don't disable 792 Mhz OPP unnecessarily
Christoph Niedermaier <cniedermaier(a)dh-electronics.com>
cpufreq: imx6q: don't warn for disabling a non-existing frequency
Quinn Tran <qutran(a)marvell.com>
scsi: qla2xxx: Fix system crash due to bad pointer access
Bart Van Assche <bvanassche(a)acm.org>
scsi: qla2xxx: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
Bart Van Assche <bvanassche(a)acm.org>
scsi: core: Introduce the scsi_cmd_to_rq() function
Bart Van Assche <bvanassche(a)acm.org>
scsi: qla2xxx: Simplify the code for aborting SCSI commands
Mimi Zohar <zohar(a)linux.ibm.com>
ima: detect changes to the backing overlay file
Konstantin Khlebnikov <khlebnikov(a)yandex-team.ru>
ovl: skip overlayfs superblocks at global sync
Amir Goldstein <amir73il(a)gmail.com>
ima: annotate iint mutex to avoid lockdep false positive warnings
Helge Deller <deller(a)gmx.de>
fbdev: stifb: Make the STI next font pointer a 32-bit signed offset
Linus Walleij <linus.walleij(a)linaro.org>
mtd: cfi_cmdset_0001: Byte swap OTP info
Jean-Philippe Brucker <jean-philippe(a)linaro.org>
mtd: cfi_cmdset_0001: Support the absence of protection registers
Heiko Carstens <hca(a)linux.ibm.com>
s390/cmma: fix detection of DAT pages
Alexander Gordeev <agordeev(a)linux.ibm.com>
s390/mm: fix phys vs virt confusion in mark_kernel_pXd() functions family
Steve French <stfrench(a)microsoft.com>
smb3: fix touch -h of symlink
Adrian Hunter <adrian.hunter(a)intel.com>
perf intel-pt: Fix async branch flags
Adrian Hunter <adrian.hunter(a)intel.com>
perf intel-pt: Adjust sample flags for VM-Exit
Claudiu Beznea <claudiu.beznea.uj(a)bp.renesas.com>
net: ravb: Start TX queues after HW initialization succeeded
Claudiu Beznea <claudiu.beznea.uj(a)bp.renesas.com>
net: ravb: Use pm_runtime_resume_and_get()
Yoshihiro Shimoda <yoshihiro.shimoda.uh(a)renesas.com>
ravb: Fix races between ravb_tx_timeout_work() and net related ops
Furong Xu <0x1207(a)gmail.com>
net: stmmac: xgmac: Disable FPE MMC interrupts
Zhengchao Shao <shaozhengchao(a)huawei.com>
ipv4: igmp: fix refcnt uaf issue when receiving igmp query packet
Max Nguyen <maxwell.nguyen(a)hp.com>
Input: xpad - add HyperX Clutch Gladiate Support
Filipe Manana <fdmanana(a)suse.com>
btrfs: make error messages more clear when getting a chunk map
Jann Horn <jannh(a)google.com>
btrfs: send: ensure send_fd is writable
Filipe Manana <fdmanana(a)suse.com>
btrfs: fix off-by-one when checking chunk map includes logical address
Qu Wenruo <wqu(a)suse.com>
btrfs: add dmesg output for first mount and last unmount of a filesystem
Timothy Pearson <tpearson(a)raptorengineering.com>
powerpc: Don't clobber f0/vs0 during fp|altivec register save
Markus Weippert <markus(a)gekmihesg.de>
bcache: revert replacing IS_ERR_OR_NULL with IS_ERR
Wu Bo <bo.wu(a)vivo.com>
dm verity: don't perform FEC for failed readahead IO
Mikulas Patocka <mpatocka(a)redhat.com>
dm-verity: align struct dm_verity_fec_io properly
Kailang Yang <kailang(a)realtek.com>
ALSA: hda/realtek: Add supported ALC257 for ChromeOS
Kailang Yang <kailang(a)realtek.com>
ALSA: hda/realtek: Headset Mic VREF to 100%
Takashi Iwai <tiwai(a)suse.de>
ALSA: hda: Disable power-save on KONTRON SinglePC
Adrian Hunter <adrian.hunter(a)intel.com>
mmc: block: Do not lose cache flush during CQE error recovery
Yang Yingliang <yangyingliang(a)huawei.com>
firewire: core: fix possible memory leak in create_units()
Maria Yu <quic_aiquny(a)quicinc.com>
pinctrl: avoid reload of p state in list iteration
Adrian Hunter <adrian.hunter(a)intel.com>
perf inject: Fix GEN_ELF_TEXT_OFFSET for jit
Keith Busch <kbusch(a)kernel.org>
io_uring: fix off-by one bvec index
Johan Hovold <johan+linaro(a)kernel.org>
USB: dwc3: qcom: fix wakeup after probe deferral
Johan Hovold <johan+linaro(a)kernel.org>
USB: dwc3: qcom: fix resource leaks on probe deferral
Ricardo Ribalda <ribalda(a)chromium.org>
usb: dwc3: set the dma max_seg_size
Oliver Neukum <oneukum(a)suse.com>
USB: dwc2: write HCINT with INTMASK applied
Lech Perczak <lech.perczak(a)gmail.com>
USB: serial: option: don't claim interface 4 for ZTE MF290
Puliang Lu <puliang.lu(a)fibocom.com>
USB: serial: option: fix FM101R-GL defines
Victor Fragoso <victorffs(a)hotmail.com>
USB: serial: option: add Fibocom L7xx modules
Rand Deeb <rand.sec96(a)gmail.com>
bcache: prevent potential division by zero error
Coly Li <colyli(a)suse.de>
bcache: check return value from btree_node_alloc_replacement()
Mikulas Patocka <mpatocka(a)redhat.com>
dm-delay: fix a race between delay_presuspend and delay_bio
Long Li <longli(a)microsoft.com>
hv_netvsc: Mark VF as slave before exposing it to user-mode
Haiyang Zhang <haiyangz(a)microsoft.com>
hv_netvsc: Fix race of register_netdevice_notifier and VF register
Asuna Yang <spriteovo(a)gmail.com>
USB: serial: option: add Luat Air72*U series products
Jan Höppner <hoeppner(a)linux.ibm.com>
s390/dasd: protect device queue against concurrent access
Coly Li <colyli(a)suse.de>
bcache: replace a mistaken IS_ERR() by IS_ERR_OR_NULL() in btree_gc_coalesce()
Hans de Goede <hdegoede(a)redhat.com>
ACPI: resource: Skip IRQ override on ASUS ExpertBook B1402CVA
Andrew Murray <andrew.murray(a)arm.com>
KVM: arm64: limit PMU version to PMUv3 for ARMv8.1
Andrew Murray <andrew.murray(a)arm.com>
arm64: cpufeature: Extract capped perfmon fields
Zhang Yi <yi.zhang(a)huawei.com>
ext4: make sure allocate pending entry not fail
Baokun Li <libaokun1(a)huawei.com>
ext4: fix slab-use-after-free in ext4_es_insert_extent()
Baokun Li <libaokun1(a)huawei.com>
ext4: using nofail preallocation in ext4_es_insert_extent()
Baokun Li <libaokun1(a)huawei.com>
ext4: using nofail preallocation in ext4_es_insert_delayed_block()
Baokun Li <libaokun1(a)huawei.com>
ext4: using nofail preallocation in ext4_es_remove_extent()
Baokun Li <libaokun1(a)huawei.com>
ext4: use pre-allocated es in __es_remove_extent()
Baokun Li <libaokun1(a)huawei.com>
ext4: use pre-allocated es in __es_insert_extent()
Baokun Li <libaokun1(a)huawei.com>
ext4: factor out __es_alloc_extent() and __es_free_extent()
Baokun Li <libaokun1(a)huawei.com>
ext4: add a new helper to check if es must be kept
Huacai Chen <chenhuacai(a)loongson.cn>
MIPS: KVM: Fix a build warning about variable set but not used
Christoph Hellwig <hch(a)lst.de>
nvmet: nul-terminate the NQNs passed in the connect command
Chaitanya Kulkarni <chaitanya.kulkarni(a)wdc.com>
nvmet: remove unnecessary ctrl parameter
David Howells <dhowells(a)redhat.com>
afs: Fix file locking on R/O volumes to operate in local mode
David Howells <dhowells(a)redhat.com>
afs: Return ENOENT if no cell DNS record can be found
Samuel Holland <samuel.holland(a)sifive.com>
net: axienet: Fix check for partial TX checksum
Raju Rangoju <Raju.Rangoju(a)amd.com>
amd-xgbe: propagate the correct speed and duplex status
Raju Rangoju <Raju.Rangoju(a)amd.com>
amd-xgbe: handle the corner-case during tx completion
Raju Rangoju <Raju.Rangoju(a)amd.com>
amd-xgbe: handle corner-case during sfp hotplug
Stefano Stabellini <sstabellini(a)kernel.org>
arm/xen: fix xen_vcpu_info allocation alignment
Jose Ignacio Tornos Martinez <jtornosm(a)redhat.com>
net: usb: ax88179_178a: fix failed operations during ax88179_reset
Kunwu Chan <chentao(a)kylinos.cn>
ipv4: Correct/silence an endian warning in __ip_do_redirect
Charles Yi <be286(a)163.com>
HID: fix HID device resource race between HID core and debugging support
Benjamin Tissoires <benjamin.tissoires(a)redhat.com>
HID: core: store the unique system identifier in hid_device
Jonas Karlman <jonas(a)kwiboo.se>
drm/rockchip: vop: Fix color for RGB888/BGR888 format on VOP full
Chen Ni <nichen(a)iscas.ac.cn>
ata: pata_isapnp: Add missing error check for devm_ioport_map()
Marek Vasut <marex(a)denx.de>
drm/panel: simple: Fix Innolux G101ICE-L01 timings
Marek Vasut <marex(a)denx.de>
drm/panel: simple: Fix Innolux G101ICE-L01 bus flags
David Howells <dhowells(a)redhat.com>
afs: Make error on cell lookup failure consistent with OpenAFS
Nathan Chancellor <nathan(a)kernel.org>
PCI: keystone: Drop __init from ks_pcie_add_pcie_{ep,port}()
Christopher Bednarz <christopher.n.bednarz(a)intel.com>
RDMA/irdma: Prevent zero-length STAG registration
Saravana Kannan <saravanak(a)google.com>
driver core: Release all resources during unbind before updating device links
-------------
Diffstat:
Makefile | 4 +-
arch/arm/xen/enlighten.c | 3 +-
arch/arm64/include/asm/cpufeature.h | 23 ++
arch/arm64/include/asm/sysreg.h | 6 +
arch/arm64/kvm/sys_regs.c | 10 +
arch/mips/kvm/mmu.c | 3 +-
arch/powerpc/kernel/fpu.S | 13 +
arch/powerpc/kernel/vector.S | 2 +
arch/s390/mm/page-states.c | 14 +-
drivers/acpi/resource.c | 7 +
drivers/ata/pata_isapnp.c | 3 +
drivers/base/dd.c | 4 +-
drivers/cpufreq/imx6q-cpufreq.c | 32 +--
drivers/firewire/core-device.c | 11 +-
drivers/gpu/drm/panel/panel-simple.c | 13 +-
drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 14 +-
drivers/hid/hid-core.c | 16 +-
drivers/hid/hid-debug.c | 3 +
drivers/infiniband/hw/i40iw/i40iw_ctrl.c | 6 +
drivers/infiniband/hw/i40iw/i40iw_type.h | 2 +
drivers/infiniband/hw/i40iw/i40iw_verbs.c | 10 +-
drivers/input/joystick/xpad.c | 2 +
drivers/md/bcache/btree.c | 6 +-
drivers/md/bcache/sysfs.c | 2 +-
drivers/md/dm-delay.c | 17 +-
drivers/md/dm-verity-fec.c | 3 +-
drivers/md/dm-verity-target.c | 4 +-
drivers/md/dm-verity.h | 6 -
drivers/mmc/core/block.c | 2 +
drivers/mmc/core/core.c | 15 +-
drivers/mmc/host/cqhci.c | 44 ++--
drivers/mtd/chips/cfi_cmdset_0001.c | 29 +-
drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 14 +
drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c | 11 +-
drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | 14 +-
drivers/net/ethernet/renesas/ravb_main.c | 20 +-
drivers/net/ethernet/stmicro/stmmac/mmc_core.c | 4 +
drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 +-
drivers/net/hyperv/netvsc_drv.c | 41 ++-
drivers/net/usb/ax88179_178a.c | 4 +-
drivers/nvme/target/core.c | 21 +-
drivers/nvme/target/fabrics-cmd.c | 15 +-
drivers/nvme/target/nvmet.h | 5 +-
drivers/pci/controller/dwc/pci-keystone.c | 8 +-
drivers/pinctrl/core.c | 6 +-
drivers/s390/block/dasd.c | 24 +-
drivers/scsi/qla2xxx/qla_def.h | 3 -
drivers/scsi/qla2xxx/qla_isr.c | 5 -
drivers/scsi/qla2xxx/qla_os.c | 39 +--
drivers/usb/dwc2/hcd_intr.c | 15 +-
drivers/usb/dwc3/core.c | 2 +
drivers/usb/dwc3/dwc3-qcom.c | 17 +-
drivers/usb/serial/option.c | 11 +-
drivers/video/fbdev/sticore.h | 2 +-
fs/afs/dynroot.c | 4 +-
fs/afs/super.c | 2 +
fs/afs/vl_rotate.c | 10 +
fs/btrfs/disk-io.c | 1 +
fs/btrfs/send.c | 2 +-
fs/btrfs/super.c | 5 +-
fs/btrfs/volumes.c | 9 +-
fs/cifs/cifsfs.c | 1 +
fs/ext4/extents_status.c | 306 +++++++++++++++-------
fs/io_uring.c | 2 +-
fs/overlayfs/super.c | 5 +-
fs/sync.c | 3 +-
include/linux/fs.h | 2 +
include/linux/hid.h | 5 +
include/scsi/scsi_cmnd.h | 6 +
net/ipv4/igmp.c | 6 +-
net/ipv4/route.c | 2 +-
security/integrity/iint.c | 48 +++-
security/integrity/ima/ima_api.c | 5 +
security/integrity/ima/ima_main.c | 16 +-
security/integrity/integrity.h | 2 +
sound/pci/hda/hda_intel.c | 2 +
sound/pci/hda/patch_realtek.c | 12 +
tools/perf/util/genelf.h | 4 +-
tools/perf/util/intel-pt.c | 13 +-
79 files changed, 765 insertions(+), 320 deletions(-)
When a kprobe is attached to a function that's name is not unique (is
static and shares the name with other functions in the kernel), the
kprobe is attached to the first function it finds. This is a bug as the
function that it is attaching to is not necessarily the one that the
user wants to attach to.
Instead of blindly picking a function to attach to what is ambiguous,
error with EADDRNOTAVAIL to let the user know that this function is not
unique, and that the user must use another unique function with an
address offset to get to the function they want to attach to.
Link: https://lore.kernel.org/all/20231020104250.9537-2-flaniel@linux.microsoft.c…
Cc: stable(a)vger.kernel.org
Fixes: 413d37d1eb69 ("tracing: Add kprobe-based event tracer")
Suggested-by: Masami Hiramatsu <mhiramat(a)kernel.org>
Signed-off-by: Francis Laniel <flaniel(a)linux.microsoft.com>
Link: https://lore.kernel.org/lkml/20230819101105.b0c104ae4494a7d1f2eea742@kernel…
Acked-by: Masami Hiramatsu (Google) <mhiramat(a)kernel.org>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat(a)kernel.org>
(cherry picked from commit b022f0c7e404887a7c5229788fc99eff9f9a80d5)
---
kernel/trace/trace_kprobe.c | 74 +++++++++++++++++++++++++++++++++++++
kernel/trace/trace_probe.h | 1 +
2 files changed, 75 insertions(+)
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 718357289899..2f7cdbecdddd 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -715,6 +715,36 @@ static inline void sanitize_event_name(char *name)
*name = '_';
}
+struct count_symbols_struct {
+ const char *func_name;
+ unsigned int count;
+};
+
+static int count_symbols(void *data, const char *name, struct module *unused0,
+ unsigned long unused1)
+{
+ struct count_symbols_struct *args = data;
+
+ if (strcmp(args->func_name, name))
+ return 0;
+
+ args->count++;
+
+ return 0;
+}
+
+static unsigned int number_of_same_symbols(char *func_name)
+{
+ struct count_symbols_struct args = {
+ .func_name = func_name,
+ .count = 0,
+ };
+
+ kallsyms_on_each_symbol(count_symbols, &args);
+
+ return args.count;
+}
+
static int trace_kprobe_create(int argc, const char *argv[])
{
/*
@@ -842,6 +872,31 @@ static int trace_kprobe_create(int argc, const char *argv[])
}
}
+ if (symbol && !strchr(symbol, ':')) {
+ unsigned int count;
+
+ count = number_of_same_symbols(symbol);
+ if (count > 1) {
+ /*
+ * Users should use ADDR to remove the ambiguity of
+ * using KSYM only.
+ */
+ trace_probe_log_err(0, NON_UNIQ_SYMBOL);
+ ret = -EADDRNOTAVAIL;
+
+ goto error;
+ } else if (count == 0) {
+ /*
+ * We can return ENOENT earlier than when register the
+ * kprobe.
+ */
+ trace_probe_log_err(0, BAD_PROBE_ADDR);
+ ret = -ENOENT;
+
+ goto error;
+ }
+ }
+
trace_probe_log_set_index(0);
if (event) {
ret = traceprobe_parse_event_name(&event, &group, buf,
@@ -1805,6 +1860,7 @@ static int unregister_kprobe_event(struct trace_kprobe *tk)
}
#ifdef CONFIG_PERF_EVENTS
+
/* create a trace_kprobe, but don't add it to global lists */
struct trace_event_call *
create_local_trace_kprobe(char *func, void *addr, unsigned long offs,
@@ -1814,6 +1870,24 @@ create_local_trace_kprobe(char *func, void *addr, unsigned long offs,
int ret;
char *event;
+ if (func) {
+ unsigned int count;
+
+ count = number_of_same_symbols(func);
+ if (count > 1)
+ /*
+ * Users should use addr to remove the ambiguity of
+ * using func only.
+ */
+ return ERR_PTR(-EADDRNOTAVAIL);
+ else if (count == 0)
+ /*
+ * We can return ENOENT earlier than when register the
+ * kprobe.
+ */
+ return ERR_PTR(-ENOENT);
+ }
+
/*
* local trace_kprobes are not added to dyn_event, so they are never
* searched in find_trace_kprobe(). Therefore, there is no concern of
diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h
index d4a69b83902e..22c05ca97758 100644
--- a/kernel/trace/trace_probe.h
+++ b/kernel/trace/trace_probe.h
@@ -390,6 +390,7 @@ extern int traceprobe_define_arg_fields(struct trace_event_call *event_call,
C(BAD_MAXACT, "Invalid maxactive number"), \
C(MAXACT_TOO_BIG, "Maxactive is too big"), \
C(BAD_PROBE_ADDR, "Invalid probed address or symbol"), \
+ C(NON_UNIQ_SYMBOL, "The symbol is not unique"), \
C(BAD_RETPROBE, "Retprobe address must be an function entry"), \
C(BAD_ADDR_SUFFIX, "Invalid probed address suffix"), \
C(NO_GROUP_NAME, "Group name is not specified"), \
--
2.34.1
When a kprobe is attached to a function that's name is not unique (is
static and shares the name with other functions in the kernel), the
kprobe is attached to the first function it finds. This is a bug as the
function that it is attaching to is not necessarily the one that the
user wants to attach to.
Instead of blindly picking a function to attach to what is ambiguous,
error with EADDRNOTAVAIL to let the user know that this function is not
unique, and that the user must use another unique function with an
address offset to get to the function they want to attach to.
Link: https://lore.kernel.org/all/20231020104250.9537-2-flaniel@linux.microsoft.c…
Cc: stable(a)vger.kernel.org
Fixes: 413d37d1eb69 ("tracing: Add kprobe-based event tracer")
Suggested-by: Masami Hiramatsu <mhiramat(a)kernel.org>
Signed-off-by: Francis Laniel <flaniel(a)linux.microsoft.com>
Link: https://lore.kernel.org/lkml/20230819101105.b0c104ae4494a7d1f2eea742@kernel…
Acked-by: Masami Hiramatsu (Google) <mhiramat(a)kernel.org>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat(a)kernel.org>
(cherry picked from commit b022f0c7e404887a7c5229788fc99eff9f9a80d5)
---
kernel/trace/trace_kprobe.c | 74 +++++++++++++++++++++++++++++++++++++
kernel/trace/trace_probe.h | 1 +
2 files changed, 75 insertions(+)
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 0b95277396fc..80a59dbdd631 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -714,6 +714,36 @@ static inline void sanitize_event_name(char *name)
*name = '_';
}
+struct count_symbols_struct {
+ const char *func_name;
+ unsigned int count;
+};
+
+static int count_symbols(void *data, const char *name, struct module *unused0,
+ unsigned long unused1)
+{
+ struct count_symbols_struct *args = data;
+
+ if (strcmp(args->func_name, name))
+ return 0;
+
+ args->count++;
+
+ return 0;
+}
+
+static unsigned int number_of_same_symbols(char *func_name)
+{
+ struct count_symbols_struct args = {
+ .func_name = func_name,
+ .count = 0,
+ };
+
+ kallsyms_on_each_symbol(count_symbols, &args);
+
+ return args.count;
+}
+
static int trace_kprobe_create(int argc, const char *argv[])
{
/*
@@ -825,6 +855,31 @@ static int trace_kprobe_create(int argc, const char *argv[])
}
}
+ if (symbol && !strchr(symbol, ':')) {
+ unsigned int count;
+
+ count = number_of_same_symbols(symbol);
+ if (count > 1) {
+ /*
+ * Users should use ADDR to remove the ambiguity of
+ * using KSYM only.
+ */
+ trace_probe_log_err(0, NON_UNIQ_SYMBOL);
+ ret = -EADDRNOTAVAIL;
+
+ goto error;
+ } else if (count == 0) {
+ /*
+ * We can return ENOENT earlier than when register the
+ * kprobe.
+ */
+ trace_probe_log_err(0, BAD_PROBE_ADDR);
+ ret = -ENOENT;
+
+ goto error;
+ }
+ }
+
trace_probe_log_set_index(0);
if (event) {
ret = traceprobe_parse_event_name(&event, &group, buf,
@@ -1596,6 +1651,7 @@ static int unregister_kprobe_event(struct trace_kprobe *tk)
}
#ifdef CONFIG_PERF_EVENTS
+
/* create a trace_kprobe, but don't add it to global lists */
struct trace_event_call *
create_local_trace_kprobe(char *func, void *addr, unsigned long offs,
@@ -1605,6 +1661,24 @@ create_local_trace_kprobe(char *func, void *addr, unsigned long offs,
int ret;
char *event;
+ if (func) {
+ unsigned int count;
+
+ count = number_of_same_symbols(func);
+ if (count > 1)
+ /*
+ * Users should use addr to remove the ambiguity of
+ * using func only.
+ */
+ return ERR_PTR(-EADDRNOTAVAIL);
+ else if (count == 0)
+ /*
+ * We can return ENOENT earlier than when register the
+ * kprobe.
+ */
+ return ERR_PTR(-ENOENT);
+ }
+
/*
* local trace_kprobes are not added to dyn_event, so they are never
* searched in find_trace_kprobe(). Therefore, there is no concern of
diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h
index dc19d5d185d4..edbb1624061e 100644
--- a/kernel/trace/trace_probe.h
+++ b/kernel/trace/trace_probe.h
@@ -403,6 +403,7 @@ extern int traceprobe_define_arg_fields(struct trace_event_call *event_call,
C(BAD_MAXACT, "Invalid maxactive number"), \
C(MAXACT_TOO_BIG, "Maxactive is too big"), \
C(BAD_PROBE_ADDR, "Invalid probed address or symbol"), \
+ C(NON_UNIQ_SYMBOL, "The symbol is not unique"), \
C(BAD_RETPROBE, "Retprobe address must be an function entry"), \
C(NO_GROUP_NAME, "Group name is not specified"), \
C(GROUP_TOO_LONG, "Group name is too long"), \
--
2.34.1
When a kprobe is attached to a function that's name is not unique (is
static and shares the name with other functions in the kernel), the
kprobe is attached to the first function it finds. This is a bug as the
function that it is attaching to is not necessarily the one that the
user wants to attach to.
Instead of blindly picking a function to attach to what is ambiguous,
error with EADDRNOTAVAIL to let the user know that this function is not
unique, and that the user must use another unique function with an
address offset to get to the function they want to attach to.
Link: https://lore.kernel.org/all/20231020104250.9537-2-flaniel@linux.microsoft.c…
Cc: stable(a)vger.kernel.org
Fixes: 413d37d1eb69 ("tracing: Add kprobe-based event tracer")
Suggested-by: Masami Hiramatsu <mhiramat(a)kernel.org>
Signed-off-by: Francis Laniel <flaniel(a)linux.microsoft.com>
Link: https://lore.kernel.org/lkml/20230819101105.b0c104ae4494a7d1f2eea742@kernel…
Acked-by: Masami Hiramatsu (Google) <mhiramat(a)kernel.org>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat(a)kernel.org>
(cherry picked from commit b022f0c7e404887a7c5229788fc99eff9f9a80d5)
---
kernel/trace/trace_kprobe.c | 48 +++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 36dfea29d5fa..720110942505 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -715,6 +715,36 @@ static inline void sanitize_event_name(char *name)
*name = '_';
}
+struct count_symbols_struct {
+ const char *func_name;
+ unsigned int count;
+};
+
+static int count_symbols(void *data, const char *name, struct module *unused0,
+ unsigned long unused1)
+{
+ struct count_symbols_struct *args = data;
+
+ if (strcmp(args->func_name, name))
+ return 0;
+
+ args->count++;
+
+ return 0;
+}
+
+static unsigned int number_of_same_symbols(char *func_name)
+{
+ struct count_symbols_struct args = {
+ .func_name = func_name,
+ .count = 0,
+ };
+
+ kallsyms_on_each_symbol(count_symbols, &args);
+
+ return args.count;
+}
+
static int create_trace_kprobe(int argc, char **argv)
{
/*
@@ -845,6 +875,24 @@ static int create_trace_kprobe(int argc, char **argv)
}
argc -= 2; argv += 2;
+ if (symbol && !strchr(symbol, ':')) {
+ unsigned int count;
+
+ count = number_of_same_symbols(symbol);
+ if (count > 1)
+ /*
+ * Users should use ADDR to remove the ambiguity of
+ * using KSYM only.
+ */
+ return -EADDRNOTAVAIL;
+ else if (count == 0)
+ /*
+ * We can return ENOENT earlier than when register the
+ * kprobe.
+ */
+ return -ENOENT;
+ }
+
/* setup a probe */
if (!event) {
/* Make a new event name */
--
2.34.1
Commit b022f0c7e404887a7c5229788fc99eff9f9a80d5 upstream.
When a kprobe is attached to a function that's name is not unique (is
static and shares the name with other functions in the kernel), the
kprobe is attached to the first function it finds. This is a bug as the
function that it is attaching to is not necessarily the one that the
user wants to attach to.
Instead of blindly picking a function to attach to what is ambiguous,
error with EADDRNOTAVAIL to let the user know that this function is not
unique, and that the user must use another unique function with an
address offset to get to the function they want to attach to.
Link: https://lore.kernel.org/all/20231020104250.9537-2-flaniel@linux.microsoft.c…
Cc: stable(a)vger.kernel.org
Fixes: 413d37d1eb69 ("tracing: Add kprobe-based event tracer")
Suggested-by: Masami Hiramatsu <mhiramat(a)kernel.org>
Signed-off-by: Francis Laniel <flaniel(a)linux.microsoft.com>
Link: https://lore.kernel.org/lkml/20230819101105.b0c104ae4494a7d1f2eea742@kernel…
Acked-by: Masami Hiramatsu (Google) <mhiramat(a)kernel.org>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat(a)kernel.org>
(cherry picked from commit b022f0c7e404887a7c5229788fc99eff9f9a80d5)
---
kernel/trace/trace_kprobe.c | 48 +++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index d66aed6e9c75..45779ec370fa 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -617,6 +617,36 @@ static inline void sanitize_event_name(char *name)
*name = '_';
}
+struct count_symbols_struct {
+ const char *func_name;
+ unsigned int count;
+};
+
+static int count_symbols(void *data, const char *name, struct module *unused0,
+ unsigned long unused1)
+{
+ struct count_symbols_struct *args = data;
+
+ if (strcmp(args->func_name, name))
+ return 0;
+
+ args->count++;
+
+ return 0;
+}
+
+static unsigned int number_of_same_symbols(char *func_name)
+{
+ struct count_symbols_struct args = {
+ .func_name = func_name,
+ .count = 0,
+ };
+
+ kallsyms_on_each_symbol(count_symbols, &args);
+
+ return args.count;
+}
+
static int create_trace_kprobe(int argc, char **argv)
{
/*
@@ -746,6 +776,24 @@ static int create_trace_kprobe(int argc, char **argv)
}
argc -= 2; argv += 2;
+ if (symbol && !strchr(symbol, ':')) {
+ unsigned int count;
+
+ count = number_of_same_symbols(symbol);
+ if (count > 1)
+ /*
+ * Users should use ADDR to remove the ambiguity of
+ * using KSYM only.
+ */
+ return -EADDRNOTAVAIL;
+ else if (count == 0)
+ /*
+ * We can return ENOENT earlier than when register the
+ * kprobe.
+ */
+ return -ENOENT;
+ }
+
/* setup a probe */
if (!event) {
/* Make a new event name */
--
2.34.1