[sys_bind] [signalfd] update (#8507)
This commit is contained in:
parent
0e409a6eb1
commit
0c96b26c23
|
@ -6,9 +6,8 @@ cwd = GetCurrentDir()
|
||||||
src = []
|
src = []
|
||||||
CPPPATH = [cwd]
|
CPPPATH = [cwd]
|
||||||
|
|
||||||
if GetDepend('RT_USING_DFS'):
|
if GetDepend('RT_USING_POSIX_SIGNALFD'):
|
||||||
if GetDepend('RT_USING_MUSLLIBC'):
|
src += ['signalfd.c']
|
||||||
src += ['signalfd.c']
|
|
||||||
|
|
||||||
group = DefineGroup('POSIX', src, depend = ['RT_USING_SMART','RT_USING_POSIX_SIGNALFD'], CPPPATH = CPPPATH)
|
group = DefineGroup('POSIX', src, depend = ['RT_USING_SMART','RT_USING_POSIX_SIGNALFD'], CPPPATH = CPPPATH)
|
||||||
|
|
||||||
|
|
|
@ -3292,6 +3292,7 @@ sysret_t sys_bind(int socket, const struct musl_sockaddr *name, socklen_t namele
|
||||||
{
|
{
|
||||||
rt_err_t ret = 0;
|
rt_err_t ret = 0;
|
||||||
struct sockaddr sa;
|
struct sockaddr sa;
|
||||||
|
struct sockaddr_un un_addr;
|
||||||
struct musl_sockaddr kname;
|
struct musl_sockaddr kname;
|
||||||
rt_uint16_t family = 0;
|
rt_uint16_t family = 0;
|
||||||
|
|
||||||
|
@ -3301,14 +3302,24 @@ sysret_t sys_bind(int socket, const struct musl_sockaddr *name, socklen_t namele
|
||||||
}
|
}
|
||||||
|
|
||||||
lwp_get_from_user(&family, (void *)name, 2);
|
lwp_get_from_user(&family, (void *)name, 2);
|
||||||
if ((family == AF_UNIX) || (family == AF_NETLINK))
|
if (family == AF_UNIX)
|
||||||
{
|
{
|
||||||
if (!lwp_user_accessable((void *)name, sizeof(struct sockaddr)))
|
if (!lwp_user_accessable((void *)name, sizeof(struct sockaddr_un)))
|
||||||
{
|
{
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
lwp_get_from_user(&sa, (void *)name, sizeof(struct sockaddr));
|
lwp_get_from_user(&un_addr, (void *)name, sizeof(struct sockaddr_un));
|
||||||
|
ret = bind(socket, (struct sockaddr *)&un_addr, namelen);
|
||||||
|
}
|
||||||
|
else if (family == AF_NETLINK)
|
||||||
|
{
|
||||||
|
if (!lwp_user_accessable((void *)name, namelen))
|
||||||
|
{
|
||||||
|
return -EFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
|
lwp_get_from_user(&sa, (void *)name, namelen);
|
||||||
|
|
||||||
ret = bind(socket, &sa, namelen);
|
ret = bind(socket, &sa, namelen);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue