函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:security\selinux\hooks.c Create Date:2022-07-27 20:32:03
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:Range of port numbers used to automatically bind.Need to determine whether we should perform a name_bindpermission check between the socket and the port number.

函数原型:static int selinux_socket_bind(struct socket *sock, struct sockaddr *address, int addrlen)

返回类型:int

参数:

类型参数名称
struct socket *sock
struct sockaddr *address
intaddrlen
4578  sk等于sk
4579  sksec等于sk_security
4583  err等于sock_has_perm(sk, SOCKET__BIND)
4584  如果err则转到:out
4588  family等于sk_family
4589  如果family恒等于PF_INETfamily恒等于PF_INET6
4592  struct lsm_network_audit net = {0, }
4593  struct sockaddr_in * addr4 = NULL
4594  struct sockaddr_in6 * addr6 = NULL
4605  如果addrlen小于ffsetofend(TYPE, MEMBER)*@TYPE: The type of the structure*@MEMBER: The member within the structure to get the end offset of(structsockaddr, sa_family)则返回:负EINVAL
4607  family_sa等于address family, AF_xxx
4609  :family_sa恒等于Supported address families.
4611  如果addrlen小于sizeof(structsockaddr_in)则返回:负EINVAL
4613  addr4等于address
4614  如果family_sa恒等于Supported address families.
4622  snum等于ntohs( Port number )
4623  addrp = (char * ) & s_addr
4624  退出
4625  :family_sa恒等于IP version 6
4626  如果addrlen小于SIN6_LEN_RFC2133则返回:负EINVAL
4628  addr6等于address
4630  addrp = (char * ) & s6_addr
4631  退出
4632  默认
4633  转到:err_af
4636  type等于LSM_AUDIT_DATA_NET
4637  net等于net
4638  sport等于htons(snum)
4639  family等于family_sa
4641  如果snum
4646  如果inet_port_requires_bind_service(sock_net(sk), snum)或snum小于lowsnum大于high
4698  out :
4699  返回:err
4700  err_af :
4702  如果 sock security class 恒等于SECCLASS_SCTP_SOCKET则返回:负EINVAL
4704  返回:负EAFNOSUPPORT
调用者
名称描述
selinux_sctp_bind_connectCheck if sctp IPv4/IPv6 addresses are valid for binding or connecting* based on their @optname.