13397 Commits

Author SHA1 Message Date
Erik Schmauss
d2d2fa1ad2 Converter: adding extra check to prevent NULL dereference 2017-03-03 15:15:47 -08:00
Erik Schmauss
db2cf5680f iasl: adding an extra check within if
This prevents possibilty of null dereference.

Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2017-03-03 15:15:47 -08:00
Erik Schmauss
f14e1c69d7 Converter: getting rid of useless if statement
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2017-03-03 15:15:47 -08:00
Erik Schmauss
831be6ef92 Converter: fixing comment print function
This fix enabled EndStr to be printed when a comment has been printed.

Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2017-03-03 15:15:47 -08:00
Erik Schmauss
51e73c1d35 Change path's type from UINT8* to char*
All instances using a named parseOp's path field has a type
cast from UINT8* to char*. Changing path's type from UINT8*
to char* eliminates type casting and retains the previous
behavior.

Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2017-03-03 15:12:02 -08:00
Robert Moore
c55bb526ac Update version to 20170303
Version 20170303.
R03_03_17
2017-03-03 09:23:24 -08:00
Robert Moore
fda1297411 Logfile: Changes for version 20170303
Version 20170303.
2017-03-03 09:22:51 -08:00
Robert Moore
72452261ae Update legal header in all source modules
Adds the dual GNU/BSD dual license to the existing Intel license.
Provides all licensing information in each source module.
Affects all ACPICA source modules.
2017-03-02 13:21:13 -08:00
Robert Moore
768bee839d Merge pull request #219 from SchmErik/build32And64
Makefile: enable compilation of ACPICA tools as 32-bit programs
2017-03-01 15:58:27 -08:00
Erik Schmauss
7dae4d8797 Makefile: enable compilation of ACPICA tools as 32-bit programs
This is to facilitate compiling ACPICA tools as 32-bit programs on 64-bit machines.

To build as 32 bit programs, set the M32 variable to true when running make

Example: make M32=TRUE

Note: if the above results in a compilation error, there is a possibility
that 32-bit libraries may not be installed. If this is the case, run the
following command (on Ubuntu compiling with gcc)

    sudo apt-get install g++-multilib libc6-dev-i386

