| Function report | 
| Source Code: security\selinux\hooks.c | Create Date:2022-07-28 19:00:43 | 
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick | 
| home page | Tree | 
| Annotation kernel can get tool activity | Download SCCT | Chinese | 
Name:selinux_socket_getpeersec_stream
Proto:static int selinux_socket_getpeersec_stream(struct socket *sock, char __user *optval, int __user *optlen, unsigned len)
Type:int
Parameter:
| Type | Parameter | Name | 
|---|---|---|
| struct socket * | sock | |
| char __user * | optval | |
| int __user * | optlen | |
| unsigned | len | 
| 5074 | err = 0 | 
| 5077 | sksec = sk_security | 
| 5078 | peer_sid = unspecified SID | 
| 5080 | If sock security class == SECCLASS_UNIX_STREAM_SOCKET || sock security class == SECCLASS_TCP_SOCKET || sock security class == SECCLASS_SCTP_SOCKET Then peer_sid = SID of peer | 
| 5084 | If peer_sid == unspecified SID Then Return -ENOPROTOOPT | 
| 5087 | err = security_sid_to_context( & selinux_state, peer_sid, & scontext, & scontext_len) | 
| 5092 | If scontext_len > len Then | 
| 5097 | If copy_to_user(optval, scontext, scontext_len) Then err = -EFAULT | 
| 5100 | out_len : | 
| 5101 | If Write a simple value into user space(scontext_len, optlen) Then err = -EFAULT | 
| 5104 | Return err | 
| Source code conversion tool public plug-in interface | X | 
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |