Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

symbol: Fix uninitialized 'sec_iter' in the 'arch_load_dynsymtab_noplt' #1989

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yskelg
Copy link
Contributor

@yskelg yskelg commented Jan 8, 2025

The struct uftrace_elf_iter sec_iter is being used without initialization, and only specific values are being copied. This can lead to unexpected behavior in the copied other iters.

SUMMARY: MemorySanitizer: use-of-uninitialized-value
 arch/x86_64/symbol.c:33:14 in arch_load_dynsymtab_noplt
Exiting
==2474640==WARNING: MemorySanitizer: use-of-uninitialized-value ==2474525==WARNING: MemorySanitizer: use-of-uninitialized-value ==2474780==WARNING: MemorySanitizer: use-of-uninitialized-value
 0 0x55985b0a1f46 in arch_load_dynsymtab_noplt arch/x86_64/symbol.c:33
 1 0x55985b0792f7 in load_dynsymtab utils/symbol.c:726:2
 2 0x55985b05bb30 in load_module_symbol utils/symbol.c:1111:2
 3 0x55985b05a3fe in load_module_symtab utils/symbol.c:1144:2
 4 0x55985b05db5f in load_module_symtabs utils/symbol.c:1220:14
 5 0x55985adb5b34 in load_session_symbols cmds/record.c:1482:3
 6 0x55985ada6e0e in write_symbol_files cmds/record.c:2036:2
 7 0x55985ad923d1 in do_main_loop cmds/record.c:2142:2
 8 0x55985ad8ce9a in command_record cmds/record.c:2311:9
 9 0x55985acf190a in main uftrace.c:1534:9

The `struct uftrace_elf_iter sec_iter` is being used without
initialization, and only specific values are being copied.
This can lead to unexpected behavior in the copied other iters.

SUMMARY: MemorySanitizer: use-of-uninitialized-value
 arch/x86_64/symbol.c:33:14 in arch_load_dynsymtab_noplt
Exiting
==2474640==WARNING: MemorySanitizer: use-of-uninitialized-value
==2474525==WARNING: MemorySanitizer: use-of-uninitialized-value
==2474780==WARNING: MemorySanitizer: use-of-uninitialized-value
 0 0x55985b0a1f46 in arch_load_dynsymtab_noplt arch/x86_64/symbol.c:33
 1 0x55985b0792f7 in load_dynsymtab utils/symbol.c:726:2
 2 0x55985b05bb30 in load_module_symbol utils/symbol.c:1111:2
 3 0x55985b05a3fe in load_module_symtab utils/symbol.c:1144:2
 4 0x55985b05db5f in load_module_symtabs utils/symbol.c:1220:14
 5 0x55985adb5b34 in load_session_symbols cmds/record.c:1482:3
 6 0x55985ada6e0e in write_symbol_files cmds/record.c:2036:2
 7 0x55985ad923d1 in do_main_loop cmds/record.c:2142:2
 8 0x55985ad8ce9a in command_record cmds/record.c:2311:9
 9 0x55985acf190a in main uftrace.c:1534:9

Signed-off-by: Yunseong Kim <yskelg@gmail.com>
Copy link
Owner

@namhyung namhyung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change looks good to me. But I wonder there are other places to use this iterator that need the same kind of changes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants