History log of /optee_os/scripts/symbolize.py (Results 1 – 25 of 47)
Revision Date Author Comments
# 17a66904 10-Nov-2023 Jens Wiklander <jens.wiklander@linaro.org>

core: print current guest ID in logs

If CFG_NS_VIRTUALIZATION is enabled include the current guest ID on each
log line. A number is added before the core number identifying the
currently set guest I

core: print current guest ID in logs

If CFG_NS_VIRTUALIZATION is enabled include the current guest ID on each
log line. A number is added before the core number identifying the
currently set guest ID, for example:
D/TC:2 0 0 call_initcalls:40 level 1 teecore_init_pub_ram()

Where the "2" indicates that this is done with guest ID 2 active.

Update the symbolize.py script accordingly to recognize and ignore an
eventual guest ID in a log entry.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>

show more ...


# d33360e5 15-Jun-2023 Kun Lai <me@imlk.top>

scripts/symbolize.py: Fix crash when .elf file not found

The script will crash if the xxx.elf file cannot be found.

```
TypeError: expected str, bytes or os.PathLike object, not NoneType
```

This

scripts/symbolize.py: Fix crash when .elf file not found

The script will crash if the xxx.elf file cannot be found.

```
TypeError: expected str, bytes or os.PathLike object, not NoneType
```

This commit add check for None value.

Signed-off-by: Kun Lai <me@imlk.top>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>

show more ...


# 0309f58d 29-May-2023 Alvin Chang <alvinga@andestech.com>

scripts/symbolize.py: Support RISC-V architecture

If we get RISC-V architecture flag from ELF file, assign "self._arch" as
"riscv32-unknown-linux-gnu-" or "riscv64-unknown-linux-gnu-", since they
ar

scripts/symbolize.py: Support RISC-V architecture

If we get RISC-V architecture flag from ELF file, assign "self._arch" as
"riscv32-unknown-linux-gnu-" or "riscv64-unknown-linux-gnu-", since they
are prefixes of RISC-V's official toolchains.

Signed-off-by: Alvin Chang <alvinga@andestech.com>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>

show more ...


# f7a5c21e 29-May-2023 Jerome Forissier <jerome.forissier@linaro.org>

arm64: memtag: strip tag from crash dumps

The MTE tag is not really useful when displaying a crash dump. In fact
it makes it more complicated for tools like script/symbolize.py to
retrieve the actua

arm64: memtag: strip tag from crash dumps

The MTE tag is not really useful when displaying a crash dump. In fact
it makes it more complicated for tools like script/symbolize.py to
retrieve the actual (untagged) virtual address, especially as we now
support non-Arm architectures and therefore blindly stripping the MTE
bits is not possible.

This commit strips the tag in call stacks displayed by
print_stack_arm64(). It also removes it from the virtual address shown
on abort (__print_abort_info()) since symbolize.py does try to resolve
the address as symbol + offset ; but in this case the tagged address is
printed as well, because it can be helpful to diagnose tag check faults.

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>

show more ...


# 99e82b1f 05-May-2022 Jerome Forissier <jerome.forissier@linaro.org>

symbolize.py: translate TA panic codes

When a TA panics, the TEE core shows the panic code as follows:

E/TC:? 0 TA panicked with code 0xffff000f

The value is whatever was passed to TEE_Panic() by

symbolize.py: translate TA panic codes

When a TA panics, the TEE core shows the panic code as follows:

E/TC:? 0 TA panicked with code 0xffff000f

The value is whatever was passed to TEE_Panic() by the TA or the library
that caused the panic; typically, the TEE Intenal Core API functions
implemented in libutee. It quite often happens that this value is a
TEE_Result code. Therefore it is convenient to translate the hexadecimal
value to a symbolic name (TEE_ERROR_*). With this commit, if a match is
found, the name is shown in parentheses like so:

E/TC:? 0 TA panicked with code 0xffff000f (TEE_ERROR_SECURITY)

If the code doesn't correspond to a known TEE_Result value however
nothing is appended to the output.

Suggested-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Acked-by: Peter Griffin <peter.griffin@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# 2a0d456f 29-Apr-2022 Jerome Forissier <jerome.forissier@linaro.org>

symbolize.py: strip MTE tag

When the Armv8.5 Memory Tagging Extension is enabled, the address shown
in data-abort messages may include a non-zero tag. For example (xtest
1038):

E/TC:? 0 User mode

symbolize.py: strip MTE tag

When the Armv8.5 Memory Tagging Extension is enabled, the address shown
in data-abort messages may include a non-zero tag. For example (xtest
1038):

E/TC:? 0 User mode data-abort at address 0x2000000401824f0 (tag check fault)

The tag needs to be cleared before the address can be translated into
symbol + offset.

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# 5500d703 31-Jul-2020 Jerome Forissier <jerome@forissier.org>

