From a46a1ad097419aeea7350987dd95230f50d90392 Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Fri, 15 Nov 2024 08:53:41 +0000
Subject: [PATCH] 固定GMAC1 网卡名为 eth3
---
kernel/arch/x86/kernel/process_64.c | 32 +++++++++++++++++++++-----------
1 files changed, 21 insertions(+), 11 deletions(-)
diff --git a/kernel/arch/x86/kernel/process_64.c b/kernel/arch/x86/kernel/process_64.c
index ad3f82a..65d6171 100644
--- a/kernel/arch/x86/kernel/process_64.c
+++ b/kernel/arch/x86/kernel/process_64.c
@@ -272,9 +272,9 @@
unsigned long flags;
/* Interrupts need to be off for FSGSBASE */
- local_irq_save(flags);
+ local_irq_save_full(flags);
save_fsgs(current);
- local_irq_restore(flags);
+ local_irq_restore_full(flags);
}
#if IS_ENABLED(CONFIG_KVM)
EXPORT_SYMBOL_GPL(current_save_fsgs);
@@ -410,9 +410,9 @@
if (boot_cpu_has(X86_FEATURE_FSGSBASE)) {
unsigned long flags;
- local_irq_save(flags);
+ local_irq_save_full(flags);
gsbase = __rdgsbase_inactive();
- local_irq_restore(flags);
+ local_irq_restore_full(flags);
} else {
rdmsrl(MSR_KERNEL_GS_BASE, gsbase);
}
@@ -425,9 +425,9 @@
if (boot_cpu_has(X86_FEATURE_FSGSBASE)) {
unsigned long flags;
- local_irq_save(flags);
+ local_irq_save_full(flags);
__wrgsbase_inactive(gsbase);
- local_irq_restore(flags);
+ local_irq_restore_full(flags);
} else {
wrmsrl(MSR_KERNEL_GS_BASE, gsbase);
}
@@ -537,8 +537,17 @@
struct thread_struct *next = &next_p->thread;
int cpu = smp_processor_id();
+ /*
+ * Dovetail: Switching context on the out-of-band stage is
+ * legit, and we may have preempted an in-band (soft)irq
+ * handler earlier. Since oob handlers never switch stack,
+ * make sure to restrict the following test to in-band
+ * callers.
+ */
WARN_ON_ONCE(IS_ENABLED(CONFIG_DEBUG_ENTRY) &&
- this_cpu_read(irq_count) != -1);
+ running_inband() && this_cpu_read(irq_count) != -1);
+
+ WARN_ON_ONCE(dovetail_debug() && !hard_irqs_disabled());
if (!test_thread_flag(TIF_NEED_FPU_LOAD))
switch_fpu_prepare(prev_p, cpu);
@@ -719,6 +728,7 @@
long do_arch_prctl_64(struct task_struct *task, int option, unsigned long arg2)
{
+ unsigned long flags;
int ret = 0;
switch (option) {
@@ -726,7 +736,7 @@
if (unlikely(arg2 >= TASK_SIZE_MAX))
return -EPERM;
- preempt_disable();
+ flags = hard_preempt_disable();
/*
* ARCH_SET_GS has always overwritten the index
* and the base. Zero is the most sensible value
@@ -747,7 +757,7 @@
task->thread.gsindex = 0;
x86_gsbase_write_task(task, arg2);
}
- preempt_enable();
+ hard_preempt_enable(flags);
break;
}
case ARCH_SET_FS: {
@@ -758,7 +768,7 @@
if (unlikely(arg2 >= TASK_SIZE_MAX))
return -EPERM;
- preempt_disable();
+ flags = hard_preempt_disable();
/*
* Set the selector to 0 for the same reason
* as %gs above.
@@ -776,7 +786,7 @@
task->thread.fsindex = 0;
x86_fsbase_write_task(task, arg2);
}
- preempt_enable();
+ hard_preempt_enable(flags);
break;
}
case ARCH_GET_FS: {
--
Gitblit v1.6.2