grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: "Vladimir 'phcoder' Serbinenko" <phcoder@gmail.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: [PATCH] acpi: Mark MADT entries as packed.
Date: Tue, 31 Oct 2023 20:20:14 +0100	[thread overview]
Message-ID: <CAEaD8JMLsYauLmh46t8vcVTf8cdMV0LVbfOLD3+GVuAyi4-KrQ@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 219 bytes --]

No alignment is guaranteed and in fact on my ia64 sapic is aligned
to 4 bytes instead of 8 and causes a trap. It affects only rarely used
lsacpi command and so went unnoticed.

-- 
Regards
Vladimir 'phcoder' Serbinenko

[-- Attachment #2: 0001-acpi-Mark-MADT-entries-as-packed.patch --]
[-- Type: text/x-patch, Size: 1691 bytes --]

From 9d03ab04df3b723058fb0b7c30576e1330cbad5d Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Tue, 31 Oct 2023 18:27:19 +0100
Subject: [PATCH] acpi: Mark MADT entries as packed.

No alignment is guaranteed and in fact on my ia64 sapic is aligned
to 4 bytes instead of 8 and causes a trap. It affects only rarely used
lsacpi command and so went unnoticed.

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
---
 include/grub/acpi.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/grub/acpi.h b/include/grub/acpi.h
index 17aadb802..87220e337 100644
--- a/include/grub/acpi.h
+++ b/include/grub/acpi.h
@@ -112,7 +112,7 @@ struct grub_acpi_madt_entry_lapic
   grub_uint8_t acpiid;
   grub_uint8_t apicid;
   grub_uint32_t flags;
-};
+} GRUB_PACKED;
 
 struct grub_acpi_madt_entry_ioapic
 {
@@ -121,7 +121,7 @@ struct grub_acpi_madt_entry_ioapic
   grub_uint8_t pad;
   grub_uint32_t address;
   grub_uint32_t global_sys_interrupt;
-};
+} GRUB_PACKED;
 
 struct grub_acpi_madt_entry_interrupt_override
 {
@@ -148,7 +148,7 @@ struct grub_acpi_madt_entry_sapic
   grub_uint8_t pad;
   grub_uint32_t global_sys_interrupt_base;
   grub_uint64_t addr;
-};
+} GRUB_PACKED;
 
 struct grub_acpi_madt_entry_lsapic
 {
@@ -160,7 +160,7 @@ struct grub_acpi_madt_entry_lsapic
   grub_uint32_t flags;
   grub_uint32_t cpu_uid;
   grub_uint8_t cpu_uid_str[0];
-};
+} GRUB_PACKED;
 
 struct grub_acpi_madt_entry_platform_int_source
 {
@@ -172,7 +172,7 @@ struct grub_acpi_madt_entry_platform_int_source
   grub_uint8_t sapic_vector;
   grub_uint32_t global_sys_int;
   grub_uint32_t src_flags;
-};
+} GRUB_PACKED;
 
 enum
   {
-- 
2.39.2


[-- Attachment #3: Type: text/plain, Size: 141 bytes --]

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

             reply	other threads:[~2023-10-31 19:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-31 19:20 Vladimir 'phcoder' Serbinenko [this message]
2023-11-06 17:04 ` [PATCH] acpi: Mark MADT entries as packed Daniel Kiper
2023-11-06 19:43   ` Vladimir 'phcoder' Serbinenko
2023-11-07 18:14     ` Daniel Kiper

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=CAEaD8JMLsYauLmh46t8vcVTf8cdMV0LVbfOLD3+GVuAyi4-KrQ@mail.gmail.com \
    --to=phcoder@gmail.com \
    --cc=grub-devel@gnu.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).