Skip to content

Commit f0da4e5

Browse files
committed
Merge remote-tracking branch 'stable/linux-5.15.y' into rpi-5.15.y
2 parents a004834 + ee03900 commit f0da4e5

File tree

116 files changed

+700
-392
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+700
-392
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SPDX-License-Identifier: GPL-2.0
22
VERSION = 5
33
PATCHLEVEL = 15
4-
SUBLEVEL = 48
4+
SUBLEVEL = 49
55
EXTRAVERSION =
66
NAME = Trick or Treat
77

@@ -811,6 +811,9 @@ endif
811811
KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
812812
KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable)
813813

814+
# These result in bogus false positives
815+
KBUILD_CFLAGS += $(call cc-disable-warning, dangling-pointer)
816+
814817
ifdef CONFIG_FRAME_POINTER
815818
KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
816819
else

arch/arm64/boot/dts/freescale/imx8mm-beacon-baseboard.dtsi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@
166166
pinctrl-0 = <&pinctrl_uart3>;
167167
assigned-clocks = <&clk IMX8MM_CLK_UART3>;
168168
assigned-clock-parents = <&clk IMX8MM_SYS_PLL1_80M>;
169+
uart-has-rtscts;
169170
status = "okay";
170171
};
171172

@@ -236,6 +237,8 @@
236237
fsl,pins = <
237238
MX8MM_IOMUXC_ECSPI1_SCLK_UART3_DCE_RX 0x40
238239
MX8MM_IOMUXC_ECSPI1_MOSI_UART3_DCE_TX 0x40
240+
MX8MM_IOMUXC_ECSPI1_MISO_UART3_DCE_CTS_B 0x40
241+
MX8MM_IOMUXC_ECSPI1_SS0_UART3_DCE_RTS_B 0x40
239242
>;
240243
};
241244

arch/arm64/boot/dts/freescale/imx8mn-beacon-baseboard.dtsi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@
176176
pinctrl-0 = <&pinctrl_uart3>;
177177
assigned-clocks = <&clk IMX8MN_CLK_UART3>;
178178
assigned-clock-parents = <&clk IMX8MN_SYS_PLL1_80M>;
179+
uart-has-rtscts;
179180
status = "okay";
180181
};
181182

@@ -259,6 +260,8 @@
259260
fsl,pins = <
260261
MX8MN_IOMUXC_ECSPI1_SCLK_UART3_DCE_RX 0x40
261262
MX8MN_IOMUXC_ECSPI1_MOSI_UART3_DCE_TX 0x40
263+
MX8MN_IOMUXC_ECSPI1_MISO_UART3_DCE_CTS_B 0x40
264+
MX8MN_IOMUXC_ECSPI1_SS0_UART3_DCE_RTS_B 0x40
262265
>;
263266
};
264267

arch/arm64/kernel/ftrace.c

Lines changed: 66 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -78,47 +78,76 @@ static struct plt_entry *get_ftrace_plt(struct module *mod, unsigned long addr)
7878
}
7979