symbolize.py: infer PC from (E)LR

When translating a call stack address to source file and line number,
subtract 2 to try and reflect the PC at the time the call was made or
the exception occurred.

symbolize.py: infer PC from (E)LR

When translating a call stack address to source file and line number,
subtract 2 to try and reflect the PC at the time the call was made or
the exception occurred. This makes the calls easier to follow and
corresponds to what the GDB backtrace command (bt) does. For data or
prefetch aborts it is even more important because now we report exactly
the line that caused the abort instead of showing the next one, which
could be misleading.

As a result of this fix, the extra "nop" instruction in __ta_entry() is
not needed anymore so remove it.

Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# d7c22ace 22-Jun-2020 Jerome Forissier <jerome@forissier.org>

symbolize.py: ignore error if ELF file is not found

When processing the memory map of a TA, it can happen that the ELF file
for a region is not found. One typical reason is a missing -d argument
on

symbolize.py: ignore error if ELF file is not found

When processing the memory map of a TA, it can happen that the ELF file
for a region is not found. One typical reason is a missing -d argument
on the command line (can easily happen when a TA uses shared libraries
for instance).

In the above case, the script crashes with no clear indication about
the cause. This commit fixes the crash by ignoring ELFs that are not
found. This is consistent with the general behavior of symbolize.py,
which is to always print out all the information it is fed and simply
augment it with debug information when possible.

Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>

show more ...


# 9bb9f377 18-Feb-2020 Jerome Forissier <jerome@forissier.org>

symbolize.py: add -L option to the "file" command

The symbolize script uses the "file" command to identify the
architecture of ELF binaries. If the file is a symbolic link (which can
happen with sha

symbolize.py: add -L option to the "file" command

The symbolize script uses the "file" command to identify the
architecture of ELF binaries. If the file is a symbolic link (which can
happen with shared libraries typically), the command may fail to return
the expected output and print "symbolic link to <some path>" instead.

This behavior of the "file" command depends on the environment variable
POSIXLY_CORRECT. In order to not depend on this, this commit adds the
-L option (follow symlinks).

Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# 24778ded 12-Feb-2020 Jerome Forissier <jerome@forissier.org>

symbolize.py: fix analysis of mixed 32/64 bit ftrace dumps

When an ftrace file that contains both user space and kernel space
calls is analyzed by symbolize.py, any address can be 32 or 64 bits.
For

symbolize.py: fix analysis of mixed 32/64 bit ftrace dumps

When an ftrace file that contains both user space and kernel space
calls is analyzed by symbolize.py, any address can be 32 or 64 bits.
For each address, the resolve() function first obtains the path to the
proper ELF file, then calls spawn_addr2line() to make sure we have a
process that is capable of resolving the address (i.e., either
arm-linux-gnueabihf-addr2line or aarch64-linux-gnu-addr2line).
spawn_addr2line() then calls arch_prefix() to obtain the tool's prefix.
Unfortunately, the ELF file is not supplied, so arch_prefix() assumes
that the first entry in the global list of files is suitable. While this
is true when symbolizing homogeneous dumps (i.e., kernel stacks or
TA + multiple libraries), it does not work for mixed ftrace logs.

This patch addresses the issue by adding the ELF file as an argument to
spawn_addr2line().

Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# ba84a3f5 12-Feb-2020 Jerome Forissier <jerome@forissier.org>

symbolize.py: add line removed by mistake

Commit c0c57c8fa583 ("symbolize.py: fix stack dump of TEE core with
pager") has mistakenly removed a line which caches the name of the ELF
file for which ad

symbolize.py: add line removed by mistake

Commit c0c57c8fa583 ("symbolize.py: fix stack dump of TEE core with
pager") has mistakenly removed a line which caches the name of the ELF
file for which addr2line was last spawned. As a result, processes keep
being killed and re-started, resulting in a much slower execution.

This commit restores the missing line.

Fixes: c0c57c8fa583 ("symbolize.py: fix stack dump of TEE core with pager")
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# 17be223a 29-Jan-2020 Jerome Forissier <jerome@forissier.org>

symbolize.py: Python < 3.7 compatibility

The documentation for the Python 3 subprocess module [1] has the
following note related to the Popen() constructor:

Changed in version 3.7: Added the text

symbolize.py: Python < 3.7 compatibility

The documentation for the Python 3 subprocess module [1] has the
following note related to the Popen() constructor:

Changed in version 3.7: Added the text parameter, as a more
understandable alias of universal_newlines.

In order to avoid a runtime error with versions of Python prior to 3.7,
replace the 'text' parameter with 'universal_newlines'.

Link: [1] https://docs.python.org/3/library/subprocess.html
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>

show more ...


# c0c57c8f 08-Jan-2020 Jerome Forissier <jerome@forissier.org>

symbolize.py: fix stack dump of TEE core with pager

Commit 105e09c24479 ("symbolize.py: add support for TEE core ASLR") has
introduced support for ASLR by using addresses relative to the .text
secti

symbolize.py: fix stack dump of TEE core with pager

Commit 105e09c24479 ("symbolize.py: add support for TEE core ASLR") has
introduced support for ASLR by using addresses relative to the .text
section. To this end, the '-j.text' option is passed to addr2line.
Unfortunately, it happens that addr2line does not like to be given
addresses that are outside the specified section. This can happen when
CFG_WITH_PAGER=y as shown in the following example:

D/TC:4 0 TEE load address @ 0x3f000000
D/TC:4 0 Call stack:
D/TC:4 0 0x000000003f0080ac read_pc at optee_os/core/arch/arm/include/arm64.h:237
D/TC:4 0 0x000000003f062984 ?? ??:0
D/TC:4 0 0x000000003f007be4 wq_wait_final at optee_os/core/arch/arm/kernel/wait_queue.c:88
D/TC:4 0 0x000000003f007698 __mutex_lock at optee_os/core/arch/arm/kernel/mutex.c:57
D/TC:4 0 0x000000003f06c204 ?? ??:0
D/TC:4 0 0x000000003f067160 ?? ??:0
D/TC:4 0 0x000000003f06221c ?? ??:0
D/TC:4 0 0x000000003f006298 thread_std_smc_entry at optee_os/core/arch/arm/kernel/thread_optee_smc_a64.S:162

The addresses that cannot be resolved happen to be inside section
.text_pageable, not .text (excerpt from readelf -e tee.elf):

[Nr] Name Type Address Offset
[ 1] .text PROGBITS 000000003f000000 00010000
[11] .text_pageable PROGBITS 000000003f05f388 0006f388

This commit choses a different approch. Instead of using relative
addresses, we keep absolute ones but correct them with the load address
in the ELF file:

corrected address = supplied address - runtime start address
+ link time load address

Fixes: 105e09c24479 ("symbolize.py: add support for TEE core ASLR")
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# d77929ec 27-Nov-2019 Sumit Garg <sumit.garg@linaro.org>

core: ftrace: dump core load address to support ASLR

Additionally dump core address in ftrace buffer to support syscall
tracing in case TEE core ASLR is enabled.

Signed-off-by: Sumit Garg <sumit.ga

core: ftrace: dump core load address to support ASLR

Additionally dump core address in ftrace buffer to support syscall
tracing in case TEE core ASLR is enabled.

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Reviewed-by: Jerome Forissier <jerome@forissier.org>
[jf: s/Load address @/TEE load address @/]
Signed-off-by: Jerome Forissier <jerome@forissier.org>

show more ...


# 91068f86 26-Nov-2019 Jerome Forissier <jerome@forissier.org>

symbolize.py: fix decoding of ftrace dumps containing syscalls

When decoding an ftrace file with syscall tracing enabled [1], the
kernel functions are not resolved and show question marks instead.

symbolize.py: fix decoding of ftrace dumps containing syscalls

When decoding an ftrace file with syscall tracing enabled [1], the
kernel functions are not resolved and show question marks instead.

[1] $ make CFG_FTRACE_SUPPORT=y CFG_SYSCALL_FTRACE=y CFG_ULIBS_MCOUNT=y \
CFLAGS_ta_arm32=-pg
[run test and copy content of /tmp/ftrace*]
$ optee_os/scripts/symbolize.py -d optee_os/out/arm/core \
-d out-br/build/optee_test-1.0/ta/*/out
[paste ftrace log here]

Fixes: 105e09c24479 ("symbolize.py: add support for TEE core ASLR")
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>

show more ...


# 105e09c2 16-Oct-2019 Jerome Forissier <jerome@forissier.org>

symbolize.py: add support for TEE core ASLR

With the introduction of ASLR, the abort and panic dumps for the TEE
core have gained a "Load address" line. Update the symbolize.py script
to parse that

symbolize.py: add support for TEE core ASLR

With the introduction of ASLR, the abort and panic dumps for the TEE
core have gained a "Load address" line. Update the symbolize.py script
to parse that line and pass relative addresses to addr2line.

Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Jerome Forissier <jerome@forissier.org>

show more ...


# 099918f6 05-Sep-2019 Sumit Garg <sumit.garg@linaro.org>

ftrace: Add support for syscall function tracer

This patch adds support for syscall tracing in TEE core. It complements
existing ftrace support for user TAs via adding trace for syscalls that
are in

ftrace: Add support for syscall function tracer

This patch adds support for syscall tracing in TEE core. It complements
existing ftrace support for user TAs via adding trace for syscalls that
are invoked by user TAs into the TEE core.

And after this patch ftrace will cover both TA and TEE core code. So lets
rename config option from CFG_TA_FTRACE_SUPPORT to CFG_FTRACE_SUPPORT.

It is optional to enable syscall trace via CFG_SYSCALL_FTRACE=y config
option in addition to CFG_FTRACE_SUPPORT=y config option.

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Reviewed-by: Jerome Forissier <jerome@forissier.org>

show more ...


# 20d152b8 25-Sep-2019 Jerome Forissier <jerome@forissier.org>

symbolize.py: fix exception when stdin is not a terminal

Commit 6b4fc6752b3c ("symbolize.py: disable terminal local echo") uses
termios functions on stdin unconditionally. Unfortunately, this will
c

symbolize.py: fix exception when stdin is not a terminal

Commit 6b4fc6752b3c ("symbolize.py: disable terminal local echo") uses
termios functions on stdin unconditionally. Unfortunately, this will
cause an exception when stdin is not a terminal, for instance:

$ echo Hello | ./script/symbolize.py
Traceback (most recent call last):
File "./scripts/symbolize.py", line 497, in <module>
main()
File "./scripts/symbolize.py", line 484, in main
old = termios.tcgetattr(fd)
termios.error: (25, 'Inappropriate ioctl for device')

Fix the issue by making sure stdin is a TTY before using the termios
functions.

Fixes: 6b4fc6752b3c ("symbolize.py: disable terminal local echo")
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# 6b4fc675 23-Sep-2019 Jerome Forissier <jerome@forissier.org>

symbolize.py: disable terminal local echo

When scripts/symbolize.py is used interactively and the input data is
copied and pasted into the terminal, both the input and output text are
displayed on t

symbolize.py: disable terminal local echo

When scripts/symbolize.py is used interactively and the input data is
copied and pasted into the terminal, both the input and output text are
displayed on the same screen. There is nothing preventing both text
streams from mixing up because it depends on buffering and how Python
reads and flushes its buffers.

Things usually go well with Python 2, but I have observed that Python 3
is more problematic. So the issue needs to be properly addressed. This
patch temporarily disables local echo so that only the processed text is
shown.

Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# bbaeed4d 07-Aug-2019 Rouven Czerwinski <r.czerwinski@pengutronix.de>

scripts: convert remainging scripts to python3

Convert the remaining scripts to python3. Mostly done with 2to3 and
manual adjustements to the code afterwards.

Signed-off-by: Rouven Czerwinski <r.cz

scripts: convert remainging scripts to python3

Convert the remaining scripts to python3. Mostly done with 2to3 and
manual adjustements to the code afterwards.

Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Acked-by: Jerome Forissier <jerome@forissier.org>
Tested-by: Jerome Forissier <jerome@forissier.org> (QEMU, QEMUv8)

show more ...


# 531963a5 23-May-2019 Jens Wiklander <jens.wiklander@linaro.org>

core: dump user TA memory map and call stack with ldelf

Enters special ldelf dump function to dump user TA memory map.

scripts/symbolize.py patch by Jerome Forissier

Reviewed-by: Jerome Forissier

core: dump user TA memory map and call stack with ldelf

Enters special ldelf dump function to dump user TA memory map.

scripts/symbolize.py patch by Jerome Forissier

Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: [symbolize.py] Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# c90b6663 28-Mar-2019 Sumit Garg <sumit.garg@linaro.org>

symbolize.py: add support to symbolize TA ftrace addresses

Add supoort to symbolize function graph addresses for instrumented TA.

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Reviewed-by: Joak

symbolize.py: add support to symbolize TA ftrace addresses

Add supoort to symbolize function graph addresses for instrumented TA.

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (HiKey960)

show more ...


# 444c203e 13-Mar-2019 Jerome Forissier <jerome.forissier@linaro.org>

scripts/symbolize.py: accept several spaces after "region"

User TA crash dumps were slightly modified to better align region
numbers. scripts/symbolize.py needs to be updated accordingly.

Fixes: db

scripts/symbolize.py: accept several spaces after "region"

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>

show more ...


# b6bc49ca 17-Jan-2019 Sumit Garg <sumit.garg@linaro.org>

trace: fix core id print if in non-atomic context

Make "?" print repetitive equivalent to number of digits needed to display
core id rather than extra spaces as it causes symbolize.py script parsing

trace: fix core id print if in non-atomic context

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>

show more ...


# 6e7c2e91 14-Nov-2018 Jerome Forissier <jerome.forissier@linaro.org>

symbolize.py: fix issues reported by pycodestyle and re-indent

Fixes issues reported by: pycodestyle symbolize.py and re-indent
(4 spaces).
Patch obtained by running: autopep8 -i -a -a symbolize.py

symbolize.py: fix issues reported by pycodestyle and re-indent

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>

show more ...


12