linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] acpi: acpica: fix acpi operand cache leak
@ 2017-02-12  2:49 Seunghun Han
  2017-02-12  3:55 ` kbuild test robot
  0 siblings, 1 reply; 5+ messages in thread
From: Seunghun Han @ 2017-02-12  2:49 UTC (permalink / raw)
  To: lv.zheng; +Cc: robert.moore, rafael.j.wysocki, linux-kernel, Seunghun Han

I'm Seunghun Han, and I work for National Security Research Institute of
South Korea.

I have been doing a research on ACPI and making a handcrafted ACPI table
for my research.
Errors of handcrafted ACPI tables are handled well in Linux kernel while boot
process, and Linux kernel goes well without critical problems.
But I found some ACPI operand cache leaks in ACPI early abort cases.

Boot log of ACPI operand cache leak is as follows:
>[    0.174332] ACPI: Added _OSI(Module Device)
>[    0.175504] ACPI: Added _OSI(Processor Device)
>[    0.176010] ACPI: Added _OSI(3.0 _SCP Extensions)
>[    0.177032] ACPI: Added _OSI(Processor Aggregator Device)
>[    0.178284] ACPI: SCI (IRQ16705) allocation failed
>[    0.179352] ACPI Exception: AE_NOT_ACQUIRED, Unable to install System Control Interrupt handler (20160930/evevent-131)
>[    0.180008] ACPI: Unable to start the ACPI Interpreter
>[    0.181125] ACPI Error: Could not remove SCI handler (20160930/evmisc-281)
>[    0.184068] kmem_cache_destroy Acpi-Operand: Slab cache still has objects
>[    0.185358] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.10.0-rc3 #2
>[    0.186820] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
>[    0.188000] Call Trace:
>[    0.188000]  ? dump_stack+0x5c/0x7d
>[    0.188000]  ? kmem_cache_destroy+0x224/0x230
>[    0.188000]  ? acpi_sleep_proc_init+0x22/0x22
>[    0.188000]  ? acpi_os_delete_cache+0xa/0xd
>[    0.188000]  ? acpi_ut_delete_caches+0x3f/0x7b
>[    0.188000]  ? acpi_terminate+0x5/0xf
>[    0.188000]  ? acpi_init+0x288/0x32e
>[    0.188000]  ? __class_create+0x4c/0x80
>[    0.188000]  ? video_setup+0x7a/0x7a
>[    0.188000]  ? do_one_initcall+0x4e/0x1b0
>[    0.188000]  ? kernel_init_freeable+0x194/0x21a
>[    0.188000]  ? rest_init+0x80/0x80
>[    0.188000]  ? kernel_init+0xa/0x100
>[    0.188000]  ? ret_from_fork+0x25/0x30

When early abort is occurred due to invalid ACPI information, Linux kernel
terminates ACPI by calling acpi_terminate() function.
The function calls acpi_ns_terminate() function to delete namespace data
and ACPI operand cache (acpi_gbl_module_code_list).

But the deletion code in acpi_ns_terminate() function is wrapped in
ACPI_EXEC_APP definition, therefore the code is only executed when the
definition exists.
If the define doesn't exist, ACPI operand cache (acpi_gbl_module_code_list) is
leaked, and stack dump is shown in kernel log.

This causes a security threat because the old kernel (<= 4.9) shows memory
locations of kernel functions in stack dump, therefore kernel ASLR can be
neutralized.

To fix ACPI operand leak for enhancing security, I made a patch which removes
the ACPI_EXEC_APP define in acpi_ns_terminate() function for executing the
deletion code unconditionally.

I hope that this patch improves the security of Linux kernel.

Thank you.

Signed-off-by: Seunghun Han <kkamagui@gmail.com>
---
 drivers/acpi/acpica/nsutils.c | 26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/drivers/acpi/acpica/nsutils.c b/drivers/acpi/acpica/nsutils.c
index 691814d..acb6099 100644
--- a/drivers/acpi/acpica/nsutils.c
+++ b/drivers/acpi/acpica/nsutils.c
@@ -597,22 +597,18 @@ void acpi_ns_terminate(void)
 
 	ACPI_FUNCTION_TRACE(ns_terminate);
 
-#ifdef ACPI_EXEC_APP
-	{
-		union acpi_operand_object *prev;
-		union acpi_operand_object *next;
-
-		/* Delete any module-level code blocks */
-
-		next = acpi_gbl_module_code_list;
-		while (next) {
-			prev = next;
-			next = next->method.mutex;
-			prev->method.mutex = NULL;	/* Clear the Mutex (cheated) field */
-			acpi_ut_remove_reference(prev);
-		}
+	union acpi_operand_object *prev;
+	union acpi_operand_object *next;
+
+	/* Delete any module-level code blocks */
+
+	next = acpi_gbl_module_code_list;
+	while (next) {
+		prev = next;
+		next = next->method.mutex;
+		prev->method.mutex = NULL;	/* Clear the Mutex (cheated) field */
+		acpi_ut_remove_reference(prev);
 	}
-#endif
 
 	/*
 	 * Free the entire namespace -- all nodes and all objects
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] acpi: acpica: fix acpi operand cache leak
  2017-02-12  2:49 [PATCH] acpi: acpica: fix acpi operand cache leak Seunghun Han
@ 2017-02-12  3:55 ` kbuild test robot
  2017-02-14 22:35   ` Moore, Robert
  0 siblings, 1 reply; 5+ messages in thread
From: kbuild test robot @ 2017-02-12  3:55 UTC (permalink / raw)
  To: Seunghun Han
  Cc: kbuild-all, lv.zheng, robert.moore, rafael.j.wysocki,
	linux-kernel, Seunghun Han

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

Hi Seunghun,

[auto build test WARNING on pm/linux-next]
[also build test WARNING on v4.10-rc7 next-20170210]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Seunghun-Han/acpi-acpica-fix-acpi-operand-cache-leak/20170212-105735
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: i386-randconfig-x003-201707 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   drivers/acpi/acpica/nsutils.c: In function 'acpi_ns_terminate':
>> drivers/acpi/acpica/nsutils.c:600:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     union acpi_operand_object *prev;
     ^~~~~

vim +600 drivers/acpi/acpica/nsutils.c

^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  584   * FUNCTION:    acpi_ns_terminate
^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  585   *
^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  586   * PARAMETERS:  none
^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  587   *
^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  588   * RETURN:      none
^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  589   *
44f6c012 drivers/acpi/namespace/nsutils.c Robert Moore   2005-04-18  590   * DESCRIPTION: free memory allocated for namespace and ACPI table storage.
^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  591   *
^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  592   ******************************************************************************/
^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  593  
4be44fcd drivers/acpi/namespace/nsutils.c Len Brown      2005-08-05  594  void acpi_ns_terminate(void)
^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  595  {
3f69fe15 drivers/acpi/acpica/nsutils.c    Bob Moore      2013-11-21  596  	acpi_status status;
^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  597  
b229cf92 drivers/acpi/namespace/nsutils.c Bob Moore      2006-04-21  598  	ACPI_FUNCTION_TRACE(ns_terminate);
^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  599  
25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25 @600  	union acpi_operand_object *prev;
25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25  601  	union acpi_operand_object *next;
25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25  602  
25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25  603  	/* Delete any module-level code blocks */
25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25  604  
25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25  605  	next = acpi_gbl_module_code_list;
25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25  606  	while (next) {
25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25  607  		prev = next;
25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25  608  		next = next->method.mutex;

:::::: The code at line 600 was first introduced by commit
:::::: 25823e784aac78964ada0e49efe2766d2aeb9fa4 ACPICA: Add additional debug info/statements

:::::: TO: Bob Moore <robert.moore@intel.com>
:::::: CC: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 27877 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] acpi: acpica: fix acpi operand cache leak
  2017-02-12  3:55 ` kbuild test robot
@ 2017-02-14 22:35   ` Moore, Robert
  2017-02-14 23:19     ` Seung Hun Han
  0 siblings, 1 reply; 5+ messages in thread
From: Moore, Robert @ 2017-02-14 22:35 UTC (permalink / raw)
  To: lkp, Seunghun Han
  Cc: kbuild-all, Zheng, Lv, Wysocki, Rafael J, linux-kernel, Seunghun Han

I'm sure we would like to backport the memory leak into ACPICA code.

Not sure about the warnings.

> -----Original Message-----
> From: lkp
> Sent: Saturday, February 11, 2017 7:56 PM
> To: Seunghun Han <kkamagui@gmail.com>
> Cc: kbuild-all@01.org; Zheng, Lv <lv.zheng@intel.com>; Moore, Robert
> <robert.moore@intel.com>; Wysocki, Rafael J
> <rafael.j.wysocki@intel.com>; linux-kernel@vger.kernel.org; Seunghun Han
> <kkamagui@gmail.com>
> Subject: Re: [PATCH] acpi: acpica: fix acpi operand cache leak
> 
> Hi Seunghun,
> 
> [auto build test WARNING on pm/linux-next] [also build test WARNING on
> v4.10-rc7 next-20170210] [if your patch is applied to the wrong git
> tree, please drop us a note to help improve the system]
> 
> url:    https://github.com/0day-ci/linux/commits/Seunghun-Han/acpi-
> acpica-fix-acpi-operand-cache-leak/20170212-105735
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-
> pm.git linux-next
> config: i386-randconfig-x003-201707 (attached as .config)
> compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
> reproduce:
>         # save the attached .config to linux build tree
>         make ARCH=i386
> 
> All warnings (new ones prefixed by >>):
> 
>    drivers/acpi/acpica/nsutils.c: In function 'acpi_ns_terminate':
> >> drivers/acpi/acpica/nsutils.c:600:2: warning: ISO C90 forbids mixed
> >> declarations and code [-Wdeclaration-after-statement]
>      union acpi_operand_object *prev;
>      ^~~~~
> 
> vim +600 drivers/acpi/acpica/nsutils.c
> 
> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  584
> * FUNCTION:    acpi_ns_terminate
> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  585
> *
> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  586
> * PARAMETERS:  none
> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  587
> *
> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  588
> * RETURN:      none
> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  589
> *
> 44f6c012 drivers/acpi/namespace/nsutils.c Robert Moore   2005-04-18  590
> * DESCRIPTION: free memory allocated for namespace and ACPI table
> storage.
> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  591
> *
> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  592
> ************************************************************************
> ******/
> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  593
> 4be44fcd drivers/acpi/namespace/nsutils.c Len Brown      2005-08-05  594
> void acpi_ns_terminate(void)
> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  595
> {
> 3f69fe15 drivers/acpi/acpica/nsutils.c    Bob Moore      2013-11-21  596
> 	acpi_status status;
> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  597
> b229cf92 drivers/acpi/namespace/nsutils.c Bob Moore      2006-04-21  598
> 	ACPI_FUNCTION_TRACE(ns_terminate);
> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  599
> 25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25 @600
> 	union acpi_operand_object *prev;
> 25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25  601
> 	union acpi_operand_object *next;
> 25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25  602
> 25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25  603
> 	/* Delete any module-level code blocks */
> 25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25  604
> 25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25  605
> 	next = acpi_gbl_module_code_list;
> 25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25  606
> 	while (next) {
> 25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25  607
> 		prev = next;
> 25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25  608
> 		next = next->method.mutex;
> 
> :::::: The code at line 600 was first introduced by commit
> :::::: 25823e784aac78964ada0e49efe2766d2aeb9fa4 ACPICA: Add additional
> debug info/statements
> 
> :::::: TO: Bob Moore <robert.moore@intel.com>
> :::::: CC: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> ---
> 0-DAY kernel test infrastructure                Open Source Technology
> Center
> https://lists.01.org/pipermail/kbuild-all                   Intel
> Corporation

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] acpi: acpica: fix acpi operand cache leak
  2017-02-14 22:35   ` Moore, Robert
@ 2017-02-14 23:19     ` Seung Hun Han
  2017-02-15  0:40       ` Seung Hun Han
  0 siblings, 1 reply; 5+ messages in thread
From: Seung Hun Han @ 2017-02-14 23:19 UTC (permalink / raw)
  To: Moore, Robert; +Cc: lkp, kbuild-all, Zheng, Lv, Wysocki, Rafael J, linux-kernel

Thank you for your reply.

According to your opinion, I made and sent a patch v2 email to you.
The patch v2 removed all warnings of kbuild by moving the position of
variables.

I extracted the patch v2 from the email.
So would you check the patch v2 under this email or the patch v2 email
in your email list?

The patch v2 is as follows.

Signed-off-by: Seunghun Han <kkamagui@gmail.com>
---
Changes since v1: move position of variables to remove compile warning.

drivers/acpi/acpica/nsutils.c | 23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/drivers/acpi/acpica/nsutils.c b/drivers/acpi/acpica/nsutils.c
index 691814d..943702d 100644
--- a/drivers/acpi/acpica/nsutils.c
+++ b/drivers/acpi/acpica/nsutils.c
@@ -594,25 +594,20 @@ struct acpi_namespace_node
*acpi_ns_validate_handle(acpi_handle handle)
 void acpi_ns_terminate(void)
 {
  acpi_status status;
+ union acpi_operand_object *prev;
+ union acpi_operand_object *next;

  ACPI_FUNCTION_TRACE(ns_terminate);

-#ifdef ACPI_EXEC_APP
- {
- union acpi_operand_object *prev;
- union acpi_operand_object *next;
+ /* Delete any module-level code blocks */

- /* Delete any module-level code blocks */
-
- next = acpi_gbl_module_code_list;
- while (next) {
- prev = next;
- next = next->method.mutex;
- prev->method.mutex = NULL; /* Clear the Mutex (cheated) field */
- acpi_ut_remove_reference(prev);
- }
+ next = acpi_gbl_module_code_list;
+ while (next) {
+ prev = next;
+ next = next->method.mutex;
+ prev->method.mutex = NULL; /* Clear the Mutex (cheated) field */
+ acpi_ut_remove_reference(prev);
  }
-#endif

  /*
  * Free the entire namespace -- all nodes and all objects
-- 
2.1.4

2017-02-15 7:35 GMT+09:00 Moore, Robert <robert.moore@intel.com>:
> I'm sure we would like to backport the memory leak into ACPICA code.
>
> Not sure about the warnings.
>
>> -----Original Message-----
>> From: lkp
>> Sent: Saturday, February 11, 2017 7:56 PM
>> To: Seunghun Han <kkamagui@gmail.com>
>> Cc: kbuild-all@01.org; Zheng, Lv <lv.zheng@intel.com>; Moore, Robert
>> <robert.moore@intel.com>; Wysocki, Rafael J
>> <rafael.j.wysocki@intel.com>; linux-kernel@vger.kernel.org; Seunghun Han
>> <kkamagui@gmail.com>
>> Subject: Re: [PATCH] acpi: acpica: fix acpi operand cache leak
>>
>> Hi Seunghun,
>>
>> [auto build test WARNING on pm/linux-next] [also build test WARNING on
>> v4.10-rc7 next-20170210] [if your patch is applied to the wrong git
>> tree, please drop us a note to help improve the system]
>>
>> url:    https://github.com/0day-ci/linux/commits/Seunghun-Han/acpi-
>> acpica-fix-acpi-operand-cache-leak/20170212-105735
>> base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-
>> pm.git linux-next
>> config: i386-randconfig-x003-201707 (attached as .config)
>> compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
>> reproduce:
>>         # save the attached .config to linux build tree
>>         make ARCH=i386
>>
>> All warnings (new ones prefixed by >>):
>>
>>    drivers/acpi/acpica/nsutils.c: In function 'acpi_ns_terminate':
>> >> drivers/acpi/acpica/nsutils.c:600:2: warning: ISO C90 forbids mixed
>> >> declarations and code [-Wdeclaration-after-statement]
>>      union acpi_operand_object *prev;
>>      ^~~~~
>>
>> vim +600 drivers/acpi/acpica/nsutils.c
>>
>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  584
>> * FUNCTION:    acpi_ns_terminate
>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  585
>> *
>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  586
>> * PARAMETERS:  none
>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  587
>> *
>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  588
>> * RETURN:      none
>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  589
>> *
>> 44f6c012 drivers/acpi/namespace/nsutils.c Robert Moore   2005-04-18  590
>> * DESCRIPTION: free memory allocated for namespace and ACPI table
>> storage.
>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  591
>> *
>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  592
>> ************************************************************************
>> ******/
>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  593
>> 4be44fcd drivers/acpi/namespace/nsutils.c Len Brown      2005-08-05  594
>> void acpi_ns_terminate(void)
>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  595
>> {
>> 3f69fe15 drivers/acpi/acpica/nsutils.c    Bob Moore      2013-11-21  596
>>       acpi_status status;
>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  597
>> b229cf92 drivers/acpi/namespace/nsutils.c Bob Moore      2006-04-21  598
>>       ACPI_FUNCTION_TRACE(ns_terminate);
>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  599
>> 25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25 @600
>>       union acpi_operand_object *prev;
>> 25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25  601
>>       union acpi_operand_object *next;
>> 25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25  602
>> 25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25  603
>>       /* Delete any module-level code blocks */
>> 25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25  604
>> 25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25  605
>>       next = acpi_gbl_module_code_list;
>> 25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25  606
>>       while (next) {
>> 25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25  607
>>               prev = next;
>> 25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25  608
>>               next = next->method.mutex;
>>
>> :::::: The code at line 600 was first introduced by commit
>> :::::: 25823e784aac78964ada0e49efe2766d2aeb9fa4 ACPICA: Add additional
>> debug info/statements
>>
>> :::::: TO: Bob Moore <robert.moore@intel.com>
>> :::::: CC: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>>
>> ---
>> 0-DAY kernel test infrastructure                Open Source Technology
>> Center
>> https://lists.01.org/pipermail/kbuild-all                   Intel
>> Corporation

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] acpi: acpica: fix acpi operand cache leak
  2017-02-14 23:19     ` Seung Hun Han
@ 2017-02-15  0:40       ` Seung Hun Han
  0 siblings, 0 replies; 5+ messages in thread
From: Seung Hun Han @ 2017-02-15  0:40 UTC (permalink / raw)
  To: Moore, Robert; +Cc: lkp, kbuild-all, Zheng, Lv, Wysocki, Rafael J, linux-kernel

Hi, Robert.

I'm so sorry for bothering you. My email client ignored an indentation of the
patch file.
Therefore, please check my patch v2 in your email list, "[PATCH v2] acpi:
acpica: fix acpi operand cache leak" (https://lkml.org/lkml/2017/2/12/224).

Thank you.

2017-02-15 8:19 GMT+09:00 Seung Hun Han <kkamagui@gmail.com>:
> Thank you for your reply.
>
> According to your opinion, I made and sent a patch v2 email to you.
> The patch v2 removed all warnings of kbuild by moving the position of
> variables.
>
> I extracted the patch v2 from the email.
> So would you check the patch v2 under this email or the patch v2 email
> in your email list?
>
> The patch v2 is as follows.
>
> Signed-off-by: Seunghun Han <kkamagui@gmail.com>
> ---
> Changes since v1: move position of variables to remove compile warning.
>
> drivers/acpi/acpica/nsutils.c | 23 +++++++++--------------
>  1 file changed, 9 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/acpi/acpica/nsutils.c b/drivers/acpi/acpica/nsutils.c
> index 691814d..943702d 100644
> --- a/drivers/acpi/acpica/nsutils.c
> +++ b/drivers/acpi/acpica/nsutils.c
> @@ -594,25 +594,20 @@ struct acpi_namespace_node
> *acpi_ns_validate_handle(acpi_handle handle)
>  void acpi_ns_terminate(void)
>  {
>   acpi_status status;
> + union acpi_operand_object *prev;
> + union acpi_operand_object *next;
>
>   ACPI_FUNCTION_TRACE(ns_terminate);
>
> -#ifdef ACPI_EXEC_APP
> - {
> - union acpi_operand_object *prev;
> - union acpi_operand_object *next;
> + /* Delete any module-level code blocks */
>
> - /* Delete any module-level code blocks */
> -
> - next = acpi_gbl_module_code_list;
> - while (next) {
> - prev = next;
> - next = next->method.mutex;
> - prev->method.mutex = NULL; /* Clear the Mutex (cheated) field */
> - acpi_ut_remove_reference(prev);
> - }
> + next = acpi_gbl_module_code_list;
> + while (next) {
> + prev = next;
> + next = next->method.mutex;
> + prev->method.mutex = NULL; /* Clear the Mutex (cheated) field */
> + acpi_ut_remove_reference(prev);
>   }
> -#endif
>
>   /*
>   * Free the entire namespace -- all nodes and all objects
> --
> 2.1.4
>
> 2017-02-15 7:35 GMT+09:00 Moore, Robert <robert.moore@intel.com>:
>> I'm sure we would like to backport the memory leak into ACPICA code.
>>
>> Not sure about the warnings.
>>
>>> -----Original Message-----
>>> From: lkp
>>> Sent: Saturday, February 11, 2017 7:56 PM
>>> To: Seunghun Han <kkamagui@gmail.com>
>>> Cc: kbuild-all@01.org; Zheng, Lv <lv.zheng@intel.com>; Moore, Robert
>>> <robert.moore@intel.com>; Wysocki, Rafael J
>>> <rafael.j.wysocki@intel.com>; linux-kernel@vger.kernel.org; Seunghun Han
>>> <kkamagui@gmail.com>
>>> Subject: Re: [PATCH] acpi: acpica: fix acpi operand cache leak
>>>
>>> Hi Seunghun,
>>>
>>> [auto build test WARNING on pm/linux-next] [also build test WARNING on
>>> v4.10-rc7 next-20170210] [if your patch is applied to the wrong git
>>> tree, please drop us a note to help improve the system]
>>>
>>> url:    https://github.com/0day-ci/linux/commits/Seunghun-Han/acpi-
>>> acpica-fix-acpi-operand-cache-leak/20170212-105735
>>> base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-
>>> pm.git linux-next
>>> config: i386-randconfig-x003-201707 (attached as .config)
>>> compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
>>> reproduce:
>>>         # save the attached .config to linux build tree
>>>         make ARCH=i386
>>>
>>> All warnings (new ones prefixed by >>):
>>>
>>>    drivers/acpi/acpica/nsutils.c: In function 'acpi_ns_terminate':
>>> >> drivers/acpi/acpica/nsutils.c:600:2: warning: ISO C90 forbids mixed
>>> >> declarations and code [-Wdeclaration-after-statement]
>>>      union acpi_operand_object *prev;
>>>      ^~~~~
>>>
>>> vim +600 drivers/acpi/acpica/nsutils.c
>>>
>>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  584
>>> * FUNCTION:    acpi_ns_terminate
>>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  585
>>> *
>>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  586
>>> * PARAMETERS:  none
>>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  587
>>> *
>>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  588
>>> * RETURN:      none
>>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  589
>>> *
>>> 44f6c012 drivers/acpi/namespace/nsutils.c Robert Moore   2005-04-18  590
>>> * DESCRIPTION: free memory allocated for namespace and ACPI table
>>> storage.
>>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  591
>>> *
>>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  592
>>> ************************************************************************
>>> ******/
>>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  593
>>> 4be44fcd drivers/acpi/namespace/nsutils.c Len Brown      2005-08-05  594
>>> void acpi_ns_terminate(void)
>>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  595
>>> {
>>> 3f69fe15 drivers/acpi/acpica/nsutils.c    Bob Moore      2013-11-21  596
>>>       acpi_status status;
>>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  597
>>> b229cf92 drivers/acpi/namespace/nsutils.c Bob Moore      2006-04-21  598
>>>       ACPI_FUNCTION_TRACE(ns_terminate);
>>> ^1da177e drivers/acpi/namespace/nsutils.c Linus Torvalds 2005-04-16  599
>>> 25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25 @600
>>>       union acpi_operand_object *prev;
>>> 25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25  601
>>>       union acpi_operand_object *next;
>>> 25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25  602
>>> 25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25  603
>>>       /* Delete any module-level code blocks */
>>> 25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25  604
>>> 25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25  605
>>>       next = acpi_gbl_module_code_list;
>>> 25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25  606
>>>       while (next) {
>>> 25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25  607
>>>               prev = next;
>>> 25823e78 drivers/acpi/acpica/nsutils.c    Bob Moore      2015-08-25  608
>>>               next = next->method.mutex;
>>>
>>> :::::: The code at line 600 was first introduced by commit
>>> :::::: 25823e784aac78964ada0e49efe2766d2aeb9fa4 ACPICA: Add additional
>>> debug info/statements
>>>
>>> :::::: TO: Bob Moore <robert.moore@intel.com>
>>> :::::: CC: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>>>
>>> ---
>>> 0-DAY kernel test infrastructure                Open Source Technology
>>> Center
>>> https://lists.01.org/pipermail/kbuild-all                   Intel
>>> Corporation

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-02-15  0:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-12  2:49 [PATCH] acpi: acpica: fix acpi operand cache leak Seunghun Han
2017-02-12  3:55 ` kbuild test robot
2017-02-14 22:35   ` Moore, Robert
2017-02-14 23:19     ` Seung Hun Han
2017-02-15  0:40       ` Seung Hun Han

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).