aboutsummaryrefslogtreecommitdiff
path: root/scripts
AgeCommit message (Collapse)Author
2019-03-14scripts/symbolize.py: accept several spaces after "region"Jerome Forissier
User TA crash dumps were slightly modified to better align region numbers. scripts/symbolize.py needs to be updated accordingly. Fixes: dba5a1eab8af1 ("core: better align output of TA dump with many or big regions") Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
2019-01-30scripts: re-indent Python scriptsJerome Forissier
Fixes the following warnings: $ pycodestyle --version 2.5.0 $ pycodestyle scripts/*.py scripts/bin_to_c.py:15:9: E117 over-indented scripts/bin_to_c.py:34:9: E117 over-indented scripts/bin_to_c.py:37:17: E117 over-indented scripts/bin_to_c.py:49:17: E117 over-indented scripts/bin_to_c.py:50:25: E117 over-indented scripts/bin_to_c.py:54:25: E117 over-indented scripts/bin_to_c.py:56:25: E117 over-indented scripts/bin_to_c.py:62:9: E117 over-indented $ cd core/arch/arm/plat-stm32mp1/scripts; \ pycodestyle stm32image.py stm32image.py:21:9: E117 over-indented stm32image.py:27:9: E117 over-indented stm32image.py:29:17: E117 over-indented stm32image.py:39:9: E117 over-indented stm32image.py:77:9: E117 over-indented stm32image.py:84:17: E117 over-indented stm32image.py:96:9: E117 over-indented stm32image.py:100:9: E117 over-indented stm32image.py:125:9: E117 over-indented stm32image.py:140:9: E117 over-indented Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
2019-01-21trace: fix core id print if in non-atomic contextSumit Garg
Make "?" print repetitive equivalent to number of digits needed to display core id rather than extra spaces as it causes symbolize.py script parsing failure for call stack addresses in case number of cores is greater than 10. Also change symbolize.py to detect repetitive "?". Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
2019-01-14gen_hashed_bin.py: open file in binary modeVolodymyr Babchuk
By default Python tries to open files in text mode. This is okay for python2, because it uses 8-bit encoding. But python3 tries to decode file as utf-8 encoded and fails, because it is a binary file. Signed-off-by: Volodymyr Babchuk <vlad.babchuk@gmail.com> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-12-19gen_ld_sects: call `print` as a functionVolodymyr Babchuk
With this change gen_ld_sects.py will be compatible with python3. Signed-off-by: Volodymyr Babchuk <vlad.babchuk@gmail.com> Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
2018-12-19gen_hashed_bin: use integer division operatorVolodymyr Babchuk
Use // instead of /, so this script will be compatible with both python2 and python3. Signed-off-by: Volodymyr Babchuk <vlad.babchuk@gmail.com> Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
2018-12-03checkpatch: do not check DTS filesEtienne Carriere
DTS files may not conform to OP-TEE OS C-source coding style. This change makes checkpatch script not the check DTS files. Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
2018-11-23scripts: bin_to_c.pyEtienne Carriere
bin_to_c.py generates an ANSI-C source file from a binary image file. The C source defines an unsigned byte array that stores the binary data with a 64bit alignment constraint. The label of the array is provided as input argument to the script. Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-by: Jerome.Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-11-14ta_bin_to_c.py: fix issues reported by pycodestyle and re-indentJerome Forissier
Fixes issues reported by: pycodestyle ta_bin_to_c.py and re-indent (4 spaces). Patch obtained by running: autopep8 -i -a -a ta_bin_to_c.py. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-11-14tee_bin_parser.py: fix issues reported by pycodestyleJerome Forissier
Fixes issues reported by: pycodestyle tee_bin_parser.py. Patch obtained by running: autopep8 -i tee_bin_parser.py. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-11-14symbolize.py: fix issues reported by pycodestyle and re-indentJerome Forissier
Fixes issues reported by: pycodestyle symbolize.py and re-indent (4 spaces). Patch obtained by running: autopep8 -i -a -a symbolize.py (autopep8 v1.4.3). In addition, add missing 'r' (raw string) in regular expressions. pycodestyle complains about invalid escape sequences otherwise. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-11-14sign.py: fix issues reported by pycodestyleJerome Forissier
Adds missing blank line. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-11-14pem_to_pub_c.py: fix issues reported by pycodestyle and re-indentJerome Forissier
Fixes issues reported by: pycodestyle pem_to_pub_c.py and re-indent (4 spaces). Patch obtained by running: autopep8 -i -a -a pem_to_pub_c.py. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-11-14mem_usage.py: fix issues reported by pycodestyleJerome Forissier
Fixes issues reported by: pycodestyle mem_usage.py. Patch obtained by running: autopep8 -i -a mem_usage.py. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-11-14gen_ld_sects.py: fix issues reported by pycodestyle and re-indentJerome Forissier
Fixes issues reported by: pycodestyle gen_ld_sects.py and re-indent (4 spaces). Patch obtained by running: autopep8 -i gen_ld_sects.py. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-11-14gen_hashed_bin.py: fix issues reported by pycodestyle and re-indentJerome Forissier
Fixes issues reported by: pycodestyle gen_hashed_bin.py and re-indent (4 spaces). Patch obtained by running: autopep8 -i -a -a gen_hashed_bin.py. In addition, remove a few print lines that were commented out. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-11-08scripts/symbolize.py: be more specific when matching stack addressesJerome Forissier
Use a more specific regular expression for call stack addresses so that the script will not attempt to resolve any hexadecimal number encountered in the middle of a message. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-10-24auto-locate checkpatchMarkus S. Wamser
Try to locate checkpatch.pl in typical location(s) if environment variable CHECKPATCH is not set. The launch script first tries to find checkpatch.pl on the path, next it checks typical locations for linux headers, finally it tries to locate linux sources used for OP-TEE in with QEMU. The first match is used as the checkpatch instance to be invoked. Signed-off-by: Markus S. Wamser <markus.wamser@mixed-mode.de> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
2018-10-02scripts/symbolize.py: add help textJerome Forissier
Document how the binutils tools (addr2line etc.) are found. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
2018-10-01symbolize: use CROSS_COMPILE directive if availableEtienne Carriere
Get CROSS_COMPILE prefix directive if defined in the environment. If CROSS_COMPILE is not defined, default to aarch64-linux-gnu- or arm-linux-gnueabihf- as done prior this change according to the architecture read from the ELF file. Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
2018-09-10scripts/symbolize.py: improve error message when a command is not foundJerome Forissier
It is a common mistake to invoke symbolize.py while not having the proper toolchain is one's $PATH. The script then exits with a stack dump that is unhelpful to users. Improve the situation by showing an explicit "command not found" message and the name of the command. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
2018-09-10scripts/symbolize.py: code cleanupJerome Forissier
Fix pep8 errors. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
2018-08-23core: arm32: generate system register access codeJens Wiklander
Replaces the hand crafted system register code in <arm32.h> and <arm32_macros.S> with generated code based on arm32_sysreg.txt which is extracted from the ARM Architecture Reference Manual. The remaining hand crafted code for cp15 accesses is not covered by the ARM Architecture Reference Manual. A script is added to generate both assembly macros and static inline functions to access the system registers. Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-06-27scripts/symbolize.py: remove spurious output '(out/arm/core/tee.elf)'Jerome Forissier
When a TA dump is processed, there is a list of ELF files just before the call stack. However, when analyzing a TEE core dump, there is no such list. Make sure this situation is properly handled to avoid displaying a spurious message. This means fixing incorrect indentation in a conditional. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-06-20scripts/symbolize.py: ignore undefined symbolsJerome Forissier
With the introduction of dynamically linked TAs, symbolize.py may encounter undefined (external) symbols when it parses the output of the nm command looking for a symbol's address. The current code is not prepared for that and will raise an exception. Fix the issue by ignoring lines that have an unexpected format. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-05-30scripts/symbolize.py: print path of ELF filesJerome Forissier
Show which file corresponds to each ELF binary in a TA. Symbolic links are followed, so that dynamic libraries are likely shown with their user-friendly name (libfoo.so) rather than their UUID (<uuid>.elf) -- see commit 01b8b5ce011d ("TA dev kit: when building a shared library, create symlink with UUID"). Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
2018-05-29scripts/symbolize.py: add support for dynamically linked TAsJerome Forissier
Dynamically linked TAs contain sections mapped from several ELF files. Update symbolize.py accordingly. As a result, the call stack will show the expected debug information instead of "?? ??:0" for stack frames that belong to a dynamic library. Also, the memory regions used to map libraries will be annotated with section names like for the main executable. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
2018-05-22checkpatch_inc.sh: ignore lib/libmbedtlsJens Wiklander
Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-05-22checkpatch_inc.sh: remove non-existent directoriesJens Wiklander
Removes directories listed in checkpatch_inc.sh that doesn't exists any longer. Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-04-17checkpatch_inc.sh: fix case of empty commit due to path filteringJerome Forissier
If a commit changes only paths that are filtered out by $_CP_EXCL, thus making the diff empty, 'git format-patch -1 <sha1>' will show the parent commit instead. As a result, checkpatch.sh will check the wrong commit. Several things are needed to fix the issue: 1. When calling 'git format-patch', specify the commit ID as a range (<sha1>^..<sha1>) rather than as a single revision with a maximum count (-1 <sha1>). This avoids showing the wrong commit. 2. Show the commit message then the diff in two steps, because the above syntax will not print anything if the diff happens to be empty. 3. Tell checkpatch.pl to ignore the "not a unified diff" error which is triggered if the commit log is not followed by a diff. Link: https://travis-ci.org/OP-TEE/optee_os/builds/367058383#L2199-L2204 Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-03-14build: introduce asm-defines-yJerome Forissier
The Makefile rules that are used to generate a C header file containing constants for struct offsets etc. are currently in mk/compile.mk. They are used by core.mk which sets a variable (asm-defines-file) before it includes compile.mk. This works well for this purpose, but does not scale to several files. There is a use case for platform code to be able to use the asm-defines mechanism, too. Therefore, introduce a variable that can be used in any sub.mk: asm-defines-y. In addition, to avoid duplication, the DEFINE and DEFINES macros are moved to their own header (core/include/gen-asm-defines.h), with the added benefit that it can be explicitly excluded from the checkpatch list and thus not generate any warning on the 'DEFINE' macro needing parentheses. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Tested-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
2018-03-01checkpatch_inc.sh: exclude files with inline assemblyJerome Forissier
checkpatch.pl produces false errors when given files with inline assembly [1]. It is best to skip those files entirely. Link: [1] https://travis-ci.org/OP-TEE/optee_os/builds/347435939#L2115 Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-02-20scripts/symbolize.py: update help textJerome Forissier
Commit 546291f4de9b ("trace: make output more compact") has changed the format of the abort and panic dumps. Update 'symbolize.py --help' accordingly. The help text is also reworked slightly to make it clear that the script may be used with all kinds of crash dumps (TEE core or TA, aborts and panics). Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
2018-02-20scripts/symbolize.py: strip cwd from file paths by defaultJerome Forissier
It is quite common to invoke symbolize.py from a top-level directory which contains the source code of OP-TEE as well as of Trusted Applications. In this case, it is convenient to strip the directory from all the paths reported by the script. Therefore, make this behavior the default. In other words, '-s $(pwd)' is now implied. One can still obtain full paths by passing '-s' with no argument. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
2018-01-10Remove 'All rights reserved' from Linaro filesJerome Forissier
The text 'All rights reserved' is useless [1]. The Free Software Foundation's REUSE Initiative best practices document [2] does not contain these words. Therefore, we can safely remove the text from the files that are owned by Linaro. Generated by: spdxify.py --linaro-only --strip-arr optee_os/ Link: [1] https://en.wikipedia.org/wiki/All_rights_reserved Link: [2] https://reuse.software/practices/ Link: [3] https://github.com/jforissier/misc/blob/f7b56c8/spdxify.py Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Joakim Bech <joakim.bech@linaro.org>
2018-01-10Remove license notice from Linaro filesJerome Forissier
Now that we have added SPDX identifiers, we can safely remove the verbose license text from the files that are owned by Linaro. Generated by [1]: spdxify.py --linaro-only --strip-license-text optee_os/ Link: [1] https://github.com/jforissier/misc/blob/f7b56c8/spdxify.py Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Joakim Bech <joakim.bech@linaro.org>
2018-01-10Add SPDX license identifiersJerome Forissier
Adds one SPDX-License-Identifier line [1] to each source files that contains license text. Generated by [2]: spdxify.py --add-spdx optee_os/ The scancode tool [3] was used to double check the license matching code in the Python script. All the licenses detected by scancode are either detected by spdxify.py, or have no SPDX identifier, or are false matches. Link: [1] https://spdx.org/licenses/ Link: [2] https://github.com/jforissier/misc/blob/f7b56c8/spdxify.py Link: [3] https://github.com/nexB/scancode-toolkit Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Joakim Bech <joakim.bech@linaro.org>
2017-12-15scripts: update regular expression in symbolize.pyJoakim Bech
Update the regular expression finding the call stack addresses to match the new trace format. Signed-off-by: Joakim Bech <joakim.bech@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
2017-12-07Sign TAs as bootstrap TAsJens Wiklander
Changes to TA sign script to sign TAs as Bootstrap TAs (img_type == SHDR_BOOTSTRAP_TA) instead of the legacy TA format (img_type == SHDR_TA). Reviewed-by: Volodymyr Babchuk <vlad.babchuk@gmail.com> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2017-11-21mem_usage.py: fix error with ccacheJerome Forissier
Fix the following error: make mem_usage CROSS_COMPILE="ccache arm-linux-gnueabihf-" ... GEN out/arm-plat-vexpress/core/tee.mem_usage Traceback (most recent call last): File "./scripts/mem_usage.py", line 162, in <module> main() File "./scripts/mem_usage.py", line 94, in main universal_newlines=True) File "/usr/lib/python3.5/subprocess.py", line 947, in __init__ restore_signals, start_new_session) File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child raise child_exception_type(errno_num, err_msg) FileNotFoundError: [Errno 2] No such file or directory: 'ccache arm-linux-gnueabihf-readelf' core/arch/arm/kernel/link.mk:255: recipe for target 'out/arm-plat-vexpress/core/tee.mem_usage' failed make: *** [out/arm-plat-vexpress/core/tee.mem_usage] Error 1 Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
2017-11-17Add pager options to mem_usage.pyJerome Forissier
Adds options to report the size of the init, paged and unpaged areas in pager builds (CFG_WITH_PAGER=y). This is helpful to monitor the evolution of the code size, and identify issues such as when useless functions get pulled into the unpaged area by mistake. For instance, here is what we can get with 'mem_usage.py -nUr' and a few lines of script (shows changes in the size of unpaged code and data for a non-debug qemu_virt build since 2.5.0): 2.5.0 67600 2.5.0-2-g0b8e6e78 67632 +32 core: abort: fix get_fault_type() 2.5.0-11-g87d96185 67728 +96 core: pager: avoid page faults with pager lock held 2.5.0-37-g0073c9a8 67792 +64 core: pager: optimize tee_pager_handle_fault() 2.5.0-40-g935ac3ec 67888 +96 core: arm32: handle aborts in system mode 2.5.0-53-g2e4e94bf 67920 +32 core: default enable program flow prediction on ARMv7 cores 2.5.0-57-ge84e1fec 67704 -216 core: clean and unwind arm32_aeabi_[l]divmod_a32.S 2.5.0-63-g23346f16 67736 +32 Add support for several user TA stores 2.5.0-76-gb2087a20 67608 -128 core: pager: deal with large CFG_TEE_RAM_VA_SIZE 2.5.0-77-g00aa47a4 67688 +80 core: plat-vexpress: increase CFG_TEE_RAM_VA_SIZE 2.5.0-112-g86e50a60 67696 +8 core: arm: psci: add suspend resume common functions 2.5.0-120-g13b3ee90 67768 +72 core: print rwx flags for each MMU region when a user TA aborts 2.5.0-122-ge61644fb 83408 +15640 core: make reset_secondary() unpaged 2.5.0-123-g1506eb6f 83424 +16 core: plat-vexpress: init gic on secondary cores 2.5.0-124-ge2b68c87 91368 +7944 core: plat-vextpress-qemu_virt: update num cores 2.5.0-126-g5402a9fe 92808 +1440 qemu_virt: enable smp boot 2.5.0-132-gda51216b 92840 +32 dts: pass PA of reserved region 2.5.0-173-gb4121bfb 92848 +8 pl011: prevent putc() and flush() function from blocking indefinitely 2.5.0-176-g55d6853c 92912 +64 core: add registered shared memory support 2.5.0-182-g93d3c451 163936 +71024 core: pager: ltc: prng: add entropy to the AE key for paged TAs 2.5.0-202-ga71af55e 163984 +48 core: mobj: add mobj_get_phys_offs() 2.5.0-203-g5c7a19bb 163968 -16 core: mobj: remove double physical offset 2.5.0-205-g430dcbd8 163944 -24 core: reimplement mobj_mapped_shm_alloc() 2.5.0-208-gbbed97b6 163976 +32 core:mmu: fix userland va2pa conversion 2.5.0-209-g42d91b4b 164040 +64 core:mmu: fix userland pa2va conversion 2.6.0-rc1-1-gb6449075 164136 +96 thread.c: free rpc arg mobj during cache disabling 2.6.0-7-g8473540d 77144 -86992 Keep assembly functions in separate sections 2.6.0-8-g64113fca 77112 -32 core: arm32: replace _start with reset() function 2.6.0-9-g486754e8 77176 +64 core: arm32: reset_secondary() set reset vector Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Volodymyr Babchuk <vlad.babchuk@gmail.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by Etienne Carriere <etienne.carriere@linaro.org>
2017-11-17Rewrite mem_usage.awk in PythonJerome Forissier
Rewrite the memory usage script in Python. No functional change, except that the script now takes tee.elf as an argument instead of processing the output of readelf. The makefile (make mem_usage) is adjusted accordingly. This makes the script shorter and easier to call, and it is now possible to add command line options. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Volodymyr Babchuk <vlad.babchuk@gmail.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by Etienne Carriere <etienne.carriere@linaro.org>
2017-10-11scripts/symbolize.py: reset state when a (new) abort message is foundJerome Forissier
The symbolize script may not process correctly several dumps in a row. For instance, if you pipe a TA abort followed by a TEE core abort, the later is not decoded properly because the script still uses the TA binary to interpret the core stack. Fix this by resetting the state of the decoder each time an abort line is encountered. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
2017-09-28TUI: remove unused scripts/render_font.pyJens Wiklander
Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2017-09-27scripts/gen_ld_sects.py: Explicitly number positional argument specifiersAndrew F. Davis
Before Python 2.7 omitting the positional argument specifier was not allowed. Some may still be using earlier Python version where this will cause build to fail. Fix this here. Fixes: 5976a0a5b9bf ("core: avoid incremental linking with -gc") Reported-by: Nishanth Menon <nm@ti.com> Signed-off-by: Andrew F. Davis <afd@ti.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
2017-09-18scripts/symbolize.py: print ELF sections after MMU region informationJerome Forissier
When processing a user TA abort dump, list the ELF sections that are mapped in each MMU region. For example (the lines modified by this patch are prefixed with >>): User TA undef-abort at address 0x10574e fsr 0x00000000 ttbr0 0x0e07a06a ttbr1 0x0e07406a cidr 0x1 cpu #0 cpsr 0x60000030 r0 0x20000013 r4 0x0013a6bc r8 0x00000000 r12 0x0e07dd88 r1 0x00000033 r5 0x00121fd3 r9 0x00000000 sp 0x001026cc r2 0x0010581f r6 0x00102590 r10 0x00000000 lr 0x00105823 r3 0x00000043 r7 0x001026cc r11 0x00000000 pc 0x0010574e Status of TA 5b9e0e40-2636-11e1-ad9e-0002a5d5c51b (0xe073b70) (active) arch: arm load address: 0x103000 ctx-idr: 1 stack: 0x100000 10240 region 0: va 0x100000 pa 0xe21e000 size 0x3000 flags rw- >> region 1: va 0x103000 pa 0xe100000 size 0x2e000 flags r-x .ta_head .text .rodata >> region 2: va 0x131000 pa 0xe12e000 size 0xa000 flags r-- .rodata .ARM.extab .ARM.exidx .got .dynsym .rel.got .dynamic .dynstr .hash .rel.dyn >> region 3: va 0x13b000 pa 0xe138000 size 0xe6000 flags rw- .data .bss region 4: va 0 pa 0 size 0 flags --- region 5: va 0 pa 0 size 0 flags --- region 6: va 0 pa 0 size 0 flags --- region 7: va 0 pa 0 size 0 flags --- User TA undef-abort at address 0x10574e undef_instr+6 .text+10030 Call stack: 0x0010574e undef_instr at optee_test/ta/os_test/os_test.c:880 0x00105823 ta_entry_bad_mem_access at optee_test/ta/os_test/os_test.c:917 0x00105e75 TA_InvokeCommandEntryPoint at optee_test/ta/os_test/ta_entry.c:101 0x00121fb7 entry_invoke_command at optee_os/lib/libutee/arch/arm/user_ta_entry.c:207 0x00122013 __utee_entry at optee_os/lib/libutee/arch/arm/user_ta_entry.c:235 Suggested-by: Zeng Tao <prime.zeng@hisilicon.com> Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
2017-09-06scripts/symbolize.py: get binary architecture from ELF fileJerome Forissier
Instead of making a fragile assumption, that we have a 64-bit TEE core if we encounter 64-bit registers in the dump, read the architecture from the ELF file itself. This allows to correctly parse 32- and 64-bit TEE core call stacks without any context but the string "Call stack:" at the beginning. Therefore, the helper script can now be used on core panics. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
2017-09-05scripts/symbolize.py: accept -d <ELF_file> in addition to -d <dir>Jerome Forissier
The -d option of symbolize.py normally expects one or more directories, where the script will look for ELF files (TEE or TA, depending on the input dump). For convenience, let's also accept paths to the actual ELF files. Previously, the script would just ignore file arguments and silently fail to resolve stack traces. Reported-by: Lijianhui <airbak.li@hisilicon.com> Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Igor Opaniuk <igor.opaniuk@linaro.org>
2017-08-31scripts/symbolize.py: try to resolve abort address to symbol/section[+offset]Jerome Forissier
Use nm and objdump to find the symbol and ELF section that match the address reported in the the abort line. This can help debug writes to read-only data or unaligned accesses to global data, for example. If the address can be resolved to a symbol plus some offset and/or a section plus some offset, the abort line is printed again just before the call stack with the symbolic information added. Not that the translation cannot be done immediately when the abort line is seen because at this point we don't know the architecture, and we don't have the load address of the TA. Here is an example (the line added by this patch is marked with >>): User TA data-abort at address 0x1314d0 (write permission fault) fsr 0x0000080f ttbr0 0x0e07a06a ttbr1 0x0e07406a cidr 0x1 cpu #0 cpsr 0x60000030 r0 0x00000001 r4 0x00102780 r8 0x00000000 r12 0xb736e358 r1 0x00102724 r5 0x00121e4f r9 0x00000000 sp 0x001026e0 r2 0x00000001 r6 0x001026dc r10 0x00000000 lr 0x00105cf1 r3 0x001314d0 r7 0x001026e0 r11 0x00000000 pc 0x00105790 Status of TA 5b9e0e40-2636-11e1-ad9e-0002a5d5c51b (0xe073b70) (active) arch: arm load address: 0x103000 ctx-idr: 1 stack: 0x100000 10240 region 0: va 0x100000 pa 0xe21e000 size 0x3000 region 1: va 0x103000 pa 0xe100000 size 0x2e000 region 2: va 0x131000 pa 0xe12e000 size 0xa000 region 3: va 0x13b000 pa 0xe138000 size 0xe6000 region 4: va 0 pa 0 size 0 region 5: va 0 pa 0 size 0 region 6: va 0 pa 0 size 0 region 7: va 0 pa 0 size 0 >> User TA data-abort at address 0x1314d0 const_val+4 .rodata+4452 (write permission fault) Call stack: 0x00105790 ta_entry_bad_mem_access at optee_test/ta/os_test/os_test.c:917 0x00105cf1 TA_InvokeCommandEntryPoint at optee_test/ta/os_test/ta_entry.c:101 0x00121e33 entry_invoke_command at optee_os/lib/libutee/arch/arm/user_ta_entry.c:207 0x00121e8f __utee_entry at optee_os/lib/libutee/arch/arm/user_ta_entry.c:235 The test TA does the following: const int const_val[3] = { 1, }; /* ... */ ((int *)const_val)[1] = 2; Suggested-by: Zeng Tao <prime.zeng@hisilicon.com> Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Reviewed-by: Igor Opaniuk <igor.opaniuk@linaro.org>
2017-08-31scripts/symbolize.py: use base-16 when converting hex stringsJerome Forissier
When converting a hex string formatted as '0x<hex>', a value of 0 may be given for base and Python will automatically assume a base-16 literal. However, since we're always dealing with hex strings (with or without a 0x prefix), it is more convenient to specify base-16 everywhere. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Reviewed-by: Igor Opaniuk <igor.opaniuk@linaro.org>