5.15.143-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainerPATCH 139/141 smb: client: fix potential NULL deref in parse_dfs_referrals()
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paulo Alcantara <[email protected]>
[ Upstream commit 92414333eb375ed64f4ae92d34d579e826936480 ]
If server returned no data for FSCTL_DFS_GET_REFERRALS, @dfs_rsp will remain NULL and then parse_dfs_referrals() will dereference it.
Fix this by returning -EIO when no output data is returned.
Besides, we can't fix it in SMB2_ioctl() as some FSCTLs are allowed to return no data as per MS-SMB2 2.2.32.
--- fs/cifs/smb2ops.c | 2 ++ 1 file changed, 2 insertions(+)
fs/cifs/smb2ops.c +2 -0
@@ -2926,6 +2926,8 @@ smb2_get_dfs_refer(const unsigned int xid, struct cifs_ses *ses,usleep_range (512 ,2048 ); }while (++retry_count <5 ); +if (!rc && !dfs_rsp) + rc = -EIO ;if (rc) {if (!is_retryable_error (rc) && rc != -ENOENT && rc != -EOPNOTSUPP )cifs_tcon_dbg (VFS ,"%s: ioctl error: rc=%d\n" , __func__, rc);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 140/141 devcoredump : Serialize devcd_del work
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mukesh Ojha <[email protected]>
[ Upstream commit 01daccf748323dfc61112f474cf2ba81015446b0 ]
In following scenario(diagram), when one thread X running dev_coredumpm() adds devcd device to the framework which sends uevent notification to userspace and another thread Y reads this uevent and call to devcd_data_write() which eventually try to delete the queued timer that is not initialized/queued yet.
So, debug object reports some warning and in the meantime, timer is initialized and queued from X path. and from Y path, it gets reinitialized again and timer->entry.pprev=NULL and try_to_grab_pending() stucks.
To fix this, introduce mutex and a boolean flag to serialize the behaviour.
cpu0(X) cpu1(Y)
dev_coredump() uevent sent to user space
device_add() ======================> user space process Y reads the
uevents writes to devcd fd which results into writes to
devcd_data_write()
mod_delayed_work()
try_to_grab_pending()
del_timer()
debug_assert_init()
INIT_DELAYED_WORK()
schedule_delayed_work()
debug_object_fixup()
timer_fixup_assert_init()
timer_setup()
do_init_timer()
/*
Above call reinitializes
the timer to
timer->entry.pprev=NULL
and this will be checked
later in timer_pending() call.
*/
timer_pending()
!hlist_unhashed_lockless(&timer->entry)
!h->pprev
/*
del_timer() checks h->pprev and finds
it to be NULL due to which
try_to_grab_pending() stucks.
*/Stable-dep-of: af54d778a038 ("devcoredump: Send uevent once devcd is ready")
--- drivers/base/devcoredump.c | 83 +++++++++++++++++++++++++++++++++++++- 1 file changed, 81 insertions(+), 2 deletions(-)
drivers/base/devcoredump.c +81 -2
@@ -25,6 +25,47 @@ struct devcd_entry {struct device devcd_dev;void *data;size_t datalen; +/* +* Here, mutex is required to serialize the calls to del_wk work between +* user/kernel space which happens when devcd is added with device_add() +* and that sends uevent to user space. User space reads the uevents, +* and calls to devcd_data_write() which try to modify the work which is +* not even initialized/queued from devcoredump. +* +* +* +* cpu0(X) cpu1(Y) +* +* dev_coredump() uevent sent to user space +* device_add() ======================> user space process Y reads the +* uevents writes to devcd fd +* which results into writes to +* +* devcd_data_write() +* mod_delayed_work() +* try_to_grab_pending() +* del_timer() +* debug_assert_init() +* INIT_DELAYED_WORK() +* schedule_delayed_work() +* +* +* Also, mutex alone would not be enough to avoid scheduling of +* del_wk work after it get flush from a call to devcd_free() +* mentioned as below. +* +* disabled_store() +* devcd_free() +* mutex_lock() devcd_data_write() +* flush_delayed_work() +* mutex_unlock() +* mutex_lock() +* mod_delayed_work() +* mutex_unlock() +* So, delete_work flag is required. +*/ +struct mutex mutex; +bool delete_work;struct module *owner;ssize_t (*read)(char *buffer,loff_t offset,size_t count,void *data,size_t datalen);
@@ -84,7 +125,12 @@ static ssize_t devcd_data_write(struct file *filp, struct kobject *kobj,struct device *dev =kobj_to_dev (kobj);struct devcd_entry *devcd =dev_to_devcd (dev); -mod_delayed_work (system_wq, &devcd->del_wk,0 ); +mutex_lock (&devcd->mutex); +if (!devcd->delete_work) { + devcd->delete_work = true; +mod_delayed_work (system_wq, &devcd->del_wk,0 ); + } +mutex_unlock (&devcd->mutex);return count; }
@@ -112,7 +158,12 @@ static int devcd_free(struct device *dev, void *data) {struct devcd_entry *devcd =dev_to_devcd (dev); +mutex_lock (&devcd->mutex); +if (!devcd->delete_work) + devcd->delete_work = true; +flush_delayed_work (&devcd->del_wk); +mutex_unlock (&devcd->mutex);return 0 ; }
@@ -122,6 +173,30 @@ static ssize_t disabled_show(struct class *class, struct class_attribute *attr,return sysfs_emit (buf,"%d\n" , devcd_disabled); } +/* +* +* disabled_store() worker() +* class_for_each_device(&devcd_class, +* NULL, NULL, devcd_free) +* ... +* ... +* while ((dev = class_dev_iter_next(&iter)) +* devcd_del() +* device_del() +* put_device() <- last reference +* error = fn(dev, data) devcd_dev_release() +* devcd_free(dev, data) kfree(devcd) +* mutex_lock(&devcd->mutex); +* +* +* In the above diagram, It looks like disabled_store() would be racing with parallely +* running devcd_del() and result in memory abort while acquiring devcd->mutex which +* is called after kfree of devcd memory after dropping its last reference with +* put_device(). However, this will not happens as fn(dev, data) runs +* with its own reference to device via klist_node so it is not its last reference. +* so, above situation would not occur. +*/ +static ssize_t disabled_store (struct class *class,struct class_attribute *attr,const char *buf,size_t count) {
@@ -278,13 +353,16 @@ void dev_coredumpm(struct device *dev, struct module *owner, devcd->read = read; devcd->free = free; devcd->failing_dev =get_device (dev); + devcd->delete_work = false; +mutex_init (&devcd->mutex);device_initialize (&devcd->devcd_dev);dev_set_name (&devcd->devcd_dev,"devcd%d" ,atomic_inc_return (&devcd_count)); devcd->devcd_dev.class = &devcd_class; +mutex_lock (&devcd->mutex);if (device_add (&devcd->devcd_dev)) goto put_device;
@@ -301,10 +379,11 @@ void dev_coredumpm(struct device *dev, struct module *owner,INIT_DELAYED_WORK (&devcd->del_wk, devcd_del);schedule_delayed_work (&devcd->del_wk,DEVCD_TIMEOUT ); - +mutex_unlock (&devcd->mutex);return ; put_device:put_device (&devcd->devcd_dev); +mutex_unlock (&devcd->mutex); put_module:module_put (owner); free:
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 141/141 devcoredump: Send uevent once devcd is ready
In reply to Greg Kroah-Hartman5.15-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mukesh Ojha <[email protected]>
[ Upstream commit af54d778a03853801d681c98c0c2a6c316ef9ca7 ]
dev_coredumpm() creates a devcoredump device and adds it to the core kernel framework which eventually end up sending uevent to the user space and later creates a symbolic link to the failed device. An application running in userspace may be interested in this symbolic link to get the name of the failed device.
In a issue scenario, once uevent sent to the user space it start reading '/sys/class/devcoredump/devcdX/failing_device' to get the actual name of the device which might not been created and it is in its path of creation.
To fix this, suppress sending uevent till the failing device symbolic link gets created and send uevent once symbolic link is created successfully.
--- drivers/base/devcoredump.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/base/devcoredump.c +3 -0
@@ -363,6 +363,7 @@ void dev_coredumpm(struct device *dev, struct module *owner, devcd->devcd_dev.class = &devcd_class;mutex_lock (&devcd->mutex); +dev_set_uevent_suppress (&devcd->devcd_dev, true);if (device_add (&devcd->devcd_dev)) goto put_device;
@@ -377,6 +378,8 @@ void dev_coredumpm(struct device *dev, struct module *owner, "devcoredump"))dev_warn (dev,"devcoredump create_link failed\n" ); +dev_set_uevent_suppress (&devcd->devcd_dev, false); +kobject_uevent (&devcd->devcd_dev.kobj,KOBJ_ADD );INIT_DELAYED_WORK (&devcd->del_wk, devcd_del);schedule_delayed_work (&devcd->del_wk,DEVCD_TIMEOUT );mutex_unlock (&devcd->mutex);
Signature · 1 line
2.42.0
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.15.143 release. There are 141 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 Wed, 13 Dec 2023 18:19:59 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.15.143-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.15.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels, build tested on BMIPS_GENERIC:
Signature · 1 line
Florian
Hello!
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.15.143 release. There are 141 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 Wed, 13 Dec 2023 18:19:59 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.15.143-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.15.y
and the diffstat can be found below.thanks,
greg k-h
We're seeing new warnings with GCC-8 and failures with GCC-12 on x86/i386:
-----8<-----
In file included from /builds/linux/drivers/gpu/drm/i915/gem/i915_gem_context.c:2291:
/builds/linux/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c: In function '__igt_ctx_sseu':
/builds/linux/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c:1284:9: error: left shift of negative value [-Werror=shift-negative-value]
~(~0 << (hweight32(engine->sseu.subslice_mask) / 2));
^~
cc1: all warnings being treated as errors
make[5]: *** [/builds/linux/scripts/Makefile.build:289: drivers/gpu/drm/i915/gem/i915_gem_context.o] Error 1
/builds/linux/drivers/gpu/drm/i915/i915_perf.c: In function 'get_default_sseu_config':
/builds/linux/drivers/gpu/drm/i915/i915_perf.c:2817:9: error: left shift of negative value [-Werror=shift-negative-value]
~(~0 << (hweight8(out_sseu->subslice_mask) / 2));
^~ cc1: all warnings being treated as errors
make[5]: *** [/builds/linux/scripts/Makefile.build:289: drivers/gpu/drm/i915/i915_perf.o] Error 1
----->8-----
Bisection points to:
commit 09ebdc1b3dfacc275d5eec3f1dcf632f18bbf5a8
Author: Arnd Bergmann <[email protected]>
Date: Tue Mar 8 22:56:14 2022 +0100
Kbuild: move to -std=gnu11
[ Upstream commit e8c07082a810fbb9db303a2b66b66b8d7e588b53 ]
For GCC-12 it's allmodconfig failing, for GCC-8 it's defconfig (i386_defconfig, x86_64_defconfig) just reporting new warnings.
Some reproducers:
tuxmake --runtime podman --target-arch x86_64 --toolchain gcc-8 --kconfig x86_64_defconfig tuxmake --runtime podman --target-arch x86_64 --toolchain gcc-12 --kconfig allmodconfig
Greetings!
Daniel Díaz
[email protected]
Greg Kroah-Hartman
maintainerQuoted 51 lines · Daniel Díaz
Hello!
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.15.143 release. There are 141 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 Wed, 13 Dec 2023 18:19:59 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.15.143-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.15.y
and the diffstat can be found below.thanks,
greg k-h
We're seeing new warnings with GCC-8 and failures with GCC-12 on x86/i386:
-----8<-----
In file included from /builds/linux/drivers/gpu/drm/i915/gem/i915_gem_context.c:2291:
/builds/linux/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c: In function '__igt_ctx_sseu':
/builds/linux/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c:1284:9: error: left shift of negative value [-Werror=shift-negative-value]~(~0 << (hweight32(engine->sseu.subslice_mask) / 2)); ^~ cc1: all warnings being treated as errors make[5]: *** [/builds/linux/scripts/Makefile.build:289: drivers/gpu/drm/i915/gem/i915_gem_context.o] Error 1 /builds/linux/drivers/gpu/drm/i915/i915_perf.c: In function 'get_default_sseu_config': /builds/linux/drivers/gpu/drm/i915/i915_perf.c:2817:9: error: left shift of negative value [-Werror=shift-negative-value] ~(~0 << (hweight8(out_sseu->subslice_mask) / 2)); ^~cc1: all warnings being treated as errors
make[5]: *** [/builds/linux/scripts/Makefile.build:289:drivers/gpu/drm/i915/i915_perf.o] Error 1
----->8-----Bisection points to:
commit
09ebdc1b3dfacc275d5eec3f1dcf632f18bbf5a8
Author: Arnd Bergmann <[email protected]>
Date: Tue Mar 8 22:56:14 2022 +0100
Kbuild: move to -std=gnu11
[ Upstream commite8c07082a810fbb9db303a2b66b66b8d7e588b53]For GCC-12 it's allmodconfig failing, for GCC-8 it's defconfig (
i386_defconfig,x86_64_defconfig) just reporting new warnings.
Quoted 8 lines
Some reproducers:
tuxmake --runtime podman --target-arch x86_64 --toolchain gcc-8 --kconfig x86_64_defconfig tuxmake --runtime podman --target-arch x86_64 --toolchain gcc-12 --kconfig allmodconfig
Ok, let me go drop this change and fix up the original commit that required this language change to happen as we aren't quite ready for it yet...
thanks,
greg k-h
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.15.143 release. There are 141 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 Wed, 13 Dec 2023 18:19:59 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.15.143-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.15.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah