gpt4 book ai didi

android - 错误 : unaligned opcodes detected in executable segment

转载 作者:行者123 更新时间:2023-12-02 10:42:40 27 4
gpt4 key购买 nike

https://github.com/secmob/PoCForCVE-2015-1528 编译 CVE-2015-1528 的 poc 时通过ndk-build,出现这个错误:

[armeabi] Compile++ thumb: exploitmedia <= shellcode.cpp
/home/android/Desktop/work_space/PoCForCVE-2015-1528/mediaserver/jni/shellcode.cpp:109:38: warning: always_inline function might not be inlinable [-Wattributes]
__attribute__((always_inline)) void *run_code(char *code,dlopen_t dlopen_f){
^
/tmp/ccd5ZsxF.s: Assembler messages:
/tmp/ccd5ZsxF.s: Error: unaligned opcodes detected in executable segment
make: *** [/home/android/Desktop/work_space/PoCForCVE-2015-1528/mediaserver/obj/local/armeabi/objs/exploitmedia/shellcode.o] Error 1

注意:编译此 poc 的目的是教育。

最佳答案

未使用的自动分配变量可能会导致 --gdwarf-2 出现此问题

我不太了解这个问题,但这里有一个最小的可运行示例。

考虑这个 Linux ARMv8 hello world:

.text
.global _start
_start:
asm_main_after_prologue:
/* write */
mov x0, #1
ldr x1, =msg
ldr x2, =len
mov x8, #64
svc #0

/* exit */
mov x0, #0
mov x8, #93
svc #0
msg:
.ascii "hello syscall v8\n"
len = . - msg

可以很好地组装:

aarch64-linux-gnu-as --gdwarf-2 hello.S

在 Ubuntu 16.04 aarch64-linux-gnu-gcc 5.4.0 上。

现在,如果您删除对 msg 变量的引用:

.text
.global _start
_start:
asm_main_after_prologue:
/* exit */
mov x0, #0
mov x8, #93
svc #0
msg:
.ascii "hello syscall v8\n"
len = . - msg

它开始失败:

hello.S: Assembler messages:
hello.S: Error: unaligned opcodes detected in executable segment

所以不知何故,当引用被删除时,它一定认为 hello syscall v8 字符串是指令而不是数据。

关于android - 错误 : unaligned opcodes detected in executable segment,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32687459/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com