Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:security\selinux\hooks.c Create Date:2022-07-28 18:59:52
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name: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.

Proto:static int selinux_socket_bind(struct socket *sock, struct sockaddr *address, int addrlen)

Type:int

Parameter:

TypeParameterName
struct socket *sock
struct sockaddr *address
intaddrlen
4578  sk = sk
4579  sksec = sk_security
4583  err = sock_has_perm(sk, SOCKET__BIND)
4584  If err Then Go to out
4588  family = sk_family
4589  If family == PF_INET || family == PF_INET6 Then
4592  struct lsm_network_audit net = {0, }
4593  struct sockaddr_in * addr4 = NULL
4594  struct sockaddr_in6 * addr6 = NULL
4605  If addrlen < get the member end offset of(structsockaddr, sa_family) Then Return -EINVAL
4607  family_sa = address family, AF_xxx
4609  Case family_sa == Supported address families.
4611  If addrlen < sizeof(structsockaddr_in) Then Return -EINVAL
4613  addr4 = address
4623  addrp = (char * ) & s_addr
4624  Break
4625  Case family_sa == IP version 6
4626  If addrlen < SIN6_LEN_RFC2133 Then Return -EINVAL
4628  addr6 = address
4630  addrp = (char * ) & s6_addr
4631  Break
4632  Default
4633  Go to err_af
4636  type = LSM_AUDIT_DATA_NET
4637  net = net
4638  sport = htons(snum)
4639  family = family_sa
4641  If snum Then
4698  out :
4699  Return err
4700  err_af :
4704  Return -EAFNOSUPPORT
Caller
NameDescribe
selinux_sctp_bind_connectCheck if sctp IPv4/IPv6 addresses are valid for binding or connecting* based on their @optname.