From: Guo Ren <guoren(a)linux.alibaba.com>
These patch_text implementations are using stop_machine_cpuslocked
infrastructure with atomic cpu_count. The original idea: When the
master CPU patch_text, the others should wait for it. But current
implementation is using the first CPU as master, which couldn't
guarantee the remaining CPUs are waiting. This patch changes the
last CPU as the master to solve the potential risk.
Signed-off-by: Guo Ren <guoren(a)linux.alibaba.com>
Signed-off-by: Guo Ren <guoren(a)kernel.org>
Reviewed-by: Masami Hiramatsu <mhiramat(a)kernel.org>
Cc: <stable(a)vger.kernel.org>
---
arch/csky/kernel/probes/kprobes.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/csky/kernel/probes/kprobes.c b/arch/csky/kernel/probes/kprobes.c
index 42920f25e73c..34ba684d5962 100644
--- a/arch/csky/kernel/probes/kprobes.c
+++ b/arch/csky/kernel/probes/kprobes.c
@@ -30,7 +30,7 @@ static int __kprobes patch_text_cb(void *priv)
struct csky_insn_patch *param = priv;
unsigned int addr = (unsigned int)param->addr;
- if (atomic_inc_return(¶m->cpu_count) == 1) {
+ if (atomic_inc_return(¶m->cpu_count) == num_online_cpus()) {
*(u16 *) addr = cpu_to_le16(param->opcode);
dcache_wb_range(addr, addr + 2);
atomic_inc(¶m->cpu_count);
--
2.25.1
From: Guo Ren <guoren(a)linux.alibaba.com>
These patch_text implementations are using stop_machine_cpuslocked
infrastructure with atomic cpu_count. The original idea: When the
master CPU patch_text, the others should wait for it. But current
implementation is using the first CPU as master, which couldn't
guarantee the remaining CPUs are waiting. This patch changes the
last CPU as the master to solve the potential risk.
Signed-off-by: Guo Ren <guoren(a)linux.alibaba.com>
Signed-off-by: Guo Ren <guoren(a)kernel.org>
Reviewed-by: Catalin Marinas <catalin.marinas(a)arm.com>
Reviewed-by: Max Filippov <jcmvbkbc(a)gmail.com>
Reviewed-by: Masami Hiramatsu <mhiramat(a)kernel.org>
Cc: <stable(a)vger.kernel.org>
---
arch/arm64/kernel/patching.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/kernel/patching.c b/arch/arm64/kernel/patching.c
index 771f543464e0..33e0fabc0b79 100644
--- a/arch/arm64/kernel/patching.c
+++ b/arch/arm64/kernel/patching.c
@@ -117,8 +117,8 @@ static int __kprobes aarch64_insn_patch_text_cb(void *arg)
int i, ret = 0;
struct aarch64_insn_patch *pp = arg;
- /* The first CPU becomes master */
- if (atomic_inc_return(&pp->cpu_count) == 1) {
+ /* The last CPU becomes master */
+ if (atomic_inc_return(&pp->cpu_count) == num_online_cpus()) {
for (i = 0; ret == 0 && i < pp->insn_cnt; i++)
ret = aarch64_insn_patch_text_nosync(pp->text_addrs[i],
pp->new_insns[i]);
--
2.25.1
Our search indicates that you may be a potential business partner
and we have an Investment proposals that will be of good interest
to you. We are investors with a very good financial access
seeking means of expanding business across the globe. Should you
be interested or If You have any viable business idea in your
region/country, please get back to me at your earliest
convenience for further details.
Thanks
Mike Kouri
Linux stable-rc 4.19 branch build breaks on all architecture for
allnoconfig and tinyconfig.
arch/x86/entry/entry_64.S: Assembler messages:
arch/x86/entry/entry_64.S:1738: Warning: no instruction mnemonic
suffix given and no register operands; using default for `sysret'
In file included from include/linux/blk-cgroup.h:24,
from include/linux/backing-dev.h:18,
from include/linux/nfs_fs_sb.h:6,
from include/linux/nfs_fs.h:39,
from init/do_mounts.c:22:
include/linux/blk-mq.h:145:9: error: unknown type name 'softirq_done_fn'
145 | softirq_done_fn *complete;
| ^~~~~~~~~~~~~~~
In file included from arch/x86/include/asm/atomic.h:265,
from include/linux/atomic.h:7,
from include/linux/jump_label.h:185,
from arch/x86/include/asm/string_64.h:6,
from arch/x86/include/asm/string.h:5,
from include/linux/string.h:20,
from include/linux/bitmap.h:9,
from include/linux/cpumask.h:12,
from arch/x86/include/asm/cpumask.h:5,
from arch/x86/include/asm/msr.h:11,
from arch/x86/include/asm/processor.h:21,
from arch/x86/include/asm/cpufeature.h:5,
from arch/x86/include/asm/thread_info.h:53,
from include/linux/thread_info.h:39,
from arch/x86/include/asm/preempt.h:7,
from include/linux/preempt.h:81,
from include/linux/spinlock.h:51,
from include/linux/seqlock.h:36,
from include/linux/time.h:6,
from include/linux/stat.h:19,
from include/linux/module.h:10,
from init/do_mounts.c:1:
include/linux/blk-mq.h: In function 'blk_mq_mark_complete':
include/linux/blk-mq.h:309:27: error: invalid use of undefined type
'struct request'
309 | return cmpxchg(&rq->state, MQ_RQ_IN_FLIGHT, MQ_RQ_COMPLETE) ==
| ^~
include/asm-generic/atomic-instrumented.h:420:16: note: in definition
of macro 'cmpxchg'
420 | typeof(ptr) __ai_ptr = (ptr);
\
| ^~~
include/linux/blk-mq.h:309:27: error: invalid use of undefined type
'struct request'
309 | return cmpxchg(&rq->state, MQ_RQ_IN_FLIGHT, MQ_RQ_COMPLETE) ==
| ^~
include/asm-generic/atomic-instrumented.h:420:33: note: in definition
of macro 'cmpxchg'
420 | typeof(ptr) __ai_ptr = (ptr);
\
| ^~~
include/asm-generic/atomic-instrumented.h:421:44: error: invalid type
argument of unary '*' (have 'int')
421 | kasan_check_write(__ai_ptr, sizeof(*__ai_ptr));
\
| ^~~~~~~~~
include/linux/blk-mq.h:309:16: note: in expansion of macro 'cmpxchg'
309 | return cmpxchg(&rq->state, MQ_RQ_IN_FLIGHT, MQ_RQ_COMPLETE) ==
| ^~~~~~~
include/asm-generic/atomic-instrumented.h:421:27: warning: passing
argument 1 of 'kasan_check_write' makes pointer from integer without a
cast [-Wint-conversion]
421 | kasan_check_write(__ai_ptr, sizeof(*__ai_ptr));
\
| ^~~~~~~~
| |
| int
include/linux/blk-mq.h:309:16: note: in expansion of macro 'cmpxchg'
309 | return cmpxchg(&rq->state, MQ_RQ_IN_FLIGHT, MQ_RQ_COMPLETE) ==
| ^~~~~~~
Reported-by: Linux Kernel Functional Testing <lkft(a)linaro.org>
--
Linaro LKFT
https://lkft.linaro.org