and run make again.

Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2017-03-01 14:43:48 -08:00
Robert Moore
c1889cb571 Merge pull request #218 from SchmErik/aslts/fix001
ASLTS: adding stylistic changes to testsuite script
2017-03-01 13:41:28 -08:00
Erik Schmauss
3072c43fb4 ASLTS: adding stylistic changes to testsuite script
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2017-03-01 12:58:00 -08:00
Robert Moore
fb8c31c3f2 Merge pull request #217 from juikim/master
Fix build for FreeBSD kernel.
2017-03-01 10:41:24 -08:00
Jung-uk Kim
a65c1df7e6 Fix build for FreeBSD kernel.
FILE is only defined in user land.
2017-02-28 16:46:02 -05:00
Robert Moore
4618a26162 Merge pull request #216 from SchmErik/asltsScript
Aslts script
2017-02-28 13:37:46 -08:00
Robert Moore
532e74a929 Merge pull request #215 from juikim/master
Remove redefinition of YY_BUFFER_STATE.
2017-02-28 13:37:20 -08:00
Erik Schmauss
b40b556bbf ASLTS: adding binary compare option
this option disables test execution and terminates after test suite
compilation and binary comparison.

Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2017-02-28 12:09:22 -08:00
Erik Schmauss
fc5b38198a ASLTS: replacing slack/norm with opt/nopt
This gets rid of slack mode and normal mode within the test suite and replaces
this with opt (optimized) and nopt (non-optimized) modes.

Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2017-02-28 12:07:22 -08:00
Erik Schmauss
1b7315dcc0 ASLTS: editing help message
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2017-02-28 12:02:49 -08:00
Erik Schmauss
3e6131748f ASLTS: adding AML binary compare
This adds the capability for ASLTS to exercise the aml disassembler during the
compilation of ASLTS. This is done by comparing aml generated by compiling and
disassembling/recompiling each test case and performing a binary comparison
between the two aml files.

Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2017-02-28 11:34:33 -08:00
Jung-uk Kim
9bd7de58d1 Remove redefinition of YY_BUFFER_STATE.
This works around an unnecessary redefinition of typedef "YY_BUFFER_STATE".
2017-02-28 14:30:15 -05:00
Robert Moore
78904f89e5 Generate: Add batch file to setup MSVC environment
Executes MS batch file to setup environment variables.
Used for the size.bat execution.
2017-02-28 09:51:29 -08:00
Robert Moore
f3df5298d0 Dissasembler: Add additional error messages during initialization
Emit error messages for any problems during the ACPICA init
phase. Otherwise, iASL will silently exit.
2017-02-28 09:48:40 -08:00
Robert Moore
ae2a65b880 Disassembler: Update for resource name memory leak
Delete small buffer used during resource template disassembly.
2017-02-28 09:15:01 -08:00
Robert Moore
abf1d02acc Revert "Disassembler: Fix small memory leak for resource tags"
This reverts commit 20741c9c6e4f86eb90948cfceb55169593b79f0b.
Attempt to free the wrong object.
2017-02-28 08:47:30 -08:00
Robert Moore
db13f9ffbd Update version to 20170224
Version 20170224.
R02_24_17
2017-02-24 16:41:04 -08:00
Robert Moore
0ff17cc3ee Logfile: Changes for version 20170224
Version 20170224.
2017-02-24 16:39:44 -08:00
Robert Moore
9c54b8bbd4 Local cache support: Allow small cache objects
Remove apparently arbitrary restriction on the size of the cache
objects to 16 (in AcpiOsCreateCache). Now, the input object
size must be simply non-zero.
2017-02-24 15:40:17 -08:00
Robert Moore
c04d310039 iASL: add ASL conversion tool
The key feature of this utility is that the original comments within
the input ASL files are preserved during the conversion process, and
included within the converted ASL+ file -- thus creating a transparent
conversion of existing ASL files to ASL+ (ASL 2.0)
2017-02-24 14:47:30 -08:00
Robert Moore
20741c9c6e Disassembler: Fix small memory leak for resource tags
Free tag pathname when finished with it.
2017-02-24 13:41:07 -08:00
Robert Moore
f259cf8bd5 Disassembler: Fix a type/truncation mismatch
MS compiler warns on 64-bit to 8-bit truncation.
2017-02-24 13:27:32 -08:00
David Box
62473c346d Merge pull request #212 from debox1/fix-acpica-bug-1358
Disassembler: Do not unconditionally remove temporary names
2017-02-24 13:18:15 -08:00
Robert Moore
0c0d43e8a2 Merge pull request #211 from debox1/feature-ex-in-place
compiler: disassembler: compile and disassemble externals in place
2017-02-24 13:11:14 -08:00
David E. Box
c46f496df4 Disassembler: Do not unconditionally remove temporary names
Change the Switch disassembly code to check if the conversion can be
done before removing temporary (_T_x) names. Prevents invalid
disassembly of AML created by older compilers (circa 2005).

Link: https://bugs.acpica.org/show_bug.cgi?id=1358
Link: https://bugs.acpica.org/show_bug.cgi?id=1360
Reported-by: racerrehabman@gmail.com
Signed-off-by: David E. Box <david.e.box@linux.intel.com>
2017-02-24 13:00:15 -08:00
David E. Box
398c42219a compiler: disassembler: compile and disassemble externals in place
The patch adds an ACPICA testing feature that allows external
opcodes to be generated in place. This switch (-oE) doesn't place
an If (0) block around the opcodes since use of this functions is
for compiler/disassemblr testing only and is not intended to be
run through the interpreter. When this switch is used, the
disassembler will output the externals in the same location they
were at in the original ASL code and will not generate a separate
list of externals at the top of the file.

Signed-off-by: David E. Box <david.e.box@linux.intel.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
2017-02-24 12:56:08 -08:00
Robert Moore
bb1a602a6a iASL: update internal option.
Update for an internal (ASL converter) option.
2017-02-24 09:19:25 -08:00
Robert Moore
3235eb50f2 Merge pull request #210 from zetalog/acpica-iort
Acpica iort
2017-02-24 07:12:19 -08:00
Lv Zheng
80d0ad7366 iasl: Refine IORT template
In the current IORT template, ID array example is only prepared for the ITS
group node while it is defined in the spec that the ITS group node doesn't
contain the ID array:
  Table 11 ITS Group Format
    Number of ID mappings:
    This field has a value of 0. ITS groups do not have IDs.

In the refined IORT template, ID array(s) is deleted from the ITS group and
are prepared for all other nodes so that after we automatically resets
MappingOffset in the iasl IORT compilation code, MappingOffset can still be
properly set to the developer re-usable values. ACPICA BZ 1340, reported by
Alexei Fedorov, fixed by Lv Zheng.

