fix: change the execFile field in TCB to execVnode

TEE需要借用TCB中的execFile来校验打开的文件,pagecache修改后,可执行程序在mmap之后,会被立即关闭,因此将execFile改为execVnode

close: #I4CLL9

Signed-off-by: Leon Chan <chenwei26@huawei.com>
This commit is contained in:
Leon Chan 2021-09-30 14:29:28 +08:00
parent c7da23695c
commit e4a06623ce
3 changed files with 4 additions and 3 deletions

View File

@ -434,7 +434,6 @@ int VnodeLookupAt(const char *path, struct Vnode **result, uint32_t flags, struc
currentVnode->filePath[vnodePathLen] = 0;
}
}
return ret;
OUT_FREE_PATH:
if (normalizedPath) {

View File

@ -121,7 +121,7 @@ typedef struct ProcessCB {
TimerIdMap timerIdMap;
#endif
#ifdef LOSCFG_DRIVERS_TZDRIVER
struct file *execFile; /**< Exec bin of the process */
struct Vnode *execVnode; /**< Exec bin of the process */
#endif
mode_t umask;
#ifdef LOSCFG_KERNEL_CPUP

View File

@ -223,12 +223,14 @@ STATIC INT32 OsReadEhdr(const CHAR *fileName, ELFInfo *elfInfo, BOOL isExecFile)
#ifdef LOSCFG_DRIVERS_TZDRIVER
if (isExecFile) {
ret = fs_getfilep(GetAssociatedSystemFd(elfInfo->procfd), &OsCurrProcessGet()->execFile);
struct file *filep;
ret = fs_getfilep(GetAssociatedSystemFd(elfInfo->procfd), &filep);
if (ret) {
PRINT_ERR("%s[%d], Failed to get struct file %s!\n", __FUNCTION__, __LINE__, fileName);
/* File will be closed by OsLoadELFFile */
return ret;
}
OsCurrProcessGet()->execVnode = filep->f_vnode;
}
#endif
ret = OsReadELFInfo(elfInfo->procfd, (UINT8 *)&elfInfo->elfEhdr, sizeof(LD_ELF_EHDR), 0);