* [PATCH] ACPI: fix vendor resource length computation
2006-02-14 0:22 ` Bjorn Helgaas
@ 2006-02-14 23:13 ` Bjorn Helgaas
2006-02-14 23:19 ` Bjorn Helgaas
0 siblings, 1 reply; 10+ messages in thread
From: Bjorn Helgaas @ 2006-02-14 23:13 UTC (permalink / raw)
To: Andreas Schwab
Cc: Thomas Renninger, Moore, Robert, Luck, Tony, Brown, Len,
linux-acpi, linux-ia64, Andrew Morton, efocht
acpi_rs_get_list_length() needs to account for all the vendor-defined
data bytes. Failing to include these causes buffers to be sized too
small, which causes slab corruption when we later convert AML to
resources and run off the end of the buffer.
I'm no expert on this code, so please scrutinize this carefully.
This causes slab corruption on machines that use ACPI vendor-defined
resources. All HP ia64 machines do, and I'm told that some NEC
machines may as well. So if the fix is correct, it would be good
to have it in 2.6.16.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Index: work-mm4/drivers/acpi/resources/rscalc.c
===================================================================
--- work-mm4.orig/drivers/acpi/resources/rscalc.c 2006-02-14 13:32:50.000000000 -0700
+++ work-mm4/drivers/acpi/resources/rscalc.c 2006-02-14 13:33:25.000000000 -0700
@@ -391,8 +391,7 @@
* Ensure a 32-bit boundary for the structure
*/
extra_struct_bytes =
- ACPI_ROUND_UP_to_32_bITS(resource_length) -
- resource_length;
+ ACPI_ROUND_UP_to_32_bITS(resource_length);
break;
case ACPI_RESOURCE_NAME_END_TAG:
@@ -408,8 +407,7 @@
* Add vendor data and ensure a 32-bit boundary for the structure
*/
extra_struct_bytes =
- ACPI_ROUND_UP_to_32_bITS(resource_length) -
- resource_length;
+ ACPI_ROUND_UP_to_32_bITS(resource_length);
break;
case ACPI_RESOURCE_NAME_ADDRESS32:
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] ACPI: fix vendor resource length computation
2006-02-14 23:13 ` [PATCH] ACPI: fix vendor resource length computation Bjorn Helgaas
@ 2006-02-14 23:19 ` Bjorn Helgaas
0 siblings, 0 replies; 10+ messages in thread
From: Bjorn Helgaas @ 2006-02-14 23:19 UTC (permalink / raw)
To: Andreas Schwab
Cc: Thomas Renninger, Moore, Robert, Luck, Tony, Brown, Len,
linux-acpi, linux-ia64, Andrew Morton, efocht
On Tuesday 14 February 2006 16:13, Bjorn Helgaas wrote:
> acpi_rs_get_list_length() needs to account for all the vendor-defined
> data bytes. Failing to include these causes buffers to be sized too
> small, which causes slab corruption when we later convert AML to
> resources and run off the end of the buffer.
>
> I'm no expert on this code, so please scrutinize this carefully.
>
> This causes slab corruption on machines that use ACPI vendor-defined
> resources. All HP ia64 machines do, and I'm told that some NEC
> machines may as well. So if the fix is correct, it would be good
> to have it in 2.6.16.
>
> Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
I forgot to mention that this patch may be used under either the GPL
or the BSD license used for the ACPI CA.
> Index: work-mm4/drivers/acpi/resources/rscalc.c
> ===================================================================
> --- work-mm4.orig/drivers/acpi/resources/rscalc.c 2006-02-14 13:32:50.000000000 -0700
> +++ work-mm4/drivers/acpi/resources/rscalc.c 2006-02-14 13:33:25.000000000 -0700
> @@ -391,8 +391,7 @@
> * Ensure a 32-bit boundary for the structure
> */
> extra_struct_bytes =
> - ACPI_ROUND_UP_to_32_bITS(resource_length) -
> - resource_length;
> + ACPI_ROUND_UP_to_32_bITS(resource_length);
> break;
>
> case ACPI_RESOURCE_NAME_END_TAG:
> @@ -408,8 +407,7 @@
> * Add vendor data and ensure a 32-bit boundary for the structure
> */
> extra_struct_bytes =
> - ACPI_ROUND_UP_to_32_bITS(resource_length) -
> - resource_length;
> + ACPI_ROUND_UP_to_32_bITS(resource_length);
> break;
>
> case ACPI_RESOURCE_NAME_ADDRESS32:
> -
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH] ACPI: fix vendor resource length computation
@ 2006-02-14 23:25 Moore, Robert
2006-02-14 23:34 ` Bjorn Helgaas
0 siblings, 1 reply; 10+ messages in thread
From: Moore, Robert @ 2006-02-14 23:25 UTC (permalink / raw)
To: Bjorn Helgaas, Andreas Schwab
Cc: Thomas Renninger, Luck, Tony, Brown, Len, linux-acpi, linux-ia64,
Andrew Morton, efocht
I'll look at this.
Does this fix all of the slab corruptions issues we have been hearing
about?
Bob
> -----Original Message-----
> From: Bjorn Helgaas [mailto:bjorn.helgaas@hp.com]
> Sent: Tuesday, February 14, 2006 3:13 PM
> To: Andreas Schwab
> Cc: Thomas Renninger; Moore, Robert; Luck, Tony; Brown, Len; linux-
> acpi@vger.kernel.org; linux-ia64@vger.kernel.org; Andrew Morton;
> efocht@hpce.nec.com
> Subject: [PATCH] ACPI: fix vendor resource length computation
>
> acpi_rs_get_list_length() needs to account for all the vendor-defined
> data bytes. Failing to include these causes buffers to be sized too
> small, which causes slab corruption when we later convert AML to
> resources and run off the end of the buffer.
>
> I'm no expert on this code, so please scrutinize this carefully.
>
> This causes slab corruption on machines that use ACPI vendor-defined
> resources. All HP ia64 machines do, and I'm told that some NEC
> machines may as well. So if the fix is correct, it would be good
> to have it in 2.6.16.
>
> Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
>
> Index: work-mm4/drivers/acpi/resources/rscalc.c
> ===================================================================
> --- work-mm4.orig/drivers/acpi/resources/rscalc.c 2006-02-14
> 13:32:50.000000000 -0700
> +++ work-mm4/drivers/acpi/resources/rscalc.c 2006-02-14
> 13:33:25.000000000 -0700
> @@ -391,8 +391,7 @@
> * Ensure a 32-bit boundary for the structure
> */
> extra_struct_bytes =
> - ACPI_ROUND_UP_to_32_bITS(resource_length) -
> - resource_length;
> + ACPI_ROUND_UP_to_32_bITS(resource_length);
> break;
>
> case ACPI_RESOURCE_NAME_END_TAG:
> @@ -408,8 +407,7 @@
> * Add vendor data and ensure a 32-bit boundary
for the
> structure
> */
> extra_struct_bytes =
> - ACPI_ROUND_UP_to_32_bITS(resource_length) -
> - resource_length;
> + ACPI_ROUND_UP_to_32_bITS(resource_length);
> break;
>
> case ACPI_RESOURCE_NAME_ADDRESS32:
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] ACPI: fix vendor resource length computation
2006-02-14 23:25 Moore, Robert
@ 2006-02-14 23:34 ` Bjorn Helgaas
0 siblings, 0 replies; 10+ messages in thread
From: Bjorn Helgaas @ 2006-02-14 23:34 UTC (permalink / raw)
To: Moore, Robert
Cc: Andreas Schwab, Thomas Renninger, Luck, Tony, Brown, Len,
linux-acpi, linux-ia64, Andrew Morton, efocht
On Tuesday 14 February 2006 16:25, Moore, Robert wrote:
> Does this fix all of the slab corruptions issues we have been hearing
> about?
It fixes the one I saw with 2.6.16-rc3 on HP rx7620. I'm pretty sure
that's the same as the one Thomas observed in pci_acpi_scan_root() and
acpi_sba_ioc_add().
But I haven't been paying attention to any other slab corruption issues,
so I can't speculate about them.
> > -----Original Message-----
> > From: Bjorn Helgaas [mailto:bjorn.helgaas@hp.com]
> > Sent: Tuesday, February 14, 2006 3:13 PM
> > To: Andreas Schwab
> > Cc: Thomas Renninger; Moore, Robert; Luck, Tony; Brown, Len; linux-
> > acpi@vger.kernel.org; linux-ia64@vger.kernel.org; Andrew Morton;
> > efocht@hpce.nec.com
> > Subject: [PATCH] ACPI: fix vendor resource length computation
> >
> > acpi_rs_get_list_length() needs to account for all the vendor-defined
> > data bytes. Failing to include these causes buffers to be sized too
> > small, which causes slab corruption when we later convert AML to
> > resources and run off the end of the buffer.
> >
> > I'm no expert on this code, so please scrutinize this carefully.
> >
> > This causes slab corruption on machines that use ACPI vendor-defined
> > resources. All HP ia64 machines do, and I'm told that some NEC
> > machines may as well. So if the fix is correct, it would be good
> > to have it in 2.6.16.
> >
> > Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
> >
> > Index: work-mm4/drivers/acpi/resources/rscalc.c
> > ===================================================================
> > --- work-mm4.orig/drivers/acpi/resources/rscalc.c 2006-02-14
> > 13:32:50.000000000 -0700
> > +++ work-mm4/drivers/acpi/resources/rscalc.c 2006-02-14
> > 13:33:25.000000000 -0700
> > @@ -391,8 +391,7 @@
> > * Ensure a 32-bit boundary for the structure
> > */
> > extra_struct_bytes =
> > - ACPI_ROUND_UP_to_32_bITS(resource_length) -
> > - resource_length;
> > + ACPI_ROUND_UP_to_32_bITS(resource_length);
> > break;
> >
> > case ACPI_RESOURCE_NAME_END_TAG:
> > @@ -408,8 +407,7 @@
> > * Add vendor data and ensure a 32-bit boundary
> for the
> > structure
> > */
> > extra_struct_bytes =
> > - ACPI_ROUND_UP_to_32_bITS(resource_length) -
> > - resource_length;
> > + ACPI_ROUND_UP_to_32_bITS(resource_length);
> > break;
> >
> > case ACPI_RESOURCE_NAME_ADDRESS32:
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH] ACPI: fix vendor resource length computation
@ 2006-02-15 0:04 Moore, Robert
2006-02-15 17:49 ` Thomas Renninger
0 siblings, 1 reply; 10+ messages in thread
From: Moore, Robert @ 2006-02-15 0:04 UTC (permalink / raw)
To: Bjorn Helgaas, Andreas Schwab
Cc: Thomas Renninger, Luck, Tony, Brown, Len, linux-acpi, linux-ia64,
Andrew Morton, efocht
I think the original code may have been attempting to subtract off the
size of the descriptor header to obtain the length of the vendor data
bytes. However, something like a global replace may have broken it.
> -----Original Message-----
> From: Bjorn Helgaas [mailto:bjorn.helgaas@hp.com]
> Sent: Tuesday, February 14, 2006 3:13 PM
> To: Andreas Schwab
> Cc: Thomas Renninger; Moore, Robert; Luck, Tony; Brown, Len; linux-
> acpi@vger.kernel.org; linux-ia64@vger.kernel.org; Andrew Morton;
> efocht@hpce.nec.com
> Subject: [PATCH] ACPI: fix vendor resource length computation
>
> acpi_rs_get_list_length() needs to account for all the vendor-defined
> data bytes. Failing to include these causes buffers to be sized too
> small, which causes slab corruption when we later convert AML to
> resources and run off the end of the buffer.
>
> I'm no expert on this code, so please scrutinize this carefully.
>
> This causes slab corruption on machines that use ACPI vendor-defined
> resources. All HP ia64 machines do, and I'm told that some NEC
> machines may as well. So if the fix is correct, it would be good
> to have it in 2.6.16.
>
> Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
>
> Index: work-mm4/drivers/acpi/resources/rscalc.c
> ===================================================================
> --- work-mm4.orig/drivers/acpi/resources/rscalc.c 2006-02-14
> 13:32:50.000000000 -0700
> +++ work-mm4/drivers/acpi/resources/rscalc.c 2006-02-14
> 13:33:25.000000000 -0700
> @@ -391,8 +391,7 @@
> * Ensure a 32-bit boundary for the structure
> */
> extra_struct_bytes =
> - ACPI_ROUND_UP_to_32_bITS(resource_length) -
> - resource_length;
> + ACPI_ROUND_UP_to_32_bITS(resource_length);
> break;
>
> case ACPI_RESOURCE_NAME_END_TAG:
> @@ -408,8 +407,7 @@
> * Add vendor data and ensure a 32-bit boundary
for the
> structure
> */
> extra_struct_bytes =
> - ACPI_ROUND_UP_to_32_bITS(resource_length) -
> - resource_length;
> + ACPI_ROUND_UP_to_32_bITS(resource_length);
> break;
>
> case ACPI_RESOURCE_NAME_ADDRESS32:
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] ACPI: fix vendor resource length computation
2006-02-15 0:04 Moore, Robert
@ 2006-02-15 17:49 ` Thomas Renninger
0 siblings, 0 replies; 10+ messages in thread
From: Thomas Renninger @ 2006-02-15 17:49 UTC (permalink / raw)
To: Moore, Robert
Cc: Bjorn Helgaas, Andreas Schwab, Luck, Tony, Brown, Len, linux-acpi,
linux-ia64, Andrew Morton, efocht
Moore, Robert wrote:
> I think the original code may have been attempting to subtract off the
> size of the descriptor header to obtain the length of the vendor data
> bytes. However, something like a global replace may have broken it.
>
Thanks, this one fixes the mem corruption.
Unaligned access messages still remain...
Thomas
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH] ACPI: fix vendor resource length computation
@ 2006-02-15 18:38 Moore, Robert
0 siblings, 0 replies; 10+ messages in thread
From: Moore, Robert @ 2006-02-15 18:38 UTC (permalink / raw)
To: Thomas Renninger
Cc: Bjorn Helgaas, Andreas Schwab, Luck, Tony, Brown, Len, linux-acpi,
linux-ia64, Andrew Morton, efocht
I'm working on the alignment issue also, should be a fix this week.
Bob
> -----Original Message-----
> From: Thomas Renninger [mailto:trenn@suse.de]
> Sent: Wednesday, February 15, 2006 9:50 AM
> To: Moore, Robert
> Cc: Bjorn Helgaas; Andreas Schwab; Luck, Tony; Brown, Len; linux-
> acpi@vger.kernel.org; linux-ia64@vger.kernel.org; Andrew Morton;
> efocht@hpce.nec.com
> Subject: Re: [PATCH] ACPI: fix vendor resource length computation
>
> Moore, Robert wrote:
> > I think the original code may have been attempting to subtract off
the
> > size of the descriptor header to obtain the length of the vendor
data
> > bytes. However, something like a global replace may have broken it.
> >
> Thanks, this one fixes the mem corruption.
> Unaligned access messages still remain...
>
>
> Thomas
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH] ACPI: fix vendor resource length computation
@ 2006-02-15 19:05 Luck, Tony
2006-02-16 8:59 ` Thomas Renninger
0 siblings, 1 reply; 10+ messages in thread
From: Luck, Tony @ 2006-02-15 19:05 UTC (permalink / raw)
To: Moore, Robert, Thomas Renninger
Cc: Bjorn Helgaas, Andreas Schwab, Brown, Len, linux-acpi, linux-ia64,
Andrew Morton, efocht
> I'm working on the alignment issue also, should be a fix this week.
With Bjorn's tip on using console=uart,mmio,0x{address} I can now
get a complete trace from boot using acpi_dbg_level = 0xffffff ...
well in theory I can, I started the boot two days ago and have
2.2 million lines of output so far, and it is still going! Now
I'm just curious as to whether this will actually complete, but
if it doesn't do so in the next few days I'll have to abort the
boot and get back to using that system for regression testing on
other patches.
Sadly, I think that using the "console=uart,..." flag may have
caused the kernel to skip the bit of acpi probing that caused the
unaligned traps, as I don't see any "unaligned" messages in the
output so far ... so this might be a completely futile exercise.
-Tony
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] ACPI: fix vendor resource length computation
2006-02-15 19:05 [PATCH] ACPI: fix vendor resource length computation Luck, Tony
@ 2006-02-16 8:59 ` Thomas Renninger
0 siblings, 0 replies; 10+ messages in thread
From: Thomas Renninger @ 2006-02-16 8:59 UTC (permalink / raw)
To: Luck, Tony
Cc: Moore, Robert, Bjorn Helgaas, Andreas Schwab, Brown, Len,
linux-acpi, linux-ia64, Andrew Morton, efocht
Luck, Tony wrote:
>> I'm working on the alignment issue also, should be a fix this week.
>
> With Bjorn's tip on using console=uart,mmio,0x{address} I can now
> get a complete trace from boot using acpi_dbg_level = 0xffffff ...
> well in theory I can, I started the boot two days ago and have
> 2.2 million lines of output so far, and it is still going! Now
> I'm just curious as to whether this will actually complete, but
> if it doesn't do so in the next few days I'll have to abort the
> boot and get back to using that system for regression testing on
> other patches.
>
> Sadly, I think that using the "console=uart,..." flag may have
> caused the kernel to skip the bit of acpi probing that caused the
> unaligned traps, as I don't see any "unaligned" messages in the
> output so far ... so this might be a completely futile exercise.
>
Better don't use the boot parameters. Try to identify at which point
the culprit might lie and then embed the code you like to
debug in the sources into:
acpi_dbg_level=0xXY (whatever debug level, avoid mutex and other
unnecessary stuff you don't need)
... bad code to debug
acpi_dbg_level=0xF
I expect the output will never end, there will pop up an acpi interrupt
or some polling is done by ACPI and you are trapped in endless output...
Thomas
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH] ACPI: fix vendor resource length computation
@ 2006-02-16 22:54 Moore, Robert
0 siblings, 0 replies; 10+ messages in thread
From: Moore, Robert @ 2006-02-16 22:54 UTC (permalink / raw)
To: Thomas Renninger, Luck, Tony
Cc: Bjorn Helgaas, Andreas Schwab, Brown, Len, linux-acpi, linux-ia64,
Andrew Morton, efocht
I recently added a new interface to ACPICA to support this kind of
debugging. It enables/disables debug for a specific control method:
ACPI_STATUS
AcpiDebugTrace (
char *Name,
UINT32 DebugLevel,
UINT32 DebugLayer,
UINT32 Flags);
It would be nice to see this exposed in Linux somehow.
Bob
> -----Original Message-----
> From: Thomas Renninger [mailto:trenn@suse.de]
> Sent: Thursday, February 16, 2006 12:59 AM
> To: Luck, Tony
> Cc: Moore, Robert; Bjorn Helgaas; Andreas Schwab; Brown, Len; linux-
> acpi@vger.kernel.org; linux-ia64@vger.kernel.org; Andrew Morton;
> efocht@hpce.nec.com
> Subject: Re: [PATCH] ACPI: fix vendor resource length computation
>
> Luck, Tony wrote:
> >> I'm working on the alignment issue also, should be a fix this week.
> >
> > With Bjorn's tip on using console=uart,mmio,0x{address} I can now
> > get a complete trace from boot using acpi_dbg_level = 0xffffff ...
> > well in theory I can, I started the boot two days ago and have
> > 2.2 million lines of output so far, and it is still going! Now
> > I'm just curious as to whether this will actually complete, but
> > if it doesn't do so in the next few days I'll have to abort the
> > boot and get back to using that system for regression testing on
> > other patches.
> >
> > Sadly, I think that using the "console=uart,..." flag may have
> > caused the kernel to skip the bit of acpi probing that caused the
> > unaligned traps, as I don't see any "unaligned" messages in the
> > output so far ... so this might be a completely futile exercise.
> >
> Better don't use the boot parameters. Try to identify at which point
> the culprit might lie and then embed the code you like to
> debug in the sources into:
> acpi_dbg_level=0xXY (whatever debug level, avoid mutex and other
> unnecessary stuff you don't need)
> ... bad code to debug
>
> acpi_dbg_level=0xF
>
> I expect the output will never end, there will pop up an acpi
interrupt
> or some polling is done by ACPI and you are trapped in endless
output...
>
> Thomas
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2006-02-16 22:54 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-15 19:05 [PATCH] ACPI: fix vendor resource length computation Luck, Tony
2006-02-16 8:59 ` Thomas Renninger
-- strict thread matches above, loose matches on Subject: below --
2006-02-16 22:54 Moore, Robert
2006-02-15 18:38 Moore, Robert
2006-02-15 0:04 Moore, Robert
2006-02-15 17:49 ` Thomas Renninger
2006-02-14 23:25 Moore, Robert
2006-02-14 23:34 ` Bjorn Helgaas
2006-02-10 23:31 some new unaligned access while booting ia64 (HP rx2620) Moore, Robert
2006-02-13 22:57 ` Andreas Schwab
2006-02-14 0:22 ` Bjorn Helgaas
2006-02-14 23:13 ` [PATCH] ACPI: fix vendor resource length computation Bjorn Helgaas
2006-02-14 23:19 ` Bjorn Helgaas
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).