Link: https://bugs.acpica.org/show_bug.cgi?id=1340
Reported-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2017-02-24 15:16:12 +08:00
Lv Zheng
637b88de24 iasl: Fix IORT SMMU GSI disassembling
If the IORT template is compiled and then iort.aml binary disassembled to
iort.dsl, SMMUv1 node lists incorrect offset for SMMU_NSgCfgIrpt Interrupt:
[0ECh 0236   8]       SMMU_NSgIrpt Interrupt : 0000000000000000
[0ECh 0236   8]    SMMU_NSgCfgIrpt Interrupt : 0000000000000000
This is because iasl hasn't implemented SMMU GSI decoding yet.

This patch fixes this issue by preparing structures for decoding IORT SMMU
GSI. ACPICA BZ 1340, reported by Alexei Fedorov, fixed by Lv Zheng.

Link: https://bugs.acpica.org/show_bug.cgi?id=1340
Reported-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2017-02-24 15:16:09 +08:00
Lv Zheng
741c3f61bc iasl: Add MappingOffset reset support
In IORT spec, there are definitions for ItsGroup Node, allowing 0 to be set
for "MappingOffset" of ID array:
  Table 11 ITS Group Format
    Reference to ID Array:
    This field has a value of 0. There is no ID array.

This patch thus resets MappingOffset when MappingCount is 0 to avoid fatals
occuring to the possible buggy OSPMs when they are processing the iasl
compiled IORT table. ACPICA BZ 1340, Reported by Alexei Fedorov, fixed by
Lv Zheng.

Link: https://bugs.acpica.org/show_bug.cgi?id=1340
Reported-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2017-02-24 15:16:06 +08:00
Robert Moore
ec969d38fe Cleanup AML opcode definitions, no functional change
This change is a cleanup and further standardization of the AML
opcode defines in amlcode.h

Improves the readability and maintainability of the source code.
2017-02-23 12:56:58 -08:00
Robert Moore
12d793738e Merge pull request #208 from zetalog/acpica-debugger
Acpica debugger
2017-02-23 08:30:35 -08:00
Robert Moore
1257c43fe1 Merge pull request #207 from ColinIanKing/master
debugger: fix memory leak on Pathname
2017-02-23 07:02:00 -08:00
Lv Zheng
91af5d18cd Debugger: Add interpreter blocking mark for single-step mode
When the single-step mode is used, evaluation is actually split by the
single-step command prompts, so this patch correctly marks the evaluation
segment with interpreter lock release/acquire.
This in return fixes an issue that in the single-step command prompt,
commands requiring to hold the namespace lock (ex. namespace) cannot be
executed. ACPICA BZ 1362, fixed by Lv Zheng.

Link: https://bugs.acpica.org/show_bug.cgi?id=1362
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2017-02-23 14:32:25 +08:00
Colin Ian King
1db14dc88f debugger: fix memory leak on Pathname
On the error return path when AcpiGetObjectInfo fails the allocated
pathname is not free'd leading to a memory leak.  Free pathname
to fix this.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
2017-02-22 18:56:03 +00:00
Robert Moore
6b58810b9a Update for automatic repair code for objects returned by evaluate_object
This change fixes two instances where the repair code made an incorrect
assumption about how reference counts are assigned to package objects.
Resolves issues where a warning was issued about a "large reference
count" -- which usually indicates an attempt to delete an object
that has previously been poisoned and released into the object cache.
2017-02-22 08:58:00 -08:00
Robert Moore
a4f29a3662 Merge pull request #206 from zetalog/acpica-ifdef
Acpica ifdef
2017-02-22 08:17:35 -08:00
Seunghun Han
a23325b2e5 Namespace: fix operand cache leak
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 AcpiTerminate() function. The function calls
AcpiNsTerminate() function to delete namespace data and ACPI operand cache
(AcpiGbl_ModuleCodeList).

But the deletion code in AcpiNsTerminate() 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
(AcpiGbl_ModuleCodeList) 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 AcpiNsTerminate() function for
executing the deletion code unconditionally.

Signed-off-by: Seunghun Han <kkamagui@gmail.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2017-02-22 16:32:49 +08:00
Robert Moore
521bedc49b Fix several incorrect invocations of ACPICA return macro
Not needed since there is no function tracing for the
validation function in hwvalid.c
2017-01-26 08:51:53 -08:00
Robert Moore
5ecc479f62 Fix a module for excessive debug output
hwvalid.c - no trace needed for validate I/O function.
2017-01-25 08:58:56 -08:00