lib_fdopendir.c:Fix crash in fdopendir caused by fdsan
Summary: Add fdsan check in fdopendir, fdsan can work normally when using fdopendir Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
This commit is contained in:
parent
ba5091d2f7
commit
2e8e37bbf8
|
@ -27,6 +27,10 @@
|
|||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef CONFIG_FDSAN
|
||||
# include <android/fdsan.h>
|
||||
#endif
|
||||
|
||||
#include "libc.h"
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -83,5 +87,12 @@ FAR DIR *fdopendir(int fd)
|
|||
}
|
||||
|
||||
dir->fd = fd;
|
||||
|
||||
#ifdef CONFIG_FDSAN
|
||||
android_fdsan_exchange_owner_tag(fd, 0,
|
||||
android_fdsan_create_owner_tag(ANDROID_FDSAN_OWNER_TYPE_DIR,
|
||||
(uintptr_t)dir));
|
||||
#endif
|
||||
|
||||
return dir;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue