fs/dup: remove unnecessary backup about fdcheck_tag and fdsan_tag
1. The call to file_close_without_clear in file_dup3 does not clear the tag information, so there is no need to back it up. 2. file_dup3 don't need to copy tag information, tag is only valid for fd. Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
parent
3bc3092e6a
commit
70fc5c3e77
3 changed files with 0 additions and 52 deletions
|
|
@ -263,12 +263,6 @@ int nx_dup3_from_tcb(FAR struct tcb_s *tcb, int fd1, int fd2, int flags)
|
|||
FAR struct filelist *list;
|
||||
FAR struct file *filep1;
|
||||
FAR struct file *filep;
|
||||
#ifdef CONFIG_FDCHECK
|
||||
uint8_t f_tag_fdcheck;
|
||||
#endif
|
||||
#ifdef CONFIG_FDSAN
|
||||
uint64_t f_tag_fdsan;
|
||||
#endif
|
||||
bool new = false;
|
||||
int count;
|
||||
int ret;
|
||||
|
|
@ -313,14 +307,6 @@ int nx_dup3_from_tcb(FAR struct tcb_s *tcb, int fd1, int fd2, int flags)
|
|||
fd2 % CONFIG_NFILE_DESCRIPTORS_PER_BLOCK,
|
||||
&new);
|
||||
|
||||
#ifdef CONFIG_FDSAN
|
||||
f_tag_fdsan = filep->f_tag_fdsan;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FDCHECK
|
||||
f_tag_fdcheck = filep->f_tag_fdcheck;
|
||||
#endif
|
||||
|
||||
/* Perform the dup3 operation */
|
||||
|
||||
ret = file_dup3(filep1, filep, flags);
|
||||
|
|
@ -336,14 +322,6 @@ int nx_dup3_from_tcb(FAR struct tcb_s *tcb, int fd1, int fd2, int flags)
|
|||
return ret;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_FDSAN
|
||||
filep->f_tag_fdsan = f_tag_fdsan;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FDCHECK
|
||||
filep->f_tag_fdcheck = f_tag_fdcheck;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FDCHECK
|
||||
return fdcheck_protect(fd2);
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -57,13 +57,7 @@ int file_dup(FAR struct file *filep, int minfd, int flags)
|
|||
FAR struct file *filep2;
|
||||
int fd2;
|
||||
int ret;
|
||||
#ifdef CONFIG_FDSAN
|
||||
uint64_t f_tag_fdsan; /* File owner fdsan tag, init to 0 */
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FDCHECK
|
||||
uint8_t f_tag_fdcheck; /* File owner fdcheck tag, init to 0 */
|
||||
|
||||
minfd = fdcheck_restore(minfd);
|
||||
#endif
|
||||
|
||||
|
|
@ -74,23 +68,9 @@ int file_dup(FAR struct file *filep, int minfd, int flags)
|
|||
}
|
||||
|
||||
ret = fs_getfilep(fd2, &filep2);
|
||||
#ifdef CONFIG_FDSAN
|
||||
f_tag_fdsan = filep2->f_tag_fdsan;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FDCHECK
|
||||
f_tag_fdcheck = filep2->f_tag_fdcheck;
|
||||
#endif
|
||||
DEBUGASSERT(ret >= 0);
|
||||
|
||||
ret = file_dup3(filep, filep2, flags);
|
||||
#ifdef CONFIG_FDSAN
|
||||
filep2->f_tag_fdsan = f_tag_fdsan;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FDCHECK
|
||||
filep2->f_tag_fdcheck = f_tag_fdcheck;
|
||||
#endif
|
||||
|
||||
fs_putfilep(filep2);
|
||||
if (ret >= 0)
|
||||
|
|
|
|||
|
|
@ -163,16 +163,6 @@ int file_dup3(FAR struct file *filep1, FAR struct file *filep2, int flags)
|
|||
}
|
||||
}
|
||||
|
||||
/* Copy tag */
|
||||
|
||||
#ifdef CONFIG_FDSAN
|
||||
filep2->f_tag_fdsan = filep1->f_tag_fdsan;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FDCHECK
|
||||
filep2->f_tag_fdcheck = filep1->f_tag_fdcheck;
|
||||
#endif
|
||||
|
||||
FS_ADD_BACKTRACE(filep2);
|
||||
return OK;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue