[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJhGHyC6LgCwdDTkiy2TaQ8wzBQQfrx8ni7fY8vH-bUT2kR8pg@mail.gmail.com>
Date: Fri, 17 Mar 2023 17:39:01 +0800
From: Lai Jiangshan <jiangshanlai@...il.com>
To: Xin Li <xin3.li@...el.com>
Cc: linux-kernel@...r.kernel.org, x86@...nel.org, kvm@...r.kernel.org,
tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
dave.hansen@...ux.intel.com, hpa@...or.com, peterz@...radead.org,
andrew.cooper3@...rix.com, seanjc@...gle.com, pbonzini@...hat.com,
ravi.v.shankar@...el.com
Subject: Re: [PATCH v5 28/34] x86/fred: fixup fault on ERETU by jumping to fred_entrypoint_user
> +#ifdef CONFIG_X86_FRED
> +static bool ex_handler_eretu(const struct exception_table_entry *fixup,
> + struct pt_regs *regs, unsigned long error_code)
> +{
> + struct pt_regs *uregs = (struct pt_regs *)(regs->sp - offsetof(struct pt_regs, ip));
> + unsigned short ss = uregs->ss;
> + unsigned short cs = uregs->cs;
> +
> + fred_info(uregs)->edata = fred_event_data(regs);
> + uregs->ssx = regs->ssx;
> + uregs->ss = ss;
> + uregs->csx = regs->csx;
> + uregs->current_stack_level = 0;
> + uregs->cs = cs;
Hello
If the ERETU instruction had tried to return from NMI to ring3 and just faulted,
is NMI still blocked?
We know that IRET unconditionally enables NMI, but I can't find any clue in the
FRED's manual.
In the pseudocode of ERETU in the manual, it seems that NMI is only enabled when
ERETU succeeds with bit28 in csx set. If so, this code will fail to reenable
NMI if bit28 is not explicitly re-set in csx.
Thanks,
Lai
> +
> + /* Copy error code to uregs and adjust stack pointer accordingly */
> + uregs->orig_ax = error_code;
> + regs->sp -= 8;
> +
> + return ex_handler_default(fixup, regs);
> +}
Powered by blists - more mailing lists