[PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a valid resource if buffer length too long

2017-11-22 Thread alexander . levin
From: Bob Moore 

[ Upstream commit 57707a9a7780fab426b8ae9b4c7b65b912a748b3 ]

ACPICA commit 9f76de2d249b18804e35fb55d14b1c2604d627a1
ACPICA commit b2e89d72ef1e9deefd63c3fd1dee90f893575b3a
ACPICA commit 23b5bbe6d78afd3c5abf3adb91a1b098a3000b2e

The declared buffer length must be the same as the length of the
byte initializer list, otherwise not a valid resource descriptor.

Link: https://github.com/acpica/acpica/commit/9f76de2d
Link: https://github.com/acpica/acpica/commit/b2e89d72
Link: https://github.com/acpica/acpica/commit/23b5bbe6
Signed-off-by: Bob Moore 
Signed-off-by: Lv Zheng 
Signed-off-by: Rafael J. Wysocki 
Signed-off-by: Sasha Levin 
---
 drivers/acpi/acpica/utresrc.c | 17 -
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/acpi/acpica/utresrc.c b/drivers/acpi/acpica/utresrc.c
index 1de3376da66a..2ad99ea3d496 100644
--- a/drivers/acpi/acpica/utresrc.c
+++ b/drivers/acpi/acpica/utresrc.c
@@ -421,8 +421,10 @@ acpi_ut_walk_aml_resources(struct acpi_walk_state 
*walk_state,
 
ACPI_FUNCTION_TRACE(ut_walk_aml_resources);
 
-   /* The absolute minimum resource template is one end_tag descriptor */
-
+   /*
+* The absolute minimum resource template is one end_tag descriptor.
+* However, we will treat a lone end_tag as just a simple buffer.
+*/
if (aml_length < sizeof(struct aml_resource_end_tag)) {
return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
}
@@ -454,9 +456,8 @@ acpi_ut_walk_aml_resources(struct acpi_walk_state 
*walk_state,
/* Invoke the user function */
 
if (user_function) {
-   status =
-   user_function(aml, length, offset, resource_index,
- context);
+   status = user_function(aml, length, offset,
+  resource_index, context);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -480,6 +481,12 @@ acpi_ut_walk_aml_resources(struct acpi_walk_state 
*walk_state,
*context = aml;
}
 
+   /* Check if buffer is defined to be longer than the 
resource length */
+
+   if (aml_length > (offset + length)) {
+   return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
+   }
+
/* Normal exit */
 
return_ACPI_STATUS(AE_OK);
-- 
2.11.0


[PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a valid resource if buffer length too long

2017-11-22 Thread alexander . levin
From: Bob Moore 

[ Upstream commit 57707a9a7780fab426b8ae9b4c7b65b912a748b3 ]

ACPICA commit 9f76de2d249b18804e35fb55d14b1c2604d627a1
ACPICA commit b2e89d72ef1e9deefd63c3fd1dee90f893575b3a
ACPICA commit 23b5bbe6d78afd3c5abf3adb91a1b098a3000b2e

The declared buffer length must be the same as the length of the
byte initializer list, otherwise not a valid resource descriptor.

Link: https://github.com/acpica/acpica/commit/9f76de2d
Link: https://github.com/acpica/acpica/commit/b2e89d72
Link: https://github.com/acpica/acpica/commit/23b5bbe6
Signed-off-by: Bob Moore 
Signed-off-by: Lv Zheng 
Signed-off-by: Rafael J. Wysocki 
Signed-off-by: Sasha Levin 
---
 drivers/acpi/acpica/utresrc.c | 17 -
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/acpi/acpica/utresrc.c b/drivers/acpi/acpica/utresrc.c
index 1de3376da66a..2ad99ea3d496 100644
--- a/drivers/acpi/acpica/utresrc.c
+++ b/drivers/acpi/acpica/utresrc.c
@@ -421,8 +421,10 @@ acpi_ut_walk_aml_resources(struct acpi_walk_state 
*walk_state,
 
ACPI_FUNCTION_TRACE(ut_walk_aml_resources);
 
-   /* The absolute minimum resource template is one end_tag descriptor */
-
+   /*
+* The absolute minimum resource template is one end_tag descriptor.
+* However, we will treat a lone end_tag as just a simple buffer.
+*/
if (aml_length < sizeof(struct aml_resource_end_tag)) {
return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
}
@@ -454,9 +456,8 @@ acpi_ut_walk_aml_resources(struct acpi_walk_state 
*walk_state,
/* Invoke the user function */
 
if (user_function) {
-   status =
-   user_function(aml, length, offset, resource_index,
- context);
+   status = user_function(aml, length, offset,
+  resource_index, context);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -480,6 +481,12 @@ acpi_ut_walk_aml_resources(struct acpi_walk_state 
*walk_state,
*context = aml;
}
 
+   /* Check if buffer is defined to be longer than the 
resource length */
+
+   if (aml_length > (offset + length)) {
+   return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
+   }
+
/* Normal exit */
 
return_ACPI_STATUS(AE_OK);
-- 
2.11.0


RE: [PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a valid resource if buffer length too long

2017-11-22 Thread alexander . levin
On Mon, Nov 20, 2017 at 05:22:37PM +, Schmauss, Erik wrote:
>> -Original Message-
>> From: alexander.le...@verizon.com [mailto:alexander.le...@verizon.com]
>> Sent: Thursday, November 16, 2017 4:56 PM
>> To: Schmauss, Erik 
>> Cc: Moore, Robert ; linux-kernel@vger.kernel.org;
>> sta...@vger.kernel.org; Wysocki, Rafael J 
>> Subject: RE: [PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a valid
>> resource if buffer length too long
>>
>> On Wed, Nov 15, 2017 at 05:05:21PM +, Schmauss, Erik wrote:
>> >
>> >
>> >> -Original Message-
>> >> From: alexander.le...@verizon.com
>> >> [mailto:alexander.le...@verizon.com]
>> >> Sent: Wednesday, November 15, 2017 8:39 AM
>> >> To: Moore, Robert 
>> >> Cc: linux-kernel@vger.kernel.org; sta...@vger.kernel.org; Wysocki,
>> >> Rafael J ; Schmauss, Erik
>> >> 
>> >> Subject: RE: [PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a
>> >> valid resource if buffer length too long
>> >>
>> >> On Wed, Nov 15, 2017 at 03:39:22PM +, Moore, Robert wrote:
>> >> >> -Original Message-
>> >> >> From: alexander.le...@verizon.com
>> >> >> [mailto:alexander.le...@verizon.com]
>> >> >> Sent: Tuesday, November 14, 2017 6:46 PM
>> >> >> To: linux-kernel@vger.kernel.org; sta...@vger.kernel.org
>> >> >> Cc: Moore, Robert ; Zheng, Lv
>> >> >> ; Wysocki, Rafael J
>> >> >> ; alexander.le...@verizon.com
>> >> >> Subject: [PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a
>> >> >> valid resource if buffer length too long
>> >> >>
>> >> >> From: Bob Moore 
>> >> >>
>> >> >> [ Upstream commit 57707a9a7780fab426b8ae9b4c7b65b912a748b3 ]
>> >> >>
>> >> >> ACPICA commit 9f76de2d249b18804e35fb55d14b1c2604d627a1
>> >> >> ACPICA commit b2e89d72ef1e9deefd63c3fd1dee90f893575b3a
>> >> >> ACPICA commit 23b5bbe6d78afd3c5abf3adb91a1b098a3000b2e
>> >> >>
>> >> >> The declared buffer length must be the same as the length of the
>> >> >> byte initializer list, otherwise not a valid resource descriptor.
>> >> [snip]
>> >>
>> >> >[Moore, Robert]
>> >> >
>> >> >Please explain what you are doing here.
>> >>
>> >> Proposing this commit for the 4.9 LTS tree.
>> >
>> >What problem are you trying to solve with this change? Are you seeing ACPI
>> errors? If so what are they?
>>
>> Not seeing an actual problem myself. Was this patch supposed to fix a problem
>> or just deal with a theoretical scenario?
>>
>This was supposed to fix issues with our AML disassembler to parse a strange 
>corner in the ASL test suite. I believe this was due to the end tag contains a 
>checksum byte that ACPICA and other ACPI implementations ignore. We thought 
>this was useful in the test suite because we test the disassembler by 
>comparing normally compiled AML with AML that has been compiled, disassembled, 
>and re-compiled. Without this change, the endtag checksum would be 
>over-written to 0 rather than the existing value.
>
>I believe this change broke a few things such as the execution of 
>ConcatResTemplate. We concluded to not use this solution and alter the test 
>suite instead because this endtag byte is usually ignored anyway. To answer 
>your question, this was to deal with a theoretical scenario.

I'll drop it then, thanks Erik!

-- 

Thanks,
Sasha

RE: [PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a valid resource if buffer length too long

2017-11-22 Thread alexander . levin
On Mon, Nov 20, 2017 at 05:22:37PM +, Schmauss, Erik wrote:
>> -Original Message-
>> From: alexander.le...@verizon.com [mailto:alexander.le...@verizon.com]
>> Sent: Thursday, November 16, 2017 4:56 PM
>> To: Schmauss, Erik 
>> Cc: Moore, Robert ; linux-kernel@vger.kernel.org;
>> sta...@vger.kernel.org; Wysocki, Rafael J 
>> Subject: RE: [PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a valid
>> resource if buffer length too long
>>
>> On Wed, Nov 15, 2017 at 05:05:21PM +, Schmauss, Erik wrote:
>> >
>> >
>> >> -Original Message-
>> >> From: alexander.le...@verizon.com
>> >> [mailto:alexander.le...@verizon.com]
>> >> Sent: Wednesday, November 15, 2017 8:39 AM
>> >> To: Moore, Robert 
>> >> Cc: linux-kernel@vger.kernel.org; sta...@vger.kernel.org; Wysocki,
>> >> Rafael J ; Schmauss, Erik
>> >> 
>> >> Subject: RE: [PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a
>> >> valid resource if buffer length too long
>> >>
>> >> On Wed, Nov 15, 2017 at 03:39:22PM +, Moore, Robert wrote:
>> >> >> -Original Message-
>> >> >> From: alexander.le...@verizon.com
>> >> >> [mailto:alexander.le...@verizon.com]
>> >> >> Sent: Tuesday, November 14, 2017 6:46 PM
>> >> >> To: linux-kernel@vger.kernel.org; sta...@vger.kernel.org
>> >> >> Cc: Moore, Robert ; Zheng, Lv
>> >> >> ; Wysocki, Rafael J
>> >> >> ; alexander.le...@verizon.com
>> >> >> Subject: [PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a
>> >> >> valid resource if buffer length too long
>> >> >>
>> >> >> From: Bob Moore 
>> >> >>
>> >> >> [ Upstream commit 57707a9a7780fab426b8ae9b4c7b65b912a748b3 ]
>> >> >>
>> >> >> ACPICA commit 9f76de2d249b18804e35fb55d14b1c2604d627a1
>> >> >> ACPICA commit b2e89d72ef1e9deefd63c3fd1dee90f893575b3a
>> >> >> ACPICA commit 23b5bbe6d78afd3c5abf3adb91a1b098a3000b2e
>> >> >>
>> >> >> The declared buffer length must be the same as the length of the
>> >> >> byte initializer list, otherwise not a valid resource descriptor.
>> >> [snip]
>> >>
>> >> >[Moore, Robert]
>> >> >
>> >> >Please explain what you are doing here.
>> >>
>> >> Proposing this commit for the 4.9 LTS tree.
>> >
>> >What problem are you trying to solve with this change? Are you seeing ACPI
>> errors? If so what are they?
>>
>> Not seeing an actual problem myself. Was this patch supposed to fix a problem
>> or just deal with a theoretical scenario?
>>
>This was supposed to fix issues with our AML disassembler to parse a strange 
>corner in the ASL test suite. I believe this was due to the end tag contains a 
>checksum byte that ACPICA and other ACPI implementations ignore. We thought 
>this was useful in the test suite because we test the disassembler by 
>comparing normally compiled AML with AML that has been compiled, disassembled, 
>and re-compiled. Without this change, the endtag checksum would be 
>over-written to 0 rather than the existing value.
>
>I believe this change broke a few things such as the execution of 
>ConcatResTemplate. We concluded to not use this solution and alter the test 
>suite instead because this endtag byte is usually ignored anyway. To answer 
>your question, this was to deal with a theoretical scenario.

I'll drop it then, thanks Erik!

-- 

Thanks,
Sasha

RE: [PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a valid resource if buffer length too long

2017-11-20 Thread Schmauss, Erik


> -Original Message-
> From: alexander.le...@verizon.com [mailto:alexander.le...@verizon.com]
> Sent: Thursday, November 16, 2017 4:56 PM
> To: Schmauss, Erik 
> Cc: Moore, Robert ; linux-kernel@vger.kernel.org;
> sta...@vger.kernel.org; Wysocki, Rafael J 
> Subject: RE: [PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a valid
> resource if buffer length too long
> 
> On Wed, Nov 15, 2017 at 05:05:21PM +, Schmauss, Erik wrote:
> >
> >
> >> -Original Message-
> >> From: alexander.le...@verizon.com
> >> [mailto:alexander.le...@verizon.com]
> >> Sent: Wednesday, November 15, 2017 8:39 AM
> >> To: Moore, Robert 
> >> Cc: linux-kernel@vger.kernel.org; sta...@vger.kernel.org; Wysocki,
> >> Rafael J ; Schmauss, Erik
> >> 
> >> Subject: RE: [PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a
> >> valid resource if buffer length too long
> >>
> >> On Wed, Nov 15, 2017 at 03:39:22PM +, Moore, Robert wrote:
> >> >> -Original Message-
> >> >> From: alexander.le...@verizon.com
> >> >> [mailto:alexander.le...@verizon.com]
> >> >> Sent: Tuesday, November 14, 2017 6:46 PM
> >> >> To: linux-kernel@vger.kernel.org; sta...@vger.kernel.org
> >> >> Cc: Moore, Robert ; Zheng, Lv
> >> >> ; Wysocki, Rafael J
> >> >> ; alexander.le...@verizon.com
> >> >> Subject: [PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a
> >> >> valid resource if buffer length too long
> >> >>
> >> >> From: Bob Moore 
> >> >>
> >> >> [ Upstream commit 57707a9a7780fab426b8ae9b4c7b65b912a748b3 ]
> >> >>
> >> >> ACPICA commit 9f76de2d249b18804e35fb55d14b1c2604d627a1
> >> >> ACPICA commit b2e89d72ef1e9deefd63c3fd1dee90f893575b3a
> >> >> ACPICA commit 23b5bbe6d78afd3c5abf3adb91a1b098a3000b2e
> >> >>
> >> >> The declared buffer length must be the same as the length of the
> >> >> byte initializer list, otherwise not a valid resource descriptor.
> >> [snip]
> >>
> >> >[Moore, Robert]
> >> >
> >> >Please explain what you are doing here.
> >>
> >> Proposing this commit for the 4.9 LTS tree.
> >
> >What problem are you trying to solve with this change? Are you seeing ACPI
> errors? If so what are they?
> 
> Not seeing an actual problem myself. Was this patch supposed to fix a problem
> or just deal with a theoretical scenario?
> 
This was supposed to fix issues with our AML disassembler to parse a strange 
corner in the ASL test suite. I believe this was due to the end tag contains a 
checksum byte that ACPICA and other ACPI implementations ignore. We thought 
this was useful in the test suite because we test the disassembler by comparing 
normally compiled AML with AML that has been compiled, disassembled, and 
re-compiled. Without this change, the endtag checksum would be over-written to 
0 rather than the existing value.

I believe this change broke a few things such as the execution of 
ConcatResTemplate. We concluded to not use this solution and alter the test 
suite instead because this endtag byte is usually ignored anyway. To answer 
your question, this was to deal with a theoretical scenario.

Erik
> --
> 
> Thanks,
> Sasha


RE: [PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a valid resource if buffer length too long

2017-11-20 Thread Schmauss, Erik


> -Original Message-
> From: alexander.le...@verizon.com [mailto:alexander.le...@verizon.com]
> Sent: Thursday, November 16, 2017 4:56 PM
> To: Schmauss, Erik 
> Cc: Moore, Robert ; linux-kernel@vger.kernel.org;
> sta...@vger.kernel.org; Wysocki, Rafael J 
> Subject: RE: [PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a valid
> resource if buffer length too long
> 
> On Wed, Nov 15, 2017 at 05:05:21PM +, Schmauss, Erik wrote:
> >
> >
> >> -Original Message-
> >> From: alexander.le...@verizon.com
> >> [mailto:alexander.le...@verizon.com]
> >> Sent: Wednesday, November 15, 2017 8:39 AM
> >> To: Moore, Robert 
> >> Cc: linux-kernel@vger.kernel.org; sta...@vger.kernel.org; Wysocki,
> >> Rafael J ; Schmauss, Erik
> >> 
> >> Subject: RE: [PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a
> >> valid resource if buffer length too long
> >>
> >> On Wed, Nov 15, 2017 at 03:39:22PM +, Moore, Robert wrote:
> >> >> -Original Message-
> >> >> From: alexander.le...@verizon.com
> >> >> [mailto:alexander.le...@verizon.com]
> >> >> Sent: Tuesday, November 14, 2017 6:46 PM
> >> >> To: linux-kernel@vger.kernel.org; sta...@vger.kernel.org
> >> >> Cc: Moore, Robert ; Zheng, Lv
> >> >> ; Wysocki, Rafael J
> >> >> ; alexander.le...@verizon.com
> >> >> Subject: [PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a
> >> >> valid resource if buffer length too long
> >> >>
> >> >> From: Bob Moore 
> >> >>
> >> >> [ Upstream commit 57707a9a7780fab426b8ae9b4c7b65b912a748b3 ]
> >> >>
> >> >> ACPICA commit 9f76de2d249b18804e35fb55d14b1c2604d627a1
> >> >> ACPICA commit b2e89d72ef1e9deefd63c3fd1dee90f893575b3a
> >> >> ACPICA commit 23b5bbe6d78afd3c5abf3adb91a1b098a3000b2e
> >> >>
> >> >> The declared buffer length must be the same as the length of the
> >> >> byte initializer list, otherwise not a valid resource descriptor.
> >> [snip]
> >>
> >> >[Moore, Robert]
> >> >
> >> >Please explain what you are doing here.
> >>
> >> Proposing this commit for the 4.9 LTS tree.
> >
> >What problem are you trying to solve with this change? Are you seeing ACPI
> errors? If so what are they?
> 
> Not seeing an actual problem myself. Was this patch supposed to fix a problem
> or just deal with a theoretical scenario?
> 
This was supposed to fix issues with our AML disassembler to parse a strange 
corner in the ASL test suite. I believe this was due to the end tag contains a 
checksum byte that ACPICA and other ACPI implementations ignore. We thought 
this was useful in the test suite because we test the disassembler by comparing 
normally compiled AML with AML that has been compiled, disassembled, and 
re-compiled. Without this change, the endtag checksum would be over-written to 
0 rather than the existing value.

I believe this change broke a few things such as the execution of 
ConcatResTemplate. We concluded to not use this solution and alter the test 
suite instead because this endtag byte is usually ignored anyway. To answer 
your question, this was to deal with a theoretical scenario.

Erik
> --
> 
> Thanks,
> Sasha


RE: [PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a valid resource if buffer length too long

2017-11-16 Thread alexander . levin
On Wed, Nov 15, 2017 at 05:05:21PM +, Schmauss, Erik wrote:
>
>
>> -Original Message-
>> From: alexander.le...@verizon.com [mailto:alexander.le...@verizon.com]
>> Sent: Wednesday, November 15, 2017 8:39 AM
>> To: Moore, Robert 
>> Cc: linux-kernel@vger.kernel.org; sta...@vger.kernel.org; Wysocki, Rafael J
>> ; Schmauss, Erik 
>> Subject: RE: [PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a valid
>> resource if buffer length too long
>>
>> On Wed, Nov 15, 2017 at 03:39:22PM +, Moore, Robert wrote:
>> >> -Original Message-
>> >> From: alexander.le...@verizon.com
>> >> [mailto:alexander.le...@verizon.com]
>> >> Sent: Tuesday, November 14, 2017 6:46 PM
>> >> To: linux-kernel@vger.kernel.org; sta...@vger.kernel.org
>> >> Cc: Moore, Robert ; Zheng, Lv
>> >> ; Wysocki, Rafael J ;
>> >> alexander.le...@verizon.com
>> >> Subject: [PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a valid
>> >> resource if buffer length too long
>> >>
>> >> From: Bob Moore 
>> >>
>> >> [ Upstream commit 57707a9a7780fab426b8ae9b4c7b65b912a748b3 ]
>> >>
>> >> ACPICA commit 9f76de2d249b18804e35fb55d14b1c2604d627a1
>> >> ACPICA commit b2e89d72ef1e9deefd63c3fd1dee90f893575b3a
>> >> ACPICA commit 23b5bbe6d78afd3c5abf3adb91a1b098a3000b2e
>> >>
>> >> The declared buffer length must be the same as the length of the byte
>> >> initializer list, otherwise not a valid resource descriptor.
>> [snip]
>>
>> >[Moore, Robert]
>> >
>> >Please explain what you are doing here.
>>
>> Proposing this commit for the 4.9 LTS tree.
>
>What problem are you trying to solve with this change? Are you seeing ACPI 
>errors? If so what are they?

Not seeing an actual problem myself. Was this patch supposed to fix a
problem or just deal with a theoretical scenario?

-- 

Thanks,
Sasha

RE: [PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a valid resource if buffer length too long

2017-11-16 Thread alexander . levin
On Wed, Nov 15, 2017 at 05:05:21PM +, Schmauss, Erik wrote:
>
>
>> -Original Message-
>> From: alexander.le...@verizon.com [mailto:alexander.le...@verizon.com]
>> Sent: Wednesday, November 15, 2017 8:39 AM
>> To: Moore, Robert 
>> Cc: linux-kernel@vger.kernel.org; sta...@vger.kernel.org; Wysocki, Rafael J
>> ; Schmauss, Erik 
>> Subject: RE: [PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a valid
>> resource if buffer length too long
>>
>> On Wed, Nov 15, 2017 at 03:39:22PM +, Moore, Robert wrote:
>> >> -Original Message-
>> >> From: alexander.le...@verizon.com
>> >> [mailto:alexander.le...@verizon.com]
>> >> Sent: Tuesday, November 14, 2017 6:46 PM
>> >> To: linux-kernel@vger.kernel.org; sta...@vger.kernel.org
>> >> Cc: Moore, Robert ; Zheng, Lv
>> >> ; Wysocki, Rafael J ;
>> >> alexander.le...@verizon.com
>> >> Subject: [PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a valid
>> >> resource if buffer length too long
>> >>
>> >> From: Bob Moore 
>> >>
>> >> [ Upstream commit 57707a9a7780fab426b8ae9b4c7b65b912a748b3 ]
>> >>
>> >> ACPICA commit 9f76de2d249b18804e35fb55d14b1c2604d627a1
>> >> ACPICA commit b2e89d72ef1e9deefd63c3fd1dee90f893575b3a
>> >> ACPICA commit 23b5bbe6d78afd3c5abf3adb91a1b098a3000b2e
>> >>
>> >> The declared buffer length must be the same as the length of the byte
>> >> initializer list, otherwise not a valid resource descriptor.
>> [snip]
>>
>> >[Moore, Robert]
>> >
>> >Please explain what you are doing here.
>>
>> Proposing this commit for the 4.9 LTS tree.
>
>What problem are you trying to solve with this change? Are you seeing ACPI 
>errors? If so what are they?

Not seeing an actual problem myself. Was this patch supposed to fix a
problem or just deal with a theoretical scenario?

-- 

Thanks,
Sasha

RE: [PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a valid resource if buffer length too long

2017-11-15 Thread Schmauss, Erik


> -Original Message-
> From: alexander.le...@verizon.com [mailto:alexander.le...@verizon.com]
> Sent: Wednesday, November 15, 2017 8:39 AM
> To: Moore, Robert 
> Cc: linux-kernel@vger.kernel.org; sta...@vger.kernel.org; Wysocki, Rafael J
> ; Schmauss, Erik 
> Subject: RE: [PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a valid
> resource if buffer length too long
> 
> On Wed, Nov 15, 2017 at 03:39:22PM +, Moore, Robert wrote:
> >> -Original Message-
> >> From: alexander.le...@verizon.com
> >> [mailto:alexander.le...@verizon.com]
> >> Sent: Tuesday, November 14, 2017 6:46 PM
> >> To: linux-kernel@vger.kernel.org; sta...@vger.kernel.org
> >> Cc: Moore, Robert ; Zheng, Lv
> >> ; Wysocki, Rafael J ;
> >> alexander.le...@verizon.com
> >> Subject: [PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a valid
> >> resource if buffer length too long
> >>
> >> From: Bob Moore 
> >>
> >> [ Upstream commit 57707a9a7780fab426b8ae9b4c7b65b912a748b3 ]
> >>
> >> ACPICA commit 9f76de2d249b18804e35fb55d14b1c2604d627a1
> >> ACPICA commit b2e89d72ef1e9deefd63c3fd1dee90f893575b3a
> >> ACPICA commit 23b5bbe6d78afd3c5abf3adb91a1b098a3000b2e
> >>
> >> The declared buffer length must be the same as the length of the byte
> >> initializer list, otherwise not a valid resource descriptor.
> [snip]
> 
> >[Moore, Robert]
> >
> >Please explain what you are doing here.
> 
> Proposing this commit for the 4.9 LTS tree.

What problem are you trying to solve with this change? Are you seeing ACPI 
errors? If so what are they?

> 
> --
> 
> Thanks,
> Sasha


RE: [PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a valid resource if buffer length too long

2017-11-15 Thread Schmauss, Erik


> -Original Message-
> From: alexander.le...@verizon.com [mailto:alexander.le...@verizon.com]
> Sent: Wednesday, November 15, 2017 8:39 AM
> To: Moore, Robert 
> Cc: linux-kernel@vger.kernel.org; sta...@vger.kernel.org; Wysocki, Rafael J
> ; Schmauss, Erik 
> Subject: RE: [PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a valid
> resource if buffer length too long
> 
> On Wed, Nov 15, 2017 at 03:39:22PM +, Moore, Robert wrote:
> >> -Original Message-
> >> From: alexander.le...@verizon.com
> >> [mailto:alexander.le...@verizon.com]
> >> Sent: Tuesday, November 14, 2017 6:46 PM
> >> To: linux-kernel@vger.kernel.org; sta...@vger.kernel.org
> >> Cc: Moore, Robert ; Zheng, Lv
> >> ; Wysocki, Rafael J ;
> >> alexander.le...@verizon.com
> >> Subject: [PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a valid
> >> resource if buffer length too long
> >>
> >> From: Bob Moore 
> >>
> >> [ Upstream commit 57707a9a7780fab426b8ae9b4c7b65b912a748b3 ]
> >>
> >> ACPICA commit 9f76de2d249b18804e35fb55d14b1c2604d627a1
> >> ACPICA commit b2e89d72ef1e9deefd63c3fd1dee90f893575b3a
> >> ACPICA commit 23b5bbe6d78afd3c5abf3adb91a1b098a3000b2e
> >>
> >> The declared buffer length must be the same as the length of the byte
> >> initializer list, otherwise not a valid resource descriptor.
> [snip]
> 
> >[Moore, Robert]
> >
> >Please explain what you are doing here.
> 
> Proposing this commit for the 4.9 LTS tree.

What problem are you trying to solve with this change? Are you seeing ACPI 
errors? If so what are they?

> 
> --
> 
> Thanks,
> Sasha


RE: [PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a valid resource if buffer length too long

2017-11-15 Thread alexander . levin
On Wed, Nov 15, 2017 at 03:39:22PM +, Moore, Robert wrote:
>> -Original Message-
>> From: alexander.le...@verizon.com [mailto:alexander.le...@verizon.com]
>> Sent: Tuesday, November 14, 2017 6:46 PM
>> To: linux-kernel@vger.kernel.org; sta...@vger.kernel.org
>> Cc: Moore, Robert ; Zheng, Lv
>> ; Wysocki, Rafael J ;
>> alexander.le...@verizon.com
>> Subject: [PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a valid
>> resource if buffer length too long
>>
>> From: Bob Moore 
>>
>> [ Upstream commit 57707a9a7780fab426b8ae9b4c7b65b912a748b3 ]
>>
>> ACPICA commit 9f76de2d249b18804e35fb55d14b1c2604d627a1
>> ACPICA commit b2e89d72ef1e9deefd63c3fd1dee90f893575b3a
>> ACPICA commit 23b5bbe6d78afd3c5abf3adb91a1b098a3000b2e
>>
>> The declared buffer length must be the same as the length of the byte
>> initializer list, otherwise not a valid resource descriptor.
[snip]

>[Moore, Robert]
>
>Please explain what you are doing here.

Proposing this commit for the 4.9 LTS tree.

-- 

Thanks,
Sasha

RE: [PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a valid resource if buffer length too long

2017-11-15 Thread alexander . levin
On Wed, Nov 15, 2017 at 03:39:22PM +, Moore, Robert wrote:
>> -Original Message-
>> From: alexander.le...@verizon.com [mailto:alexander.le...@verizon.com]
>> Sent: Tuesday, November 14, 2017 6:46 PM
>> To: linux-kernel@vger.kernel.org; sta...@vger.kernel.org
>> Cc: Moore, Robert ; Zheng, Lv
>> ; Wysocki, Rafael J ;
>> alexander.le...@verizon.com
>> Subject: [PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a valid
>> resource if buffer length too long
>>
>> From: Bob Moore 
>>
>> [ Upstream commit 57707a9a7780fab426b8ae9b4c7b65b912a748b3 ]
>>
>> ACPICA commit 9f76de2d249b18804e35fb55d14b1c2604d627a1
>> ACPICA commit b2e89d72ef1e9deefd63c3fd1dee90f893575b3a
>> ACPICA commit 23b5bbe6d78afd3c5abf3adb91a1b098a3000b2e
>>
>> The declared buffer length must be the same as the length of the byte
>> initializer list, otherwise not a valid resource descriptor.
[snip]

>[Moore, Robert]
>
>Please explain what you are doing here.

Proposing this commit for the 4.9 LTS tree.

-- 

Thanks,
Sasha

[PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a valid resource if buffer length too long

2017-11-14 Thread alexander . levin
From: Bob Moore 

[ Upstream commit 57707a9a7780fab426b8ae9b4c7b65b912a748b3 ]

ACPICA commit 9f76de2d249b18804e35fb55d14b1c2604d627a1
ACPICA commit b2e89d72ef1e9deefd63c3fd1dee90f893575b3a
ACPICA commit 23b5bbe6d78afd3c5abf3adb91a1b098a3000b2e

The declared buffer length must be the same as the length of the
byte initializer list, otherwise not a valid resource descriptor.

Link: https://github.com/acpica/acpica/commit/9f76de2d
Link: https://github.com/acpica/acpica/commit/b2e89d72
Link: https://github.com/acpica/acpica/commit/23b5bbe6
Signed-off-by: Bob Moore 
Signed-off-by: Lv Zheng 
Signed-off-by: Rafael J. Wysocki 
Signed-off-by: Sasha Levin 
---
 drivers/acpi/acpica/utresrc.c | 17 -
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/acpi/acpica/utresrc.c b/drivers/acpi/acpica/utresrc.c
index 1de3376da66a..2ad99ea3d496 100644
--- a/drivers/acpi/acpica/utresrc.c
+++ b/drivers/acpi/acpica/utresrc.c
@@ -421,8 +421,10 @@ acpi_ut_walk_aml_resources(struct acpi_walk_state 
*walk_state,
 
ACPI_FUNCTION_TRACE(ut_walk_aml_resources);
 
-   /* The absolute minimum resource template is one end_tag descriptor */
-
+   /*
+* The absolute minimum resource template is one end_tag descriptor.
+* However, we will treat a lone end_tag as just a simple buffer.
+*/
if (aml_length < sizeof(struct aml_resource_end_tag)) {
return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
}
@@ -454,9 +456,8 @@ acpi_ut_walk_aml_resources(struct acpi_walk_state 
*walk_state,
/* Invoke the user function */
 
if (user_function) {
-   status =
-   user_function(aml, length, offset, resource_index,
- context);
+   status = user_function(aml, length, offset,
+  resource_index, context);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -480,6 +481,12 @@ acpi_ut_walk_aml_resources(struct acpi_walk_state 
*walk_state,
*context = aml;
}
 
+   /* Check if buffer is defined to be longer than the 
resource length */
+
+   if (aml_length > (offset + length)) {
+   return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
+   }
+
/* Normal exit */
 
return_ACPI_STATUS(AE_OK);
-- 
2.11.0


[PATCH AUTOSEL for 4.9 01/56] ACPICA: Resources: Not a valid resource if buffer length too long

2017-11-14 Thread alexander . levin
From: Bob Moore 

[ Upstream commit 57707a9a7780fab426b8ae9b4c7b65b912a748b3 ]

ACPICA commit 9f76de2d249b18804e35fb55d14b1c2604d627a1
ACPICA commit b2e89d72ef1e9deefd63c3fd1dee90f893575b3a
ACPICA commit 23b5bbe6d78afd3c5abf3adb91a1b098a3000b2e

The declared buffer length must be the same as the length of the
byte initializer list, otherwise not a valid resource descriptor.

Link: https://github.com/acpica/acpica/commit/9f76de2d
Link: https://github.com/acpica/acpica/commit/b2e89d72
Link: https://github.com/acpica/acpica/commit/23b5bbe6
Signed-off-by: Bob Moore 
Signed-off-by: Lv Zheng 
Signed-off-by: Rafael J. Wysocki 
Signed-off-by: Sasha Levin 
---
 drivers/acpi/acpica/utresrc.c | 17 -
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/acpi/acpica/utresrc.c b/drivers/acpi/acpica/utresrc.c
index 1de3376da66a..2ad99ea3d496 100644
--- a/drivers/acpi/acpica/utresrc.c
+++ b/drivers/acpi/acpica/utresrc.c
@@ -421,8 +421,10 @@ acpi_ut_walk_aml_resources(struct acpi_walk_state 
*walk_state,
 
ACPI_FUNCTION_TRACE(ut_walk_aml_resources);
 
-   /* The absolute minimum resource template is one end_tag descriptor */
-
+   /*
+* The absolute minimum resource template is one end_tag descriptor.
+* However, we will treat a lone end_tag as just a simple buffer.
+*/
if (aml_length < sizeof(struct aml_resource_end_tag)) {
return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
}
@@ -454,9 +456,8 @@ acpi_ut_walk_aml_resources(struct acpi_walk_state 
*walk_state,
/* Invoke the user function */
 
if (user_function) {
-   status =
-   user_function(aml, length, offset, resource_index,
- context);
+   status = user_function(aml, length, offset,
+  resource_index, context);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -480,6 +481,12 @@ acpi_ut_walk_aml_resources(struct acpi_walk_state 
*walk_state,
*context = aml;
}
 
+   /* Check if buffer is defined to be longer than the 
resource length */
+
+   if (aml_length > (offset + length)) {
+   return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
+   }
+
/* Normal exit */
 
return_ACPI_STATUS(AE_OK);
-- 
2.11.0