mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Prakhya, Sai Praneeth" <sai.praneeth.prakhya@intel.com>
To: Bhupesh Sharma <bhsharma@redhat.com>
Cc: "linux-efi@vger.kernel.org" <linux-efi@vger.kernel.org>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"ricardo.ner@intel.com" <ricardo.ner@intel.com>,
	Matt Fleming <matt@codeblueprint.co.uk>,
	Lee Chun-Yi <jlee@suse.com>, Al Stone <astone@redhat.com>,
	Borislav Petkov <bp@alien8.de>, Ingo Molnar <mingo@kernel.org>,
	Andy Lutomirski <luto@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: RE: [PATCH V1 6/6] x86/efi: Introduce EFI_WARN_ON_ILLEGAL_ACCESSES
Date: Fri, 10 Aug 2018 17:34:04 +0000	[thread overview]
Message-ID: <FFF73D592F13FD46B8700F0A279B802F47CDA91A@ORSMSX114.amr.corp.intel.com> (raw)
In-Reply-To: <CACi5LpPcaiHEHV9cFm=C4UB23jmfie16VR4m3ZAkZ9bVis5Dqg@mail.gmail.com>

> > +config EFI_WARN_ON_ILLEGAL_ACCESSES
> 
> How about shortening the name to just 'EFI_WARN_ON_ILLEGAL_ACCESS'?
> 

Makes sense.. I will shorten it.

> > +       bool "Warn about illegal memory accesses by firmware"
> > +       depends on EFI
> 
> From a distribution p-o-v, I would suggest that we set this CONFIG option only if
> we are in the EXPERT mode, as this need more thrashing with the behaviour we
> see on old, buggy EFI firmwares available on very old x86 machines. So
> something like:
>            bool "Warn about illegal memory accesses by firmware" if EXPERT
> 

Agreed. Although the feature is intended to warn about all these buggy firmware's
instead of silently working around (as we are doing presently), it needs more testing.
Hence, as you said, I think it's safe to have it as an EXPERT config option.

> > +       help
> > +         Enable this debug feature so that the kernel can detect illegal
> > +         memory accesses by firmware and issue a warning. Also,
> > +         1. If the illegally accessed region is EFI_BOOT_SERVICES_<CODE/DATA>,
> > +            the kernel fixes it up by mapping the requested region.

[....]

> > diff --git a/init/main.c b/init/main.c index
> > 3b4ada11ed52..dce0520861a1 100644
> > --- a/init/main.c
> > +++ b/init/main.c
> > @@ -730,7 +730,8 @@ asmlinkage __visible void __init start_kernel(void)
> >         arch_post_acpi_subsys_init();
> >         sfi_init_late();
> >
> > -       if (efi_enabled(EFI_RUNTIME_SERVICES)) {
> > +       if (efi_enabled(EFI_RUNTIME_SERVICES) &&
> > +           !IS_ENABLED(CONFIG_EFI_WARN_ON_ILLEGAL_ACCESSES)) {
> 
> Since this is an arch agnostic code leg, do we really want to introduce a generic
> check for CONFIG_EFI_WARN_ON_ILLEGAL_ACCESSES
> here, without checking for whether we are actually running this on a
> x86 hardware, or alternatively we can consider moving
> CONFIG_EFI_WARN_ON_ILLEGAL_ACCESSES out of 'arch/x86/Kconfig' to
> 'arch/Kconfig' so that later it can be used on other archs like ARM64 as well.
> 
> I think the later would be more useful..

Thanks for bringing this up. I see your point. I will refrain from polluting architecture
agnostic code. As we don't need efi_free_boot_services() at all, if EFI_WARN_ON_ILLEGAL_ACCESSES
is enabled, probably making changes to include/linux/efi.h would be better, I guess..

Moving this to arch/Kconfig could be too futuristic.. I guess.. because I am not sure
if this problem exists on ARM machines, if so, probably Ard could suggest something here.

Regards,
Sai

  reply	other threads:[~2018-08-10 17:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-09  4:31 [PATCH V1 0/6] Add efi page fault handler to fix/recover from Sai Praneeth Prakhya
2018-08-09  4:31 ` [PATCH V1 1/6] efi: Make efi_rts_work accessible to efi page fault handler Sai Praneeth Prakhya
2018-08-09  4:31 ` [PATCH V1 2/6] x86/efi: Remove __init attribute from memory mapping functions Sai Praneeth Prakhya
2018-08-09  4:31 ` [PATCH V1 3/6] x86/efi: Permanently save the EFI_MEMORY_MAP passed by the firmware Sai Praneeth Prakhya
2018-08-09  4:31 ` [PATCH V1 4/6] x86/efi: Add efi page fault handler to fixup/recover from page faults caused by firmware Sai Praneeth Prakhya
2018-08-09  4:31 ` [PATCH V1 5/6] x86/mm: If in_atomic(), allocate pages without sleeping Sai Praneeth Prakhya
2018-08-09  4:31 ` [PATCH V1 6/6] x86/efi: Introduce EFI_WARN_ON_ILLEGAL_ACCESSES Sai Praneeth Prakhya
2018-08-10 11:42   ` Bhupesh Sharma
2018-08-10 17:34     ` Prakhya, Sai Praneeth [this message]
2018-08-10 18:30       ` Bhupesh Sharma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=FFF73D592F13FD46B8700F0A279B802F47CDA91A@ORSMSX114.amr.corp.intel.com \
    --to=sai.praneeth.prakhya@intel.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=astone@redhat.com \
    --cc=bhsharma@redhat.com \
    --cc=bp@alien8.de \
    --cc=jlee@suse.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=matt@codeblueprint.co.uk \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=ricardo.ner@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®