






















sys_execve
└─ do_execveat_common() [ENOMEM, E2BIG]
└─ bprm_execve()
├─ do_open_execat() [ENOENT, ENOTDIR, ELOOP, EACCES=13, ETXTBSY]
│ ├─ do_filp_open() [ENOENT, ENOTDIR, ELOOP]
│ ├─ may_open / MAY_EXEC [EACCES=13] ← 无执行位 / LSM 拒绝
│ ├─ S_ISREG + path_noexec [EACCES=13] ← 非普通文件 / noexec 挂载
│ └─ deny_write_access() [ETXTBSY]
│
├─ prepare_binprm() 读 128B 文件头 [EIO]
│
└─ exec_binprm()
└─ search_binary_handler() [ENOEXEC=8] ← 所有 handler 拒绝
└─ fmt->load_binary()
└─ load_elf_binary()
├─ 校验 e_ident/e_machine/EI_CLASS [ENOEXEC=8] ← 架构不匹配
├─ 校验段/权限 [ENOEXEC=8, EINVAL]
├─ open interpreter (ld.so) [EACCES=13, ENOENT] ← 再次走 open_exec
├─ vm_mmap 映射段 [ENOMEM, EACCES=13]
└─ point_of_no_return 之后失败 → SIGSEGV / SIGKILL(不返回 errno)
提示:"Exec format error"
源码:
fs/exec.c

返回 ENOEXEC
系统调用
do_execveat_common -> bprm_execve -> exec_binprm -> search_binary_handler -> fmt接口方法 -> load_elf_binary()
一般提示:"Permission denied"
do_open_execat 的 rwx 类型权限检查
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。