| #
0fcbddd4 |
| 11-Nov-2015 |
SY Chiu <sy.chiu@linaro.org> |
debug: enable bget memory leak detection
This patch enables memory leak detection in bget_malloc.c. This is very helpful to find memory leakage issue in teecore or user TA. To enable it in teecore,
debug: enable bget memory leak detection
This patch enables memory leak detection in bget_malloc.c. This is very helpful to find memory leakage issue in teecore or user TA. To enable it in teecore, build optee_os with `CFG_TEE_CORE_MALLOC_DEBUG=y`. For user TA, build optee_os with `CFG_TEE_TA_MALLOC_DEBUG=y`.
Then, add the following statement at some point of your code that might frequently been triggered:
mdbg_check(1);
It will dump allocated memory blocks and the holders of them. If you find a memory block appears multiple times after the system runs a period of time, it is very likely the source of memory leakage.
Here is an example output:
ERR TEE-CORE:mdbg_check:720: Orphaned buffer: 0 bytes core/tee/tee_svc_storage.c:260 ERR TEE-CORE:mdbg_check:720: Orphaned buffer: 104 bytes core/tee/tee_svc_storage.c:444 ERR TEE-CORE:mdbg_check:720: Orphaned buffer: 18 bytes core/tee/tee_pobj.c:119 ERR TEE-CORE:mdbg_check:720: Orphaned buffer: 56 bytes core/tee/tee_pobj.c:110 ERR TEE-CORE:mdbg_check:720: Orphaned buffer: 192 bytes core/arch/arm/mm/tee_mmu.c:93 ERR TEE-CORE:mdbg_check:720: Orphaned buffer: 32 bytes core/arch/arm/mm/tee_mmu.c:241 ERR TEE-CORE:mdbg_check:720: Orphaned buffer: 24 bytes core/arch/arm/mm/tee_mm.c:75 ERR TEE-CORE:mdbg_check:720: Orphaned buffer: 24 bytes core/arch/arm/mm/tee_mm.c:75 ERR TEE-CORE:mdbg_check:720: Orphaned buffer: 224 bytes core/arch/arm/kernel/tee_ta_manager.c:573 ERR TEE-CORE:mdbg_check:720: Orphaned buffer: 72 bytes core/arch/arm/kernel/tee_ta_manager.c:1202 ERR TEE-CORE:mdbg_check:720: Orphaned buffer: 7 bytes lib/libutils/isoc/strdup.c:34 ERR TEE-CORE:mdbg_check:720: Orphaned buffer: 7 bytes lib/libutils/isoc/strdup.c:34 ERR TEE-CORE:mdbg_check:720: Orphaned buffer: 7 bytes lib/libutils/isoc/strdup.c:34 ERR TEE-CORE:mdbg_check:720: Orphaned buffer: 7 bytes lib/libutils/isoc/strdup.c:34 ERR TEE-CORE:mdbg_check:720: Orphaned buffer: 32 bytes core/kernel/handle.c:70 ERR TEE-CORE:mdbg_check:720: Orphaned buffer: 24 bytes core/arch/arm/mm/tee_mm.c:48 ERR TEE-CORE:mdbg_check:720: Orphaned buffer: 24 bytes core/arch/arm/mm/tee_mm.c:48 ERR TEE-CORE:mdbg_check:720: Orphaned buffer: 24 bytes core/arch/arm/mm/tee_mm.c:48 ERR TEE-CORE:mdbg_check:720: Ignore buffer: 16 bytes lib/libutils/isoc/bget_malloc.c:794
You can see the buffer hold by strdup.c:34 appears 4 times, so it's very likely to be the source of memory leakage.
Signed-off-by: SY Chiu <sy.chiu@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (HiKey) Tested-by: SY Chiu <sy.chiu@linaro.org> (MT8173 EVB)
show more ...
|
| #
45082335 |
| 30-Oct-2015 |
Jens Wiklander <jens.wiklander@linaro.org> |
libutils: make malloc thread-safe
Makes malloc family of functions thread-safe by using an internal mutex when compiled to be used in TEE Core.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.
libutils: make malloc thread-safe
Makes malloc family of functions thread-safe by using an internal mutex when compiled to be used in TEE Core.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
show more ...
|
| #
dffb0049 |
| 23-Oct-2015 |
Jerome Forissier <jerome.forissier@linaro.org> |
plat-*/conf.mk cleanup
- Do not set CFG_ values that do not change the default - Remove a few useless -D<flag> - Always use '?=' as opposed to ':=' for consistent behavior with 'CFG_FOO=y make' an
plat-*/conf.mk cleanup
- Do not set CFG_ values that do not change the default - Remove a few useless -D<flag> - Always use '?=' as opposed to ':=' for consistent behavior with 'CFG_FOO=y make' and 'make CFG_FOO=y' => Use this form when both enabled and disabled are valid options - Add macro: $(call force,CFG_FOO,y) to set a variable and make sure it does not conflict with external values that may be given on the command line or in the environment => Use this form when the variable can only have the specified value (any other value would be invalid). 'override CFG_FOO := y' would be correct, too, but would not detect conflicting values. - Always include mk/conf.mk last so that the platform definitions always take precedence over the global configuration
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Pascal Brand <pascal.brand@linaro.org>
show more ...
|
| #
bc420748 |
| 05-May-2015 |
Jens Wiklander <jens.wiklander@linaro.org> |
TA as ELF + signature
Changes format of TA to use the ELF format instead. This patch also adds signature checking of the TA. The format of the TA is: <Signed header> <ELF header> <Program header> (p
TA as ELF + signature
Changes format of TA to use the ELF format instead. This patch also adds signature checking of the TA. The format of the TA is: <Signed header> <ELF header> <Program header> (part of ELF spec, pointing out segments to load) <Sections>
A struct ta_head is placed in the first section of the first segment to carry flags and other properties of the TA.
elf32.h, elf64.h and elf_common.h are imported from FreeBSD.
In addition to the R_ARM_RELATIVE relocation type, adds support for R_ARM_ABS32 relocations. Since a symbol table is needed to process this relocation type a separate program header is added in the TA ELF containing the sections .dynamic, .dynsym, .dynstr and .hash. These sections are only needed during relocation and could be released once the TA is relocated.
A default signing key has been generated with openssl genrsa -out key.pem and added as keys/default_ta.pem
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Tested-by: Jens Wiklander <jens.wiklander@linaro.org> (QEMU, FVP) Reviewed-by: Pascal Brand <pascal.brand@linaro.org> Tested-by: Pascal Brand <pascal.brand@linaro.org> (STM platform) Tested-by: Pascal Brand <pascal.brand@linaro.org> (QEMU platform) Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (HiKey)
show more ...
|
| #
3354f9b2 |
| 15-Apr-2015 |
Jerome Forissier <jerome.forissier@linaro.org> |
mk/checkconf.mk: update generation of conf.mk
Make generation of conf.mk more consistent with what we do for conf.h, that is: - conf.mk shall not be touched if its content does not change, - write "
mk/checkconf.mk: update generation of conf.mk
Make generation of conf.mk more consistent with what we do for conf.h, that is: - conf.mk shall not be touched if its content does not change, - write "CHK" when checking the file, then "UPD" only if it needs updating.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Pascal Brand <pascal.brand@linaro.org>
show more ...
|
| #
120c43ad |
| 24-Mar-2015 |
Jerome Forissier <jerome.forissier@linaro.org> |
Convert configuration variables to CFG_* name
- Rename configuration variables that do not follow the CFG_* convention - Delete useless -D<VAR> compiler flags - Slightly reformat mk/conf.mk, add com
Convert configuration variables to CFG_* name
- Rename configuration variables that do not follow the CFG_* convention - Delete useless -D<VAR> compiler flags - Slightly reformat mk/conf.mk, add comments
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
8a1e7b89 |
| 30-Mar-2015 |
Jerome Forissier <jerome.forissier@linaro.org> |
Rename CFG_TRACE_LEVEL to TRACE_LEVEL
The trace level macro is not meant to be configured directly, it takes its value from CFG_TEE_CORE_LOG_LEVEL (when the TEE core is compiled) or from CFG_TEE_TA_
Rename CFG_TRACE_LEVEL to TRACE_LEVEL
The trace level macro is not meant to be configured directly, it takes its value from CFG_TEE_CORE_LOG_LEVEL (when the TEE core is compiled) or from CFG_TEE_TA_LOG_LEVEL (when user libraries are compiled). Therefore it should not have a CFG_ prefix.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
153c4954 |
| 19-Mar-2015 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: split arm32.h
Splits arm32.h into one ARM generic arm.h and one ARM32 specific arm32.h. arm32.h should not be included directly, arm.h should be included instead.
Signed-off-by: Jens Wiklande
core: split arm32.h
Splits arm32.h into one ARM generic arm.h and one ARM32 specific arm32.h. arm32.h should not be included directly, arm.h should be included instead.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Pascal Brand <pascal.brand@linaro.org>
show more ...
|
| #
b6106707 |
| 18-Mar-2015 |
Jerome Forissier <jerome.forissier@linaro.org> |
Get rid of CROSS_PREFIX, restore CROSS_COMPILE
Use CROSS_COMPILE to set the cross-compiler (CROSS_PREFIX is not supported anymore). Use CROSS_COMPILE_core and CROSS_COMPILE_user_ta to override the c
Get rid of CROSS_PREFIX, restore CROSS_COMPILE
Use CROSS_COMPILE to set the cross-compiler (CROSS_PREFIX is not supported anymore). Use CROSS_COMPILE_core and CROSS_COMPILE_user_ta to override the compiler for TEE core and user space code (Trusted Applications), respectively.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Pascal Brand <pascal.brand@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
show more ...
|
| #
1b4eb4f5 |
| 02-Feb-2015 |
Jens Wiklander <jens.wiklander@linaro.org> |
Separate compiler for core and user TA
Enables compilation with different compilers for core and user TA.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Tested-by: Jens Wiklander <jens.w
Separate compiler for core and user TA
Enables compilation with different compilers for core and user TA.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Tested-by: Jens Wiklander <jens.wiklander@linaro.org> (QEMU, FVP) Reviewed-by: Pascal Brand <pascal.brand@linaro.org>
show more ...
|
| #
dde0e235 |
| 26-Feb-2015 |
etienne carriere <etienne.carriere@st.com> |
load/generate TEE Core build configuration file
At build time, conf.in file is generated at output root core directory.
At build entry, if CFG_OPTEE_CONFIG is defined, it specifies the path of the
load/generate TEE Core build configuration file
At build time, conf.in file is generated at output root core directory.
At build entry, if CFG_OPTEE_CONFIG is defined, it specifies the path of the target TEE Core build configuration to use.
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Tested-by: Etienne CARRIERE <etienne.carriere@st.com> Reviewed-by: Pascal BRAND <pascal.brand@st.com> Reviewed-by: Etienne CARRIERE <etienne.carriere@st.com>
show more ...
|
| #
a3911433 |
| 19-Dec-2014 |
Jerome Forissier <jerome.forissier@linaro.org> |
core: get value of CFG_ variables directly from generated/conf.h
Add a '-include' preprocessor flag to the command line so that all TEE core files include generated/conf.h automatically. Then, there
core: get value of CFG_ variables directly from generated/conf.h
Add a '-include' preprocessor flag to the command line so that all TEE core files include generated/conf.h automatically. Then, there is no need to define macros via the command line (-DCFG_XYZ=...).
This commit also fixes a compile error when CFG_TEE_CORE_EMBED_INTERNAL_TESTS=0.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Pascal Brand <pascal.brand@linaro.org> Tested-by: Pascal Brand <pascal.brand@linaro.org> (STM platform)
show more ...
|
| #
4de4bebc |
| 20-Oct-2014 |
Jens Wiklander <jens.wiklander@linaro.org> |
Merge tee_{core,uta}_trace.h into libutil
Merges tee_core_trace.h and tee_uta_trace.h into a common trace.h in libutil. Since the trace functions now resides libutil they have to rely on core and li
Merge tee_{core,uta}_trace.h into libutil
Merges tee_core_trace.h and tee_uta_trace.h into a common trace.h in libutil. Since the trace functions now resides libutil they have to rely on core and libutee to provide functions to print to the log device.
* Keeps compatible interface from tee_kta_trace.h * Adds TAMSG() and TAMSG_RAW() to log TA related events * Removes the TRACE_ALWAYS level
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Tested-by: Jens Wiklander <jens.wiklander@linaro.org> (QEMU virt platform) Reviewed-by: Etienne Carriere <etienne.carriere@st.com> Reviewed-by: Pascal Brand <pascal.brand@linaro.org> Tested-by: Pascal Brand <pascal.brand@linaro.org> (STM platform)
show more ...
|
| #
fe52b1f5 |
| 06-Nov-2014 |
Jerome Forissier <jerome.forissier@linaro.org> |
core: create conf.h from CFG_* Makefile variables
Simplify the use of makefile configuration variables from C code. With this patch, one can #include <generated/conf.h> instead of adding CPP flags d
core: create conf.h from CFG_* Makefile variables
Simplify the use of makefile configuration variables from C code. With this patch, one can #include <generated/conf.h> instead of adding CPP flags definitions to the .mk files.
- CFG_* variables that are set to 'y' are converted to: #define CFG_FOO 1 - Undefined variables, or variables set to 'n' remain undefined in conf.h - CFG_* variables with any other value are output unchanged
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Pascal Brand <pascal.brand@linaro.org>
show more ...
|
| #
f8baf582 |
| 07-Nov-2014 |
Jerome Forissier <jerome.forissier@linaro.org> |
core/core.mk, mk/config.mk: delete unused definitions
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Pascal Brand <pascal.brand@linaro.org>
|
| #
4334e8d7 |
| 08-Sep-2014 |
Jerome Forissier <jerome.forissier@linaro.org> |
Makefile variables $(*-dir) should not have a trailing slash
As a general rule, Makefile variables that are directories should not have a trailing slash, and should be used as: $(some-dir)/some-file
Makefile variables $(*-dir) should not have a trailing slash
As a general rule, Makefile variables that are directories should not have a trailing slash, and should be used as: $(some-dir)/some-file rather than $(some-dir)some-file. This is more readable.
show more ...
|
| #
0047cb63 |
| 01-Sep-2014 |
Jerome Forissier <jerome.forissier@linaro.org> |
Cosmetic fixes for build output
By default, the OP-TEE build shows abbreviated output similar to the Linux kernel. This commit fixes a number of deviations/inconsistencies.
- Always print a command
Cosmetic fixes for build output
By default, the OP-TEE build shows abbreviated output similar to the Linux kernel. This commit fixes a number of deviations/inconsistencies.
- Always print a command in uppercase, followed by the target file. - Make sure commands and file paths are nicely aligned, with two leading spaces to make command output/errors better stand out. - Remove some duplicate slashes in file paths. We use the following rule: variables that hold directory names such as $(arch-dir) or $(platform-dir) always have a trailing slash. The 'subdirs' and 'incdirs' variables used in sub-makefiles are an exception because doing otherwise would needlessly clutter the sub-makefiles.
show more ...
|
| #
c0346845 |
| 05-Jun-2014 |
Jens Wiklander <jens.wiklander@linaro.org> |
Add plat-vexpress
* Initial support for Versatile Express of FVP with ARM Trusted Firmware (ATF below)
* Use entry vector for entering TEE
Align interface between TEE and secure monitor with t
Add plat-vexpress
* Initial support for Versatile Express of FVP with ARM Trusted Firmware (ATF below)
* Use entry vector for entering TEE
Align interface between TEE and secure monitor with the interface between OPTEED in ATF and TEE.
Uses an ATF compatible entry vector for entering TEE from internal secure monitor.
Internal secure monitor saves entry reason to be able to tell when switching back to nonsecure world if r0-r3 should be preserved (FIQ case) or returned as is (normal call case).
* Many small fixes of generic problems that could affect other platforms too.
* Disable unaligned data accesses by adding compiler flag -mno-unaligned-access
* Adds support for Versatile Express of QEMU with 8 MiB of secure DRAM
show more ...
|
| #
b0104773 |
| 12-Jun-2014 |
Pascal Brand <pascal.brand@st.com> |
Open-source the TEE Core
Signed-off-by: Pascal Brand <pascal.brand@st.com>
|