* [GIT PULL] EFI fix
@ 2017-06-10 8:31 Ingo Molnar
0 siblings, 0 replies; 8+ messages in thread
From: Ingo Molnar @ 2017-06-10 8:31 UTC (permalink / raw)
To: Linus Torvalds
Cc: linux-kernel, Thomas Gleixner, H. Peter Anvin, Peter Zijlstra,
Andrew Morton, Matt Fleming, Ard Biesheuvel, linux-efi
Linus,
Please pull the latest efi-urgent-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git efi-urgent-for-linus
# HEAD: 792ef14df5c585c19b2831673a077504a09e5203 efi: Fix boot panic because of invalid BGRT image address
A boot crash fix for certain systems where the kernel would trust a piece of
firmware data it should not have.
Thanks,
Ingo
------------------>
Dave Young (1):
efi: Fix boot panic because of invalid BGRT image address
drivers/firmware/efi/efi-bgrt.c | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/drivers/firmware/efi/efi-bgrt.c b/drivers/firmware/efi/efi-bgrt.c
index 8bf27323f7a3..b58233e4ed71 100644
--- a/drivers/firmware/efi/efi-bgrt.c
+++ b/drivers/firmware/efi/efi-bgrt.c
@@ -27,6 +27,26 @@ struct bmp_header {
u32 size;
} __packed;
+static bool efi_bgrt_addr_valid(u64 addr)
+{
+ efi_memory_desc_t *md;
+
+ for_each_efi_memory_desc(md) {
+ u64 size;
+ u64 end;
+
+ if (md->type != EFI_BOOT_SERVICES_DATA)
+ continue;
+
+ size = md->num_pages << EFI_PAGE_SHIFT;
+ end = md->phys_addr + size;
+ if (addr >= md->phys_addr && addr < end)
+ return true;
+ }
+
+ return false;
+}
+
void __init efi_bgrt_init(struct acpi_table_header *table)
{
void *image;
@@ -36,7 +56,7 @@ void __init efi_bgrt_init(struct acpi_table_header *table)
if (acpi_disabled)
return;
- if (!efi_enabled(EFI_BOOT))
+ if (!efi_enabled(EFI_MEMMAP))
return;
if (table->length < sizeof(bgrt_tab)) {
@@ -65,6 +85,10 @@ void __init efi_bgrt_init(struct acpi_table_header *table)
goto out;
}
+ if (!efi_bgrt_addr_valid(bgrt->image_address)) {
+ pr_notice("Ignoring BGRT: invalid image address\n");
+ goto out;
+ }
image = early_memremap(bgrt->image_address, sizeof(bmp_header));
if (!image) {
pr_notice("Ignoring BGRT: failed to map image header memory\n");
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [GIT PULL] EFI fix
2019-01-11 17:47 ` Linus Torvalds
@ 2019-01-12 8:54 ` Ingo Molnar
0 siblings, 0 replies; 8+ messages in thread
From: Ingo Molnar @ 2019-01-12 8:54 UTC (permalink / raw)
To: Linus Torvalds
Cc: Linux List Kernel Mailing, Ard Biesheuvel, linux-efi,
Thomas Gleixner, Borislav Petkov, Peter Zijlstra, Andrew Morton
* Linus Torvalds <torvalds@linux-foundation.org> wrote:
> On Thu, Jan 10, 2019 at 11:46 PM Ingo Molnar <mingo@kernel.org> wrote:
> >
> > A single fix that adds an annotation to resolve a kmemleak false
> > positive.
>
> This one is apparently obviated by commit 80424b02d42b ("efi: Reduce
> the amount of memblock reservations for persistent allocations")
... and it turns out I mis-merged it in tip:master not realizing this
connection (hence the pull request) - so good thing that Ard warned about
this and you double checked it!
Thanks,
Ingo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [GIT PULL] EFI fix
2019-01-11 17:55 ` Linus Torvalds
@ 2019-01-12 8:53 ` Ingo Molnar
0 siblings, 0 replies; 8+ messages in thread
From: Ingo Molnar @ 2019-01-12 8:53 UTC (permalink / raw)
To: Linus Torvalds
Cc: Ard Biesheuvel, Linux Kernel Mailing List, linux-efi,
Thomas Gleixner, Borislav Petkov, Peter Zijlstra, Andrew Morton
* Linus Torvalds <torvalds@linux-foundation.org> wrote:
> On Fri, Jan 11, 2019 at 6:22 AM Ard Biesheuvel
> <ard.biesheuvel@linaro.org> wrote:
> >
> > I was hoping we could merge this patch (so we can backport it), but
> > resolve the conflict by dropping the kmemleak_ignore() again [..]
>
> Well, we'd drop the new #include line also, since it would be
> pointless without the kmemleak_ignore().
>
> End result: there would be nothing left. Better not to merge it at all.
Indeed!
> It's easy enough to backport, and just say "done differently upstream
> in commit 80424b02d42b ("efi: Reduce the amount of memblock
> reservations for persistent allocations").
>
> The stable tree doesn't require that the *same* commits be upstream,
> it only requires that the fixes be upstream and Greg&al want a pointer
> to the upstream fix just so that they know they're not fixing
> something that might still be broken upstream.
>
> See for example (just random googling)
>
> https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=37435f7e80ef9adc32a69013c18f135e3f434244
>
> which shows that "fixed differently upstream" case and points to why.
Thanks - I'm dropping the commit from efi/urgent.
Ingo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [GIT PULL] EFI fix
2019-01-11 14:22 ` Ard Biesheuvel
@ 2019-01-11 17:55 ` Linus Torvalds
2019-01-12 8:53 ` Ingo Molnar
0 siblings, 1 reply; 8+ messages in thread
From: Linus Torvalds @ 2019-01-11 17:55 UTC (permalink / raw)
To: Ard Biesheuvel
Cc: Ingo Molnar, Linux Kernel Mailing List, linux-efi,
Thomas Gleixner, Borislav Petkov, Peter Zijlstra, Andrew Morton
On Fri, Jan 11, 2019 at 6:22 AM Ard Biesheuvel
<ard.biesheuvel@linaro.org> wrote:
>
> I was hoping we could merge this patch (so we can backport it), but
> resolve the conflict by dropping the kmemleak_ignore() again [..]
Well, we'd drop the new #include line also, since it would be
pointless without the kmemleak_ignore().
End result: there would be nothing left. Better not to merge it at all.
It's easy enough to backport, and just say "done differently upstream
in commit 80424b02d42b ("efi: Reduce the amount of memblock
reservations for persistent allocations").
The stable tree doesn't require that the *same* commits be upstream,
it only requires that the fixes be upstream and Greg&al want a pointer
to the upstream fix just so that they know they're not fixing
something that might still be broken upstream.
See for example (just random googling)
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=37435f7e80ef9adc32a69013c18f135e3f434244
which shows that "fixed differently upstream" case and points to why.
Linus
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [GIT PULL] EFI fix
2019-01-11 7:46 Ingo Molnar
2019-01-11 14:22 ` Ard Biesheuvel
@ 2019-01-11 17:47 ` Linus Torvalds
2019-01-12 8:54 ` Ingo Molnar
1 sibling, 1 reply; 8+ messages in thread
From: Linus Torvalds @ 2019-01-11 17:47 UTC (permalink / raw)
To: Ingo Molnar
Cc: Linux List Kernel Mailing, Ard Biesheuvel, linux-efi,
Thomas Gleixner, Borislav Petkov, Peter Zijlstra, Andrew Morton
On Thu, Jan 10, 2019 at 11:46 PM Ingo Molnar <mingo@kernel.org> wrote:
>
> A single fix that adds an annotation to resolve a kmemleak false
> positive.
This one is apparently obviated by commit 80424b02d42b ("efi: Reduce
the amount of memblock reservations for persistent allocations")
Linus
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [GIT PULL] EFI fix
2019-01-11 7:46 Ingo Molnar
@ 2019-01-11 14:22 ` Ard Biesheuvel
2019-01-11 17:55 ` Linus Torvalds
2019-01-11 17:47 ` Linus Torvalds
1 sibling, 1 reply; 8+ messages in thread
From: Ard Biesheuvel @ 2019-01-11 14:22 UTC (permalink / raw)
To: Ingo Molnar
Cc: Linus Torvalds, Linux Kernel Mailing List, linux-efi,
Thomas Gleixner, Borislav Petkov, Peter Zijlstra, Andrew Morton
On Fri, 11 Jan 2019 at 08:46, Ingo Molnar <mingo@kernel.org> wrote:
>
> Linus,
>
> Please pull the latest efi-urgent-for-linus git tree from:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git efi-urgent-for-linus
>
> # HEAD: b12f5440d8ca02e8f9ab4f1461f9214295cc4f66 Merge branch 'linus' into efi/urgent, to resolve conflict
>
> A single fix that adds an annotation to resolve a kmemleak false
> positive.
>
> Thanks,
>
> Ingo
>
> ------------------>
> Qian Cai (1):
> efi: Let kmemleak ignore false positives
>
>
> drivers/firmware/efi/efi.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
> index 4c46ff6f2242..7ac09dd8f268 100644
> --- a/drivers/firmware/efi/efi.c
> +++ b/drivers/firmware/efi/efi.c
> @@ -31,6 +31,7 @@
> #include <linux/acpi.h>
> #include <linux/ucs2_string.h>
> #include <linux/memblock.h>
> +#include <linux/kmemleak.h>
>
> #include <asm/early_ioremap.h>
>
> @@ -1026,6 +1027,8 @@ int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size)
> if (!rsv)
> return -ENOMEM;
>
> + kmemleak_ignore(rsv);
> +
> rsv->size = EFI_MEMRESERVE_COUNT(PAGE_SIZE);
> atomic_set(&rsv->count, 1);
> rsv->entry[0].base = addr;
I was hoping we could merge this patch (so we can backport it), but
resolve the conflict by dropping the kmemleak_ignore() again, since it
will now complain since the kmalloc() has been replaced with a
__get_free_page() in the mean time (if that makes sense)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [GIT PULL] EFI fix
@ 2019-01-11 7:46 Ingo Molnar
2019-01-11 14:22 ` Ard Biesheuvel
2019-01-11 17:47 ` Linus Torvalds
0 siblings, 2 replies; 8+ messages in thread
From: Ingo Molnar @ 2019-01-11 7:46 UTC (permalink / raw)
To: Linus Torvalds
Cc: linux-kernel, Ard Biesheuvel, linux-efi, Thomas Gleixner,
Borislav Petkov, Peter Zijlstra, Andrew Morton
Linus,
Please pull the latest efi-urgent-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git efi-urgent-for-linus
# HEAD: b12f5440d8ca02e8f9ab4f1461f9214295cc4f66 Merge branch 'linus' into efi/urgent, to resolve conflict
A single fix that adds an annotation to resolve a kmemleak false
positive.
Thanks,
Ingo
------------------>
Qian Cai (1):
efi: Let kmemleak ignore false positives
drivers/firmware/efi/efi.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index 4c46ff6f2242..7ac09dd8f268 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -31,6 +31,7 @@
#include <linux/acpi.h>
#include <linux/ucs2_string.h>
#include <linux/memblock.h>
+#include <linux/kmemleak.h>
#include <asm/early_ioremap.h>
@@ -1026,6 +1027,8 @@ int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size)
if (!rsv)
return -ENOMEM;
+ kmemleak_ignore(rsv);
+
rsv->size = EFI_MEMRESERVE_COUNT(PAGE_SIZE);
atomic_set(&rsv->count, 1);
rsv->entry[0].base = addr;
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [GIT PULL] EFI fix
@ 2018-07-30 17:44 Ingo Molnar
0 siblings, 0 replies; 8+ messages in thread
From: Ingo Molnar @ 2018-07-30 17:44 UTC (permalink / raw)
To: Linus Torvalds
Cc: linux-kernel, Ard Biesheuvel, Matt Fleming, linux-efi,
Thomas Gleixner, Peter Zijlstra
Linus,
Please pull the latest efi-urgent-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git efi-urgent-for-linus
# HEAD: 9b788f32bee6b0b293a4bdfca4ad4bb0206407fb x86/efi: Access EFI MMIO data as unencrypted when SEV is active
An UEFI variables fix for SEV guests.
Thanks,
Ingo
------------------>
Brijesh Singh (1):
x86/efi: Access EFI MMIO data as unencrypted when SEV is active
arch/x86/platform/efi/efi_64.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index 77873ce700ae..5f2eb3231607 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -417,7 +417,7 @@ static void __init __map_region(efi_memory_desc_t *md, u64 va)
if (!(md->attribute & EFI_MEMORY_WB))
flags |= _PAGE_PCD;
- if (sev_active())
+ if (sev_active() && md->type != EFI_MEMORY_MAPPED_IO)
flags |= _PAGE_ENC;
pfn = md->phys_addr >> PAGE_SHIFT;
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-01-12 8:54 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-10 8:31 [GIT PULL] EFI fix Ingo Molnar
2018-07-30 17:44 Ingo Molnar
2019-01-11 7:46 Ingo Molnar
2019-01-11 14:22 ` Ard Biesheuvel
2019-01-11 17:55 ` Linus Torvalds
2019-01-12 8:53 ` Ingo Molnar
2019-01-11 17:47 ` Linus Torvalds
2019-01-12 8:54 ` Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).