8080
/*
81-
* Turn on the call to ftrace_caller() in instrumented function
81+
* Find the address the callsite must branch to in order to reach '*addr'.
82+
*
83+
* Due to the limited range of 'BL' instructions, modules may be placed too far
84+
* away to branch directly and must use a PLT.
85+
*
86+
* Returns true when '*addr' contains a reachable target address, or has been
87+
* modified to contain a PLT address. Returns false otherwise.
8288
*/
83-
int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
89+
static bool ftrace_find_callable_addr(struct dyn_ftrace *rec,
90+
struct module *mod,
91+
unsigned long *addr)
8492
{
8593
unsigned long pc = rec->ip;
86-
u32 old, new;
87-
long offset = (long)pc - (long)addr;
94+
long offset = (long)*addr - (long)pc;
95+
struct plt_entry *plt;
8896

89-
if (offset < -SZ_128M || offset >= SZ_128M) {
90-
struct module *mod;
91-
struct plt_entry *plt;
97+
/*
98+
* When the target is within range of the 'BL' instruction, use 'addr'
99+
* as-is and branch to that directly.
100+
*/
101+
if (offset >= -SZ_128M && offset < SZ_128M)
102+
return true;
92103

93-
if (!IS_ENABLED(CONFIG_ARM64_MODULE_PLTS))
94-
return -EINVAL;
104+
/*
105+
* When the target is outside of the range of a 'BL' instruction, we
106+
* must use a PLT to reach it. We can only place PLTs for modules, and
107+
* only when module PLT support is built-in.
108+
*/
109+
if (!IS_ENABLED(CONFIG_ARM64_MODULE_PLTS))
110+
return false;
95111

96-
/*
97-
* On kernels that support module PLTs, the offset between the
98-
* branch instruction and its target may legally exceed the
99-
* range of an ordinary relative 'bl' opcode. In this case, we
100-
* need to branch via a trampoline in the module.
101-
*
102-
* NOTE: __module_text_address() must be called with preemption
103-
* disabled, but we can rely on ftrace_lock to ensure that 'mod'
104-
* retains its validity throughout the remainder of this code.
105-
*/
112+
/*
113+
* 'mod' is only set at module load time, but if we end up
114+
* dealing with an out-of-range condition, we can assume it
115+
* is due to a module being loaded far away from the kernel.
116+
*
117+
* NOTE: __module_text_address() must be called with preemption
118+
* disabled, but we can rely on ftrace_lock to ensure that 'mod'
119+
* retains its validity throughout the remainder of this code.
120+
*/
121+
if (!mod) {
106122
preempt_disable();
107123
mod = __module_text_address(pc);
108124
preempt_enable();
125+
}
109126

110-
if (WARN_ON(!mod))
111-
return -EINVAL;
127+
if (WARN_ON(!mod))
128+
return false;
112129

113-
plt = get_ftrace_plt(mod, addr);
114-
if (!plt) {
115-
pr_err("ftrace: no module PLT for %ps\n", (void *)addr);
116-
return -EINVAL;
117-
}
118-
119-
addr = (unsigned long)plt;
130+
plt = get_ftrace_plt(mod, *addr);
131+
if (!plt) {
132+
pr_err("ftrace: no module PLT for %ps\n", (void *)*addr);
133+
return false;
120134
}
121135

136+
*addr = (unsigned long)plt;
137+
return true;
138+
}
139+
140+
/*
141+
* Turn on the call to ftrace_caller() in instrumented function
142+
*/
143+
int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
144+
{
145+
unsigned long pc = rec->ip;
146+
u32 old, new;
147+
148+
if (!ftrace_find_callable_addr(rec, NULL, &addr))
149+
return -EINVAL;
150+
122151
old = aarch64_insn_gen_nop();
123152
new = aarch64_insn_gen_branch_imm(pc, addr, AARCH64_INSN_BRANCH_LINK);
124153

@@ -132,6 +161,11 @@ int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr,
132161
unsigned long pc = rec->ip;
133162
u32 old, new;
134163

164+
if (!ftrace_find_callable_addr(rec, NULL, &old_addr))
165+
return -EINVAL;
166+
if (!ftrace_find_callable_addr(rec, NULL, &addr))
167+
return -EINVAL;
168+
135169
old = aarch64_insn_gen_branch_imm(pc, old_addr,
136170
AARCH64_INSN_BRANCH_LINK);
137171
new = aarch64_insn_gen_branch_imm(pc, addr, AARCH64_INSN_BRANCH_LINK);
@@ -181,54 +215,15 @@ int ftrace_make_nop(struct module *mod, struct dyn_ftrace *rec,
181215
unsigned long addr)
182216
{
183217
unsigned long pc = rec->ip;
184-
bool validate = true;
185218
u32 old = 0, new;
186-
long offset = (long)pc - (long)addr;
187219

188-
if (offset < -SZ_128M || offset >= SZ_128M) {
189-
u32 replaced;
190-
191-
if (!IS_ENABLED(CONFIG_ARM64_MODULE_PLTS))
192-
return -EINVAL;
193-
194-
/*
195-
* 'mod' is only set at module load time, but if we end up
196-
* dealing with an out-of-range condition, we can assume it
197-
* is due to a module being loaded far away from the kernel.
198-
*/
199-
if (!mod) {
200-
preempt_disable();
201-
mod = __module_text_address(pc);
202-
preempt_enable();
203-
204-
if (WARN_ON(!mod))
205-
return -EINVAL;
206-
}
207-
208-
/*
209-
* The instruction we are about to patch may be a branch and
210-
* link instruction that was redirected via a PLT entry. In
211-
* this case, the normal validation will fail, but we can at
212-
* least check that we are dealing with a branch and link
213-
* instruction that points into the right module.
214-
*/
215-
if (aarch64_insn_read((void *)pc, &replaced))
216-
return -EFAULT;
217-
218-
if (!aarch64_insn_is_bl(replaced) ||
219-
!within_module(pc + aarch64_get_branch_offset(replaced),
220-
mod))
221-
return -EINVAL;
222-
223-
validate = false;
224-
} else {
225-
old = aarch64_insn_gen_branch_imm(pc, addr,
226-
AARCH64_INSN_BRANCH_LINK);
227-
}
220+
if (!ftrace_find_callable_addr(rec, mod, &addr))
221+
return -EINVAL;
228222

223+
old = aarch64_insn_gen_branch_imm(pc, addr, AARCH64_INSN_BRANCH_LINK);
229224
new = aarch64_insn_gen_nop();
230225

231-
return ftrace_modify_code(pc, old, new, validate);
226+
return ftrace_modify_code(pc, old, new, true);
232227
}
233228

234229
void arch_ftrace_update_code(int command)

arch/arm64/kvm/vgic/vgic-mmio-v2.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,11 +418,11 @@ static const struct vgic_register_region vgic_v2_dist_registers[] = {
418418
VGIC_ACCESS_32bit),
419419
REGISTER_DESC_WITH_BITS_PER_IRQ(GIC_DIST_PENDING_SET,
420420
vgic_mmio_read_pending, vgic_mmio_write_spending,
421-
NULL, vgic_uaccess_write_spending, 1,
421+
vgic_uaccess_read_pending, vgic_uaccess_write_spending, 1,
422422
VGIC_ACCESS_32bit),
423423
REGISTER_DESC_WITH_BITS_PER_IRQ(GIC_DIST_PENDING_CLEAR,
424424
vgic_mmio_read_pending, vgic_mmio_write_cpending,
425-
NULL, vgic_uaccess_write_cpending, 1,
425+
vgic_uaccess_read_pending, vgic_uaccess_write_cpending, 1,
426426
VGIC_ACCESS_32bit),
427427
REGISTER_DESC_WITH_BITS_PER_IRQ(GIC_DIST_ACTIVE_SET,
428428
vgic_mmio_read_active, vgic_mmio_write_sactive,

arch/arm64/kvm/vgic/vgic-mmio.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,9 @@ int vgic_uaccess_write_cenable(struct kvm_vcpu *vcpu,
226226
return 0;
227227
}
228228

229-
unsigned long vgic_mmio_read_pending(struct kvm_vcpu *vcpu,
230-
gpa_t addr, unsigned int len)
229+
static unsigned long __read_pending(struct kvm_vcpu *vcpu,
230+
gpa_t addr, unsigned int len,
231+
bool is_user)
231232
{
232233
u32 intid = VGIC_ADDR_TO_INTID(addr, 1);
233234
u32 value = 0;
@@ -248,7 +249,7 @@ unsigned long vgic_mmio_read_pending(struct kvm_vcpu *vcpu,
248249
IRQCHIP_STATE_PENDING,
249250
&val);
250251
WARN_RATELIMIT(err, "IRQ %d", irq->host_irq);
251-
} else if (vgic_irq_is_mapped_level(irq)) {
252+
} else if (!is_user && vgic_irq_is_mapped_level(irq)) {
252253
val = vgic_get_phys_line_level(irq);
253254
} else {
254255
val = irq_is_pending(irq);
@@ -263,6 +264,18 @@ unsigned long vgic_mmio_read_pending(struct kvm_vcpu *vcpu,
263264
return value;
264265
}
265266

267+
unsigned long vgic_mmio_read_pending(struct kvm_vcpu *vcpu,
268+
gpa_t addr, unsigned int len)
269+
{
270+
return __read_pending(vcpu, addr, len, false);
271+
}
272+
273+
unsigned long vgic_uaccess_read_pending(struct kvm_vcpu *vcpu,
274+
gpa_t addr, unsigned int len)
275+
{
276+
return __read_pending(vcpu, addr, len, true);
277+
}
278+
266279
static bool is_vgic_v2_sgi(struct kvm_vcpu *vcpu, struct vgic_irq *irq)
267280
{
268281
return (vgic_irq_is_sgi(irq->intid) &&

arch/arm64/kvm/vgic/vgic-mmio.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ int vgic_uaccess_write_cenable(struct kvm_vcpu *vcpu,
149149
unsigned long vgic_mmio_read_pending(struct kvm_vcpu *vcpu,
150150
gpa_t addr, unsigned int len);
151151

152+
unsigned long vgic_uaccess_read_pending(struct kvm_vcpu *vcpu,
153+
gpa_t addr, unsigned int len);
154+
152155
void vgic_mmio_write_spending(struct kvm_vcpu *vcpu,
153156
gpa_t addr, unsigned int len,
154157
unsigned long val);

arch/powerpc/kernel/process.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2124,12 +2124,12 @@ static unsigned long __get_wchan(struct task_struct *p)
21242124
return 0;
21252125

21262126
do {
2127-
sp = *(unsigned long *)sp;
2127+
sp = READ_ONCE_NOCHECK(*(unsigned long *)sp);
21282128
if (!validate_sp(sp, p, STACK_FRAME_OVERHEAD) ||
21292129
task_is_running(p))
21302130
return 0;
21312131
if (count > 0) {
2132-
ip = ((unsigned long *)sp)[STACK_FRAME_LR_SAVE];
2132+
ip = READ_ONCE_NOCHECK(((unsigned long *)sp)[STACK_FRAME_LR_SAVE]);
21332133
if (!in_sched_functions(ip))
21342134
return ip;
21352135
}

arch/powerpc/mm/nohash/kaslr_booke.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include <asm/prom.h>
1919
#include <asm/kdump.h>
2020
#include <mm/mmu_decl.h>
21-
#include <generated/compile.h>
2221
#include <generated/utsrelease.h>
2322

2423
struct regions {
@@ -36,10 +35,6 @@ struct regions {
3635
int reserved_mem_size_cells;
3736
};
3837

39-
/* Simplified build-specific string for starting entropy. */
40-
static const char build_str[] = UTS_RELEASE " (" LINUX_COMPILE_BY "@"
41-
LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION;
42-
4338
struct regions __initdata regions;
4439

4540
static __init void kaslr_get_cmdline(void *fdt)
@@ -72,7 +67,8 @@ static unsigned long __init get_boot_seed(void *fdt)
7267
{
7368
unsigned long hash = 0;
7469

75-
hash = rotate_xor(hash, build_str, sizeof(build_str));
70+
/* build-specific string for starting entropy. */
71+
hash = rotate_xor(hash, linux_banner, strlen(linux_banner));
7672
hash = rotate_xor(hash, fdt, fdt_totalsize(fdt));
7773

7874
return hash;

block/blk-mq.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,8 @@ struct request *blk_mq_alloc_request_hctx(struct request_queue *q,
476476
if (!blk_mq_hw_queue_mapped(data.hctx))
477477
goto out_queue_exit;
478478
cpu = cpumask_first_and(data.hctx->cpumask, cpu_online_mask);
479+
if (cpu >= nr_cpu_ids)
480+
goto out_queue_exit;
479481
data.ctx = __blk_mq_get_ctx(q, cpu);
480482

481483
if (!q->elevator)

certs/blacklist_hashes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: GPL-2.0
22
#include "blacklist.h"
33

4-
const char __initdata *const blacklist_hashes[] = {
4+
const char __initconst *const blacklist_hashes[] = {
55
#include CONFIG_SYSTEM_BLACKLIST_HASH_LIST
66
, NULL
77
};

crypto/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ source "crypto/async_tx/Kconfig"
1515
#
1616
menuconfig CRYPTO
1717
tristate "Cryptographic API"
18+
select LIB_MEMNEQ
1819
help
1920
This option provides the core Cryptographic API.
2021

crypto/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55

66
obj-$(CONFIG_CRYPTO) += crypto.o
7-
crypto-y := api.o cipher.o compress.o memneq.o
7+
crypto-y := api.o cipher.o compress.o
88

99
obj-$(CONFIG_CRYPTO_ENGINE) += crypto_engine.o
1010
obj-$(CONFIG_CRYPTO_FIPS) += fips.o

drivers/ata/libata-core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5500,15 +5500,15 @@ struct ata_host *ata_host_alloc_pinfo(struct device *dev,
55005500
const struct ata_port_info * const * ppi,
55015501
int n_ports)
55025502
{
5503-
const struct ata_port_info *pi;
5503+
const struct ata_port_info *pi = &ata_dummy_port_info;
55045504
struct ata_host *host;
55055505
int i, j;
55065506

55075507
host = ata_host_alloc(dev, n_ports);
55085508
if (!host)
55095509
return NULL;
55105510

5511-
for (i = 0, j = 0, pi = NULL; i < host->n_ports; i++) {
5511+
for (i = 0, j = 0; i < host->n_ports; i++) {
55125512
struct ata_port *ap = host->ports[i];
55135513

55145514
if (ppi[j])

0 commit comments

Comments
 (0)