From: "Vladimir 'phcoder' Serbinenko" <phcoder@gmail.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: [PATCH v2] acpi: Mark MADT entries as packed.
Date: Fri, 15 Mar 2024 22:02:07 +0300 [thread overview]
Message-ID: <CAEaD8JM6XnjXsSceTzd0N0L0-L6u5zgSaiAuPb0R7ByQERJVag@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 275 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.
Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
--
Regards
Vladimir 'phcoder' Serbinenko
[-- Attachment #2: 0001-acpi-Mark-MADT-entries-as-packed.patch --]
[-- Type: application/octet-stream, Size: 1928 bytes --]
From 991a359a8cb1020f4a09ca5e4e303c1b420de4d8 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 | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/include/grub/acpi.h b/include/grub/acpi.h
index 17aadb802..a53d7ed91 100644
--- a/include/grub/acpi.h
+++ b/include/grub/acpi.h
@@ -81,6 +81,8 @@ struct grub_acpi_fadt
#define GRUB_ACPI_MADT_SIGNATURE "APIC"
+/* Note: here GRUB_PACKED is not needed only because we only
+ have uint8_t here. */
struct grub_acpi_madt_entry_header
{
grub_uint8_t type;
@@ -112,7 +114,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 +123,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 +150,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 +162,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 +174,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
next reply other threads:[~2024-03-15 19:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-15 19:02 Vladimir 'phcoder' Serbinenko [this message]
2024-04-10 11:16 ` [PATCH v2] acpi: Mark MADT entries as packed 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=CAEaD8JM6XnjXsSceTzd0N0L0-L6u5zgSaiAuPb0R7ByQERJVag@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).