* [Qemu-devel] [PATCH] tests/acpi: don't pack a structure
@ 2017-03-30 15:35 Michael S. Tsirkin
2017-03-30 15:48 ` Peter Maydell
0 siblings, 1 reply; 2+ messages in thread
From: Michael S. Tsirkin @ 2017-03-30 15:35 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell, Igor Mammedov
There's no reason to pack structures where we don't care about size or
padding, this applies to AcpiStdTable in tests/acpi-utils.h.
OTOH bios-tables-test happens to be passing the address of a field in
this struct to a function that expects a pointer to normally aligned
data which results in a SIGBUS on architectures like SPARC that have
strict alignment requirements.
Fixes: 9e8458c02 ("acpi unit-test: compare DSDT and SSDT tables against expected values")
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
tests/acpi-utils.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/acpi-utils.h b/tests/acpi-utils.h
index 9f9a2d5..348e4d7 100644
--- a/tests/acpi-utils.h
+++ b/tests/acpi-utils.h
@@ -26,7 +26,7 @@ typedef struct {
gsize asl_len;
gchar *asl_file;
bool tmp_files_retain; /* do not delete the temp asl/aml */
-} QEMU_PACKED AcpiSdtTable;
+} AcpiSdtTable;
#define ACPI_READ_FIELD(field, addr) \
do { \
--
MST
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] tests/acpi: don't pack a structure
2017-03-30 15:35 [Qemu-devel] [PATCH] tests/acpi: don't pack a structure Michael S. Tsirkin
@ 2017-03-30 15:48 ` Peter Maydell
0 siblings, 0 replies; 2+ messages in thread
From: Peter Maydell @ 2017-03-30 15:48 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: QEMU Developers, Igor Mammedov
On 30 March 2017 at 16:35, Michael S. Tsirkin <mst@redhat.com> wrote:
> There's no reason to pack structures where we don't care about size or
> padding, this applies to AcpiStdTable in tests/acpi-utils.h.
>
> OTOH bios-tables-test happens to be passing the address of a field in
> this struct to a function that expects a pointer to normally aligned
> data which results in a SIGBUS on architectures like SPARC that have
> strict alignment requirements.
>
> Fixes: 9e8458c02 ("acpi unit-test: compare DSDT and SSDT tables against expected values")
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> tests/acpi-utils.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tests/acpi-utils.h b/tests/acpi-utils.h
> index 9f9a2d5..348e4d7 100644
> --- a/tests/acpi-utils.h
> +++ b/tests/acpi-utils.h
> @@ -26,7 +26,7 @@ typedef struct {
> gsize asl_len;
> gchar *asl_file;
> bool tmp_files_retain; /* do not delete the temp asl/aml */
> -} QEMU_PACKED AcpiSdtTable;
> +} AcpiSdtTable;
>
> #define ACPI_READ_FIELD(field, addr) \
> do { \
Yes, this fixes the SPARC crashes.
Tested-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-03-30 15:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-30 15:35 [Qemu-devel] [PATCH] tests/acpi: don't pack a structure Michael S. Tsirkin
2017-03-30 15:48 ` Peter Maydell
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).