From: Filipe Manana <fdmanana(a)suse.com>
stable inclusion
from stable-4.19.324
commit 2fd0948a483e9cb2d669c7199bc620a21c97673d
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IB5AVH
CVE: CVE-2024-50273
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?…
--------------------------------
commit c9a75ec45f1111ef530ab186c2a7684d0a0c9245 upstream.
At insert_delayed_ref() if we need to update the action of an existing
ref to BTRFS_DROP_DELAYED_REF, we delete the ref from its ref head's
ref_add_list using list_del(), which leaves the ref's add_list member
not reinitialized, as list_del() sets the next and prev members of the
list to LIST_POISON1 and LIST_POISON2, respectively.
If later we end up calling drop_delayed_ref() against the ref, which can
happen during merging or when destroying delayed refs due to a transaction
abort, we can trigger a crash since at drop_delayed_ref() we call
list_empty() against the ref's add_list, which returns false since
the list was not reinitialized after the list_del() and as a consequence
we call list_del() again at drop_delayed_ref(). This results in an
invalid list access since the next and prev members are set to poison
pointers, resulting in a splat if CONFIG_LIST_HARDENED and
CONFIG_DEBUG_LIST are set or invalid poison pointer dereferences
otherwise.
So fix this by deleting from the list with list_del_init() instead.
Fixes: 1d57ee941692 ("btrfs: improve delayed refs iterations")
CC: stable(a)vger.kernel.org # 4.19+
Reviewed-by: Johannes Thumshirn <johannes.thumshirn(a)wdc.com>
Signed-off-by: Filipe Manana <fdmanana(a)suse.com>
Reviewed-by: David Sterba <dsterba(a)suse.com>
Signed-off-by: David Sterba <dsterba(a)suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Signed-off-by: Zizhi Wo <wozizhi(a)huawei.com>
---
fs/btrfs/delayed-ref.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
index 7e5c81e80e15..a5fab1bc0e88 100644
--- a/fs/btrfs/delayed-ref.c
+++ b/fs/btrfs/delayed-ref.c
@@ -426,7 +426,7 @@ static int insert_delayed_ref(struct btrfs_trans_handle *trans,
&href->ref_add_list);
else if (ref->action == BTRFS_DROP_DELAYED_REF) {
ASSERT(!list_empty(&exist->add_list));
- list_del(&exist->add_list);
+ list_del_init(&exist->add_list);
} else {
ASSERT(0);
}
--
2.46.1
From: Filipe Manana <fdmanana(a)suse.com>
stable inclusion
from stable-v5.10.230
commit bf0b0c6d159767c0d1c21f793950d78486690ee0
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IB5AVH
CVE: CVE-2024-50273
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?…
--------------------------------
commit c9a75ec45f1111ef530ab186c2a7684d0a0c9245 upstream.
At insert_delayed_ref() if we need to update the action of an existing
ref to BTRFS_DROP_DELAYED_REF, we delete the ref from its ref head's
ref_add_list using list_del(), which leaves the ref's add_list member
not reinitialized, as list_del() sets the next and prev members of the
list to LIST_POISON1 and LIST_POISON2, respectively.
If later we end up calling drop_delayed_ref() against the ref, which can
happen during merging or when destroying delayed refs due to a transaction
abort, we can trigger a crash since at drop_delayed_ref() we call
list_empty() against the ref's add_list, which returns false since
the list was not reinitialized after the list_del() and as a consequence
we call list_del() again at drop_delayed_ref(). This results in an
invalid list access since the next and prev members are set to poison
pointers, resulting in a splat if CONFIG_LIST_HARDENED and
CONFIG_DEBUG_LIST are set or invalid poison pointer dereferences
otherwise.
So fix this by deleting from the list with list_del_init() instead.
Fixes: 1d57ee941692 ("btrfs: improve delayed refs iterations")
CC: stable(a)vger.kernel.org # 4.19+
Reviewed-by: Johannes Thumshirn <johannes.thumshirn(a)wdc.com>
Signed-off-by: Filipe Manana <fdmanana(a)suse.com>
Reviewed-by: David Sterba <dsterba(a)suse.com>
Signed-off-by: David Sterba <dsterba(a)suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Signed-off-by: Zizhi Wo <wozizhi(a)huawei.com>
---
fs/btrfs/delayed-ref.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
index 30883b9a26d8..e2309bc9e45d 100644
--- a/fs/btrfs/delayed-ref.c
+++ b/fs/btrfs/delayed-ref.c
@@ -620,7 +620,7 @@ static int insert_delayed_ref(struct btrfs_trans_handle *trans,
&href->ref_add_list);
else if (ref->action == BTRFS_DROP_DELAYED_REF) {
ASSERT(!list_empty(&exist->add_list));
- list_del(&exist->add_list);
+ list_del_init(&exist->add_list);
} else {
ASSERT(0);
}
--
2.46.1
From: Filipe Manana <fdmanana(a)suse.com>
stable inclusion
from stable-v5.10.230
commit bf0b0c6d159767c0d1c21f793950d78486690ee0
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IB5AVH
CVE: CVE-2024-50273
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?…
--------------------------------
commit c9a75ec45f1111ef530ab186c2a7684d0a0c9245 upstream.
At insert_delayed_ref() if we need to update the action of an existing
ref to BTRFS_DROP_DELAYED_REF, we delete the ref from its ref head's
ref_add_list using list_del(), which leaves the ref's add_list member
not reinitialized, as list_del() sets the next and prev members of the
list to LIST_POISON1 and LIST_POISON2, respectively.
If later we end up calling drop_delayed_ref() against the ref, which can
happen during merging or when destroying delayed refs due to a transaction
abort, we can trigger a crash since at drop_delayed_ref() we call
list_empty() against the ref's add_list, which returns false since
the list was not reinitialized after the list_del() and as a consequence
we call list_del() again at drop_delayed_ref(). This results in an
invalid list access since the next and prev members are set to poison
pointers, resulting in a splat if CONFIG_LIST_HARDENED and
CONFIG_DEBUG_LIST are set or invalid poison pointer dereferences
otherwise.
So fix this by deleting from the list with list_del_init() instead.
Fixes: 1d57ee941692 ("btrfs: improve delayed refs iterations")
CC: stable(a)vger.kernel.org # 4.19+
Reviewed-by: Johannes Thumshirn <johannes.thumshirn(a)wdc.com>
Signed-off-by: Filipe Manana <fdmanana(a)suse.com>
Reviewed-by: David Sterba <dsterba(a)suse.com>
Signed-off-by: David Sterba <dsterba(a)suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Signed-off-by: Zizhi Wo <wozizhi(a)huawei.com>
---
fs/btrfs/delayed-ref.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
index 30883b9a26d8..e2309bc9e45d 100644
--- a/fs/btrfs/delayed-ref.c
+++ b/fs/btrfs/delayed-ref.c
@@ -620,7 +620,7 @@ static int insert_delayed_ref(struct btrfs_trans_handle *trans,
&href->ref_add_list);
else if (ref->action == BTRFS_DROP_DELAYED_REF) {
ASSERT(!list_empty(&exist->add_list));
- list_del(&exist->add_list);
+ list_del_init(&exist->add_list);
} else {
ASSERT(0);
}
--
2.46.1
tree: https://gitee.com/openeuler/kernel.git OLK-6.6
head: dccd6d8473b2f20aaa76e23820a3bf4934fc8d36
commit: 914854f2adb6988ac3b6521088ec96833d6743e2 [1513/1513] driver: crypto - update support for Mont-TSSE Driver
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20241122/202411221252.PUnKjTWH-lkp@…)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241122/202411221252.PUnKjTWH-lkp@…)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp(a)intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411221252.PUnKjTWH-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from drivers/crypto/montage/tsse/tsse_ipc_api.c:10:
In file included from drivers/crypto/montage/tsse/tsse_dev.h:13:
In file included from include/linux/pci.h:1669:
In file included from include/linux/dmapool.h:14:
In file included from include/linux/scatterlist.h:8:
In file included from include/linux/mm.h:2243:
include/linux/vmstat.h:508:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
508 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
509 | item];
| ~~~~
include/linux/vmstat.h:515:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
515 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
516 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
522 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
include/linux/vmstat.h:527:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
527 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
528 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:536:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
536 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
537 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
>> drivers/crypto/montage/tsse/tsse_ipc_api.c:62:36: warning: variable 'device_handle' is uninitialized when used here [-Wuninitialized]
62 | service_instance->device_handle = device_handle;
| ^~~~~~~~~~~~~
drivers/crypto/montage/tsse/tsse_ipc_api.c:56:19: note: initialize the variable 'device_handle' to silence this warning
56 | int device_handle;
| ^
| = 0
6 warnings generated.
vim +/device_handle +62 drivers/crypto/montage/tsse/tsse_ipc_api.c
41
42 /**
43 * tsse_im_service_handle_alloc() - Allocate IPC Message service handle for specific service.
44 * @name: IPC Message service name
45 * @cb: request callback for the service
46 * @handle: function output for the service handle
47 * Return: 0 if allocated successfully, other values for failure
48 */
49 int tsse_im_service_handle_alloc(
50 const char *name,
51 tsse_im_cb_func cb,
52 tsse_im_service_handle *handle)
53 {
54 struct tsse_service_instance *service_instance;
55 int ret;
56 int device_handle;
57
58 service_instance = kzalloc(sizeof(struct tsse_service_instance), GFP_ATOMIC);
59 if (!service_instance)
60 return -ENOMEM;
61 service_instance->service_opened = 0;
> 62 service_instance->device_handle = device_handle;
63 service_instance->cb = cb;
64 strscpy(service_instance->service_name, name, TSSE_IM_SERVICE_NAME_LEN);
65
66 ret = tsse_schedule_device_handle(service_instance);
67 if (ret) {
68 kfree(service_instance);
69 return ret;
70 }
71
72 ret = tsse_service_open(service_instance);
73 if (ret) {
74 pr_err("%s(): open service: %s failed: %d\n",
75 __func__, service_instance->service_name, ret);
76 kfree(service_instance);
77 return ret;
78 }
79 *handle = service_instance;
80 return 0;
81 }
82 EXPORT_SYMBOL_GPL(tsse_im_service_handle_alloc);
83
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Hi Hui,
FYI, the error/warning still remains.
tree: https://gitee.com/openeuler/kernel.git openEuler-1.0-LTS
head: 81e029d5dd0cae934243168eee37ef303ebcce38
commit: 713cfd2684fa5ea08b144d92b9858b932c0f1705 [1304/1304] sched: Introduce smart grid scheduling strategy for cfs
config: x86_64-randconfig-002-20241122 (https://download.01.org/0day-ci/archive/20241122/202411221242.ljLHS46N-lkp@…)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241122/202411221242.ljLHS46N-lkp@…)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp(a)intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411221242.ljLHS46N-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from kernel/sched/core.c:8:
In file included from kernel/sched/sched.h:39:
In file included from include/linux/blkdev.h:16:
include/linux/pagemap.h:425:21: warning: cast from 'int (*)(struct file *, struct page *)' to 'filler_t *' (aka 'int (*)(void *, struct page *)') converts to incompatible function type [-Wcast-function-type-strict]
425 | filler_t *filler = (filler_t *)mapping->a_ops->readpage;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from kernel/sched/core.c:8:
kernel/sched/sched.h:1249:15: warning: cast from 'void (*)(struct rq *)' to 'void (*)(struct callback_head *)' converts to incompatible function type [-Wcast-function-type-strict]
1249 | head->func = (void (*)(struct callback_head *))func;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/sched/core.c:1587:6: warning: no previous prototype for function 'sched_set_stop_task' [-Wmissing-prototypes]
1587 | void sched_set_stop_task(int cpu, struct task_struct *stop)
| ^
kernel/sched/core.c:1587:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
1587 | void sched_set_stop_task(int cpu, struct task_struct *stop)
| ^
| static
kernel/sched/core.c:2741:10: warning: cast from 'void (*)(struct callback_head *)' to 'void (*)(struct rq *)' converts to incompatible function type [-Wcast-function-type-strict]
2741 | func = (void (*)(struct rq *))head->func;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/sched/core.c:3632:35: warning: no previous prototype for function 'schedule_user' [-Wmissing-prototypes]
3632 | asmlinkage __visible void __sched schedule_user(void)
| ^
kernel/sched/core.c:3632:22: note: declare 'static' if the function is not intended to be used outside of this translation unit
3632 | asmlinkage __visible void __sched schedule_user(void)
| ^
| static
kernel/sched/core.c:3771:35: warning: no previous prototype for function 'preempt_schedule_irq' [-Wmissing-prototypes]
3771 | asmlinkage __visible void __sched preempt_schedule_irq(void)
| ^
kernel/sched/core.c:3771:22: note: declare 'static' if the function is not intended to be used outside of this translation unit
3771 | asmlinkage __visible void __sched preempt_schedule_irq(void)
| ^
| static
>> kernel/sched/core.c:5845:2: error: implicit declaration of function 'tg_update_affinity_domains' [-Werror,-Wimplicit-function-declaration]
5845 | tg_update_affinity_domains(cpu, 1);
| ^
kernel/sched/core.c:5904:2: error: implicit declaration of function 'tg_update_affinity_domains' [-Werror,-Wimplicit-function-declaration]
5904 | tg_update_affinity_domains(cpu, 0);
| ^
kernel/sched/core.c:5976:2: error: implicit declaration of function 'init_auto_affinity' [-Werror,-Wimplicit-function-declaration]
5976 | init_auto_affinity(&root_task_group);
| ^
kernel/sched/core.c:5976:2: note: did you mean 'irq_set_affinity'?
include/linux/interrupt.h:292:1: note: 'irq_set_affinity' declared here
292 | irq_set_affinity(unsigned int irq, const struct cpumask *cpumask)
| ^
kernel/sched/core.c:5976:22: error: use of undeclared identifier 'root_task_group'; did you mean 'task_group'?
5976 | init_auto_affinity(&root_task_group);
| ^~~~~~~~~~~~~~~
| task_group
kernel/sched/sched.h:1444:34: note: 'task_group' declared here
1444 | static inline struct task_group *task_group(struct task_struct *p)
| ^
kernel/sched/core.c:6029:32: warning: variable 'ptr' set but not used [-Wunused-but-set-variable]
6029 | unsigned long alloc_size = 0, ptr;
| ^
7 warnings and 4 errors generated.
vim +/tg_update_affinity_domains +5845 kernel/sched/core.c
5831
5832 int sched_cpu_activate(unsigned int cpu)
5833 {
5834 struct rq *rq = cpu_rq(cpu);
5835 struct rq_flags rf;
5836
5837 #ifdef CONFIG_SCHED_SMT
5838 /*
5839 * When going up, increment the number of cores with SMT present.
5840 */
5841 if (cpumask_weight(cpu_smt_mask(cpu)) == 2)
5842 static_branch_inc_cpuslocked(&sched_smt_present);
5843 #endif
5844 set_cpu_active(cpu, true);
> 5845 tg_update_affinity_domains(cpu, 1);
5846
5847 if (sched_smp_initialized) {
5848 sched_domains_numa_masks_set(cpu);
5849 cpuset_cpu_active();
5850 }
5851
5852 /*
5853 * Put the rq online, if not already. This happens:
5854 *
5855 * 1) In the early boot process, because we build the real domains
5856 * after all CPUs have been brought up.
5857 *
5858 * 2) At runtime, if cpuset_cpu_active() fails to rebuild the
5859 * domains.
5860 */
5861 rq_lock_irqsave(rq, &rf);
5862 if (rq->rd) {
5863 BUG_ON(!cpumask_test_cpu(cpu, rq->rd->span));
5864 set_rq_online(rq);
5865 }
5866 rq_unlock_irqrestore(rq, &rf);
5867
5868 update_max_interval();
5869
5870 return 0;
5871 }
5872
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki