Skip to content

Commit 32aed71

Browse files
committed
Merge tag 'v6.1.121' into orange-pi-6.1-rk35xx
This is the 6.1.121 stable release * tag 'v6.1.121' of https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux: Linux 6.1.121 x86/static-call: fix 32-bit build ALSA: usb-audio: Fix a DMA to stack memory bug x86/xen: remove hypercall page x86/xen: use new hypercall functions instead of hypercall page x86/xen: add central hypercall functions x86/xen: don't do PV iret hypercall through hypercall page x86/static-call: provide a way to do very early static-call updates objtool/x86: allow syscall instruction x86: make get_cpu_vendor() accessible from Xen code xen/netfront: fix crash when removing device tracing/kprobes: Skip symbol counting logic for module symbols in create_local_trace_kprobe() bpf: sync_linked_regs() must preserve subreg_def blk-iocost: Avoid using clamp() on inuse in __propagate_weights() Bluetooth: SCO: Add support for 16 bits transparent voice setting Bluetooth: iso: Fix recursive locking warning ACPICA: events/evxfregn: don't release the ContextMutex that was never acquired team: Fix feature propagation of NETIF_F_GSO_ENCAP_ALL bonding: Fix feature propagation of NETIF_F_GSO_ENCAP_ALL net/sched: netem: account for backlog updates from child qdisc net: dsa: felix: fix stuck CPU-injected packets with short taprio windows Documentation: PM: Clarify pm_runtime_resume_and_get() return value ASoC: amd: yc: Fix the wrong return value qca_spi: Make driver probing reliable qca_spi: Fix clock speed for multiple QCA7000 cxgb4: use port number to set mac addr ACPI: resource: Fix memory resource type union access net: sparx5: fix the maximum frame length register net: sparx5: fix FDMA performance issue spi: aspeed: Fix an error handling path in aspeed_spi_[read|write]_user() net: mscc: ocelot: perform error cleanup in ocelot_hwstamp_set() net: mscc: ocelot: be resilient to loss of PTP packets during transmission net: mscc: ocelot: ocelot->ts_id_lock and ocelot_port->tx_skbs.lock are IRQ-safe net: mscc: ocelot: improve handling of TX timestamp for unknown skb net: mscc: ocelot: fix memory leak on ocelot_port_add_txtstamp_skb() net: defer final 'struct net' free in netns dismantle net: lapb: increase LAPB_HEADER_LEN ptp: kvm: x86: Return EOPNOTSUPP instead of ENODEV from kvm_arch_ptp_init() ptp: kvm: Use decrypted memory in confidential guest on x86 selftests: mlxsw: sharedbuffer: Ensure no extra packets are counted selftests: mlxsw: sharedbuffer: Remove duplicate test cases selftests: mlxsw: sharedbuffer: Remove h1 ingress test case net/mlx5: DR, prevent potential error pointer dereference tipc: fix NULL deref in cleanup_bearer() batman-adv: Do not let TT changes list grows indefinitely batman-adv: Remove uninitialized data in full table TT response batman-adv: Do not send uninitialized TT changes amdgpu/uvd: get ring reference from rq scheduler acpi: nfit: vmalloc-out-of-bounds Read in acpi_nfit_ctl wifi: mac80211: fix station NSS capability initialization order wifi: mac80211: clean up 'ret' in sta_link_apply_parameters() wifi: nl80211: fix NL80211_ATTR_MLO_LINK_ID off-by-one exfat: fix potential deadlock on __exfat_get_dentry_set exfat: support dynamic allocate bh for exfat_entry_set_cache smb: client: fix UAF in smb2_reconnect_server() bpf, sockmap: Fix update element with same bpf,perf: Fix invalid prog_array access in perf_event_detach_bpf_prog xfs: only run precommits once per transaction object xfs: fix scrub tracepoints when inode-rooted btrees are involved xfs: return from xfs_symlink_verify early on V4 filesystems xfs: don't drop errno values when we fail to ficlone the entire range xfs: update btree keys correctly when _insrec splits an inode root block drm/i915: Fix memory leak by correcting cache object name in error handler usb: dwc3: xilinx: make sure pipe clock is deselected in usb2 only mode usb: gadget: u_serial: Fix the issue that gs_start_io crashed due to accessing null pointer usb: typec: anx7411: fix OF node reference leaks in anx7411_typec_switch_probe() usb: typec: anx7411: fix fwnode_handle reference leak usb: ehci-hcd: fix call balance of clocks handling routines usb: dwc2: Fix HCD port connection race usb: dwc2: hcd: Fix GetPortStatus & SetPortFeature usb: dwc2: Fix HCD resume ata: sata_highbank: fix OF node reference leak in highbank_initialize_phys() usb: host: max3421-hcd: Correctly abort a USB request. ALSA: usb-audio: Add implicit feedback quirk for Yamaha THR5 blk-cgroup: Fix UAF in blkcg_unpin_online() tcp: check space before adding MPTCP SYN options ksmbd: fix racy issue from session lookup and expire bpf: Fix UAF via mismatching bpf_prog/attachment RCU flavors Signed-off-by: Khusika Dhamar Gusti <[email protected]> Conflicts: drivers/usb/dwc2/hcd.c
2 parents 3a7325e + 29f02ec commit 32aed71

Some content is hidden

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

84 files changed

+983
-457
lines changed

Documentation/power/runtime_pm.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,9 @@ drivers/base/power/runtime.c and include/linux/pm_runtime.h:
347347

348348
`int pm_runtime_resume_and_get(struct device *dev);`
349349
- run pm_runtime_resume(dev) and if successful, increment the device's
350-
usage counter; return the result of pm_runtime_resume
350+
usage counter; returns 0 on success (whether or not the device's
351+
runtime PM status was already 'active') or the error code from
352+
pm_runtime_resume() on failure.
351353

352354
`int pm_request_idle(struct device *dev);`
353355
- submit a request to execute the subsystem-level idle callback for the

Makefile

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
VERSION = 6
33
PATCHLEVEL = 1
4-
SUBLEVEL = 120
4+
SUBLEVEL = 121
55
EXTRAVERSION =
66
NAME = Curry Ramen
77

arch/x86/include/asm/processor.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ static inline unsigned long long l1tf_pfn_limit(void)
199199
return BIT_ULL(boot_cpu_data.x86_cache_bits - 1 - PAGE_SHIFT);
200200
}
201201

202+
void init_cpu_devs(void);
203+
void get_cpu_vendor(struct cpuinfo_x86 *c);
202204
extern void early_cpu_init(void);
203205
extern void identify_boot_cpu(void);
204206
extern void identify_secondary_cpu(struct cpuinfo_x86 *);

arch/x86/include/asm/static_call.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,19 @@
6565

6666
extern bool __static_call_fixup(void *tramp, u8 op, void *dest);
6767

68+
extern void __static_call_update_early(void *tramp, void *func);
69+
70+
#define static_call_update_early(name, _func) \
71+
({ \
72+
typeof(&STATIC_CALL_TRAMP(name)) __F = (_func); \
73+
if (static_call_initialized) { \
74+
__static_call_update(&STATIC_CALL_KEY(name), \
75+
STATIC_CALL_TRAMP_ADDR(name), __F);\
76+
} else { \
77+
WRITE_ONCE(STATIC_CALL_KEY(name).func, _func); \
78+
__static_call_update_early(STATIC_CALL_TRAMP_ADDR(name),\
79+
__F); \
80+
} \
81+
})
82+
6883
#endif /* _ASM_STATIC_CALL_H */

arch/x86/include/asm/sync_core.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include <asm/special_insns.h>
99

1010
#ifdef CONFIG_X86_32
11-
static inline void iret_to_self(void)
11+
static __always_inline void iret_to_self(void)
1212
{
1313
asm volatile (
1414
"pushfl\n\t"
@@ -19,7 +19,7 @@ static inline void iret_to_self(void)
1919
: ASM_CALL_CONSTRAINT : : "memory");
2020
}
2121
#else
22-
static inline void iret_to_self(void)
22+
static __always_inline void iret_to_self(void)
2323
{
2424
unsigned int tmp;
2525

@@ -55,7 +55,7 @@ static inline void iret_to_self(void)
5555
* Like all of Linux's memory ordering operations, this is a
5656
* compiler barrier as well.
5757
*/
58-
static inline void sync_core(void)
58+
static __always_inline void sync_core(void)
5959
{
6060
/*
6161
* The SERIALIZE instruction is the most straightforward way to

arch/x86/include/asm/xen/hypercall.h

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@
3939
#include <linux/string.h>
4040
#include <linux/types.h>
4141
#include <linux/pgtable.h>
42+
#include <linux/instrumentation.h>
4243

4344
#include <trace/events/xen.h>
4445

46+
#include <asm/alternative.h>
4547
#include <asm/page.h>
4648
#include <asm/smap.h>
4749
#include <asm/nospec-branch.h>
@@ -86,11 +88,20 @@ struct xen_dm_op_buf;
8688
* there aren't more than 5 arguments...)
8789
*/
8890

89-
extern struct { char _entry[32]; } hypercall_page[];
91+
void xen_hypercall_func(void);
92+
DECLARE_STATIC_CALL(xen_hypercall, xen_hypercall_func);
9093

91-
#define __HYPERCALL "call hypercall_page+%c[offset]"
92-
#define __HYPERCALL_ENTRY(x) \
93-
[offset] "i" (__HYPERVISOR_##x * sizeof(hypercall_page[0]))
94+
#ifdef MODULE
95+
#define __ADDRESSABLE_xen_hypercall
96+
#else
97+
#define __ADDRESSABLE_xen_hypercall __ADDRESSABLE_ASM_STR(__SCK__xen_hypercall)
98+
#endif
99+
100+
#define __HYPERCALL \
101+
__ADDRESSABLE_xen_hypercall \
102+
"call __SCT__xen_hypercall"
103+
104+
#define __HYPERCALL_ENTRY(x) "a" (x)
94105

95106
#ifdef CONFIG_X86_32
96107
#define __HYPERCALL_RETREG "eax"
@@ -148,7 +159,7 @@ extern struct { char _entry[32]; } hypercall_page[];
148159
__HYPERCALL_0ARG(); \
149160
asm volatile (__HYPERCALL \
150161
: __HYPERCALL_0PARAM \
151-
: __HYPERCALL_ENTRY(name) \
162+
: __HYPERCALL_ENTRY(__HYPERVISOR_ ## name) \
152163
: __HYPERCALL_CLOBBER0); \
153164
(type)__res; \
154165
})
@@ -159,7 +170,7 @@ extern struct { char _entry[32]; } hypercall_page[];
159170
__HYPERCALL_1ARG(a1); \
160171
asm volatile (__HYPERCALL \
161172
: __HYPERCALL_1PARAM \
162-
: __HYPERCALL_ENTRY(name) \
173+
: __HYPERCALL_ENTRY(__HYPERVISOR_ ## name) \
163174
: __HYPERCALL_CLOBBER1); \
164175
(type)__res; \
165176
})
@@ -170,7 +181,7 @@ extern struct { char _entry[32]; } hypercall_page[];
170181
__HYPERCALL_2ARG(a1, a2); \
171182
asm volatile (__HYPERCALL \
172183
: __HYPERCALL_2PARAM \
173-
: __HYPERCALL_ENTRY(name) \
184+
: __HYPERCALL_ENTRY(__HYPERVISOR_ ## name) \
174185
: __HYPERCALL_CLOBBER2); \
175186
(type)__res; \
176187
})
@@ -181,7 +192,7 @@ extern struct { char _entry[32]; } hypercall_page[];
181192
__HYPERCALL_3ARG(a1, a2, a3); \
182193
asm volatile (__HYPERCALL \
183194
: __HYPERCALL_3PARAM \
184-
: __HYPERCALL_ENTRY(name) \
195+
: __HYPERCALL_ENTRY(__HYPERVISOR_ ## name) \
185196
: __HYPERCALL_CLOBBER3); \
186197
(type)__res; \
187198
})
@@ -192,7 +203,7 @@ extern struct { char _entry[32]; } hypercall_page[];
192203
__HYPERCALL_4ARG(a1, a2, a3, a4); \
193204
asm volatile (__HYPERCALL \
194205
: __HYPERCALL_4PARAM \
195-
: __HYPERCALL_ENTRY(name) \
206+
: __HYPERCALL_ENTRY(__HYPERVISOR_ ## name) \
196207
: __HYPERCALL_CLOBBER4); \
197208
(type)__res; \
198209
})
@@ -206,12 +217,9 @@ xen_single_call(unsigned int call,
206217
__HYPERCALL_DECLS;
207218
__HYPERCALL_5ARG(a1, a2, a3, a4, a5);
208219

209-
if (call >= PAGE_SIZE / sizeof(hypercall_page[0]))
210-
return -EINVAL;
211-
212-
asm volatile(CALL_NOSPEC
220+
asm volatile(__HYPERCALL
213221
: __HYPERCALL_5PARAM
214-
: [thunk_target] "a" (&hypercall_page[call])
222+
: __HYPERCALL_ENTRY(call)
215223
: __HYPERCALL_CLOBBER5);
216224

217225
return (long)__res;

arch/x86/kernel/cpu/common.c

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ void detect_ht(struct cpuinfo_x86 *c)
906906
#endif
907907
}
908908

909-
static void get_cpu_vendor(struct cpuinfo_x86 *c)
909+
void get_cpu_vendor(struct cpuinfo_x86 *c)
910910
{
911911
char *v = c->x86_vendor_id;
912912
int i;
@@ -1672,36 +1672,42 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)
16721672
detect_nopl();
16731673
}
16741674

1675-
void __init early_cpu_init(void)
1675+
void __init init_cpu_devs(void)
16761676
{
16771677
const struct cpu_dev *const *cdev;
16781678
int count = 0;
16791679

1680-
#ifdef CONFIG_PROCESSOR_SELECT
1681-
pr_info("KERNEL supported cpus:\n");
1682-
#endif
1683-
16841680
for (cdev = __x86_cpu_dev_start; cdev < __x86_cpu_dev_end; cdev++) {
16851681
const struct cpu_dev *cpudev = *cdev;
16861682

16871683
if (count >= X86_VENDOR_NUM)
16881684
break;
16891685
cpu_devs[count] = cpudev;
16901686
count++;
1687+
}
1688+
}
16911689

1690+
void __init early_cpu_init(void)
1691+
{
16921692
#ifdef CONFIG_PROCESSOR_SELECT
1693-
{
1694-
unsigned int j;
1695-
1696-
for (j = 0; j < 2; j++) {
1697-
if (!cpudev->c_ident[j])
1698-
continue;
1699-
pr_info(" %s %s\n", cpudev->c_vendor,
1700-
cpudev->c_ident[j]);
1701-
}
1702-
}
1693+
unsigned int i, j;
1694+
1695+
pr_info("KERNEL supported cpus:\n");
17031696
#endif
1697+
1698+
init_cpu_devs();
1699+
1700+
#ifdef CONFIG_PROCESSOR_SELECT
1701+
for (i = 0; i < X86_VENDOR_NUM && cpu_devs[i]; i++) {
1702+
for (j = 0; j < 2; j++) {
1703+
if (!cpu_devs[i]->c_ident[j])
1704+
continue;
1705+
pr_info(" %s %s\n", cpu_devs[i]->c_vendor,
1706+
cpu_devs[i]->c_ident[j]);
1707+
}
17041708
}
1709+
#endif
1710+
17051711
early_identify_cpu(&boot_cpu_data);
17061712
}
17071713

arch/x86/kernel/static_call.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,15 @@ void arch_static_call_transform(void *site, void *tramp, void *func, bool tail)
170170
}
171171
EXPORT_SYMBOL_GPL(arch_static_call_transform);
172172

173+
noinstr void __static_call_update_early(void *tramp, void *func)
174+
{
175+
BUG_ON(system_state != SYSTEM_BOOTING);
176+
BUG_ON(!early_boot_irqs_disabled);
177+
BUG_ON(static_call_initialized);
178+
__text_gen_insn(tramp, JMP32_INSN_OPCODE, tramp, func, JMP32_INSN_SIZE);
179+
sync_core();
180+
}
181+
173182
#ifdef CONFIG_RETHUNK
174183
/*
175184
* This is called by apply_returns() to fix up static call trampolines,

arch/x86/xen/enlighten.c

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#endif
66
#include <linux/console.h>
77
#include <linux/cpu.h>
8+
#include <linux/instrumentation.h>
89
#include <linux/kexec.h>
910
#include <linux/slab.h>
1011
#include <linux/panic_notifier.h>
@@ -25,7 +26,8 @@
2526
#include "smp.h"
2627
#include "pmu.h"
2728

28-
EXPORT_SYMBOL_GPL(hypercall_page);
29+
DEFINE_STATIC_CALL(xen_hypercall, xen_hypercall_hvm);
30+
EXPORT_STATIC_CALL_TRAMP(xen_hypercall);
2931

3032
/*
3133
* Pointer to the xen_vcpu_info structure or
@@ -72,6 +74,67 @@ EXPORT_SYMBOL(xen_start_flags);
7274
*/
7375
struct shared_info *HYPERVISOR_shared_info = &xen_dummy_shared_info;
7476

77+
static __ref void xen_get_vendor(void)
78+
{
79+
init_cpu_devs();
80+
cpu_detect(&boot_cpu_data);
81+
get_cpu_vendor(&boot_cpu_data);
82+
}
83+
84+
void xen_hypercall_setfunc(void)
85+
{
86+
if (static_call_query(xen_hypercall) != xen_hypercall_hvm)
87+
return;
88+
89+
if ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD ||
90+
boot_cpu_data.x86_vendor == X86_VENDOR_HYGON))
91+
static_call_update(xen_hypercall, xen_hypercall_amd);
92+
else
93+
static_call_update(xen_hypercall, xen_hypercall_intel);
94+
}
95+
96+
/*
97+
* Evaluate processor vendor in order to select the correct hypercall
98+
* function for HVM/PVH guests.
99+
* Might be called very early in boot before vendor has been set by
100+
* early_cpu_init().
101+
*/
102+
noinstr void *__xen_hypercall_setfunc(void)
103+
{
104+
void (*func)(void);
105+
106+
/*
107+
* Xen is supported only on CPUs with CPUID, so testing for
108+
* X86_FEATURE_CPUID is a test for early_cpu_init() having been
109+
* run.
110+
*
111+
* Note that __xen_hypercall_setfunc() is noinstr only due to a nasty
112+
* dependency chain: it is being called via the xen_hypercall static
113+
* call when running as a PVH or HVM guest. Hypercalls need to be
114+
* noinstr due to PV guests using hypercalls in noinstr code. So we
115+
* can safely tag the function body as "instrumentation ok", since
116+
* the PV guest requirement is not of interest here (xen_get_vendor()
117+
* calls noinstr functions, and static_call_update_early() might do
118+
* so, too).
119+
*/
120+
instrumentation_begin();
121+
122+
if (!boot_cpu_has(X86_FEATURE_CPUID))
123+
xen_get_vendor();
124+
125+
if ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD ||
126+
boot_cpu_data.x86_vendor == X86_VENDOR_HYGON))
127+
func = xen_hypercall_amd;
128+
else
129+
func = xen_hypercall_intel;
130+
131+
static_call_update_early(xen_hypercall, func);
132+
133+
instrumentation_end();
134+
135+
return func;
136+
}
137+
75138
static int xen_cpu_up_online(unsigned int cpu)
76139
{
77140
xen_init_lock_cpu(cpu);

arch/x86/xen/enlighten_hvm.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,8 @@ static void __init init_hvm_pv_info(void)
108108
/* PVH set up hypercall page in xen_prepare_pvh(). */
109109
if (xen_pvh_domain())
110110
pv_info.name = "Xen PVH";
111-
else {
112-
u64 pfn;
113-
uint32_t msr;
114-
111+
else
115112
pv_info.name = "Xen HVM";
116-
msr = cpuid_ebx(base + 2);
117-
pfn = __pa(hypercall_page);
118-
wrmsr_safe(msr, (u32)pfn, (u32)(pfn >> 32));
119-
}
120113

121114
xen_setup_features();
122115

@@ -299,6 +292,10 @@ static uint32_t __init xen_platform_hvm(void)
299292
if (xen_pv_domain())
300293
return 0;
301294

295+
/* Set correct hypercall function. */
296+
if (xen_domain)
297+
xen_hypercall_setfunc();
298+
302299
if (xen_pvh_domain() && nopv) {
303300
/* Guest booting via the Xen-PVH boot entry goes here */
304301
pr_info("\"nopv\" parameter is ignored in PVH guest\n");

0 commit comments

Comments
 (0)