Hi Yang,
FYI, the error/warning still remains.
tree: https://gitee.com/openeuler/kernel.git openEuler-1.0-LTS
head: 078e0901be705959736f37cb993768ed39658448
commit: e63b4759933f6a5c5ce6cdc1d11c7bf2201d0612 [1290/1290] arm64: arch_timer: only do cntvct workaround on VDSO path on D05
config: arm64-randconfig-002-20241112 (https://download.01.org/0day-ci/archive/20241112/202411122158.hK6m4BFI-lkp@…)
compiler: aarch64-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241112/202411122158.hK6m4BFI-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/202411122158.hK6m4BFI-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/clocksource/arm_arch_timer.c: In function 'arch_timer_enable_workaround':
>> drivers/clocksource/arm_arch_timer.c:554:44: error: 'hisi_161010101_read_cntvct_el0' undeclared (first use in this function)
554 | if (wa->read_cntvct_el0 == hisi_161010101_read_cntvct_el0) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/clocksource/arm_arch_timer.c:554:44: note: each undeclared identifier is reported only once for each function it appears in
vim +/hisi_161010101_read_cntvct_el0 +554 drivers/clocksource/arm_arch_timer.c
527
528 static
529 void arch_timer_enable_workaround(const struct arch_timer_erratum_workaround *wa,
530 bool local)
531 {
532 int i;
533
534 if (local) {
535 __this_cpu_write(timer_unstable_counter_workaround, wa);
536 } else {
537 for_each_possible_cpu(i)
538 per_cpu(timer_unstable_counter_workaround, i) = wa;
539 }
540
541 /*
542 * Use the locked version, as we're called from the CPU
543 * hotplug framework. Otherwise, we end-up in deadlock-land.
544 */
545 static_branch_enable_cpuslocked(&arch_timer_read_ool_enabled);
546
547 /*
548 * Don't use the vdso fastpath if errata require using the
549 * out-of-line counter accessor. We may change our mind pretty
550 * late in the game (with a per-CPU erratum, for example), so
551 * change both the default value and the vdso itself.
552 */
553 if (wa->read_cntvct_el0) {
> 554 if (wa->read_cntvct_el0 == hisi_161010101_read_cntvct_el0) {
555 clocksource_counter.archdata.vdso_direct = true;
556 vdso_default = true;
557 vdso_fix = true;
558 } else {
559 clocksource_counter.archdata.vdso_direct = false;
560 vdso_default = false;
561 }
562 }
563 }
564
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
From: Gui-Dong Han <2045gemini(a)gmail.com>
mainline inclusion
from mainline-v6.8-rc3
commit 30926783a46841c2d1bbf3f74067ba85d304fd0d
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IB1MRY
CVE: NA
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?…
--------------------------------
In uart_tiocmget():
result = uport->mctrl;
uart_port_lock_irq(uport);
result |= uport->ops->get_mctrl(uport);
uart_port_unlock_irq(uport);
...
return result;
In uart_update_mctrl():
uart_port_lock_irqsave(port, &flags);
...
port->mctrl = (old & ~clear) | set;
...
port->ops->set_mctrl(port, port->mctrl);
...
uart_port_unlock_irqrestore(port, flags);
An atomicity violation is identified due to the concurrent execution of
uart_tiocmget() and uart_update_mctrl(). After assigning
result = uport->mctrl, the mctrl value may change in uart_update_mctrl(),
leading to a mismatch between the value returned by
uport->ops->get_mctrl(uport) and the mctrl value previously read.
This can result in uart_tiocmget() returning an incorrect value.
This possible bug is found by an experimental static analysis tool
developed by our team, BassCheck[1]. This tool analyzes the locking APIs
to extract function pairs that can be concurrently executed, and then
analyzes the instructions in the paired functions to identify possible
concurrency bugs including data races and atomicity violations. The above
possible bug is reported when our tool analyzes the source code of
Linux 5.17.
To address this issue, it is suggested to move the line
result = uport->mctrl inside the uart_port_lock block to ensure atomicity
and prevent the mctrl value from being altered during the execution of
uart_tiocmget(). With this patch applied, our tool no longer reports the
bug, with the kernel configuration allyesconfig for x86_64. Due to the
absence of the requisite hardware, we are unable to conduct runtime
testing of the patch. Therefore, our verification is solely based on code
logic analysis.
[1] https://sites.google.com/view/basscheck/
Fixes: c5f4644e6c8b ("[PATCH] Serial: Adjust serial locking")
Cc: stable(a)vger.kernel.org
Signed-off-by: Gui-Dong Han <2045gemini(a)gmail.com>
Link: https://lore.kernel.org/r/20240112113624.17048-1-2045gemini@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Conflicts:
drivers/tty/serial/serial_core.c
[Commit 559c7ff4e324("serial: core: Use port lock wrappers") not merged,
no functional change.]
Signed-off-by: Yi Yang <yiyang13(a)huawei.com>
---
drivers/tty/serial/serial_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 537bcd7c4941..d9d7506a9f6e 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -1078,8 +1078,8 @@ static int uart_tiocmget(struct tty_struct *tty)
goto out;
if (!tty_io_error(tty)) {
- result = uport->mctrl;
spin_lock_irq(&uport->lock);
+ result = uport->mctrl;
result |= uport->ops->get_mctrl(uport);
spin_unlock_irq(&uport->lock);
}
--
2.25.1