Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:apparmor_socket_getpeersec_stream - get security context of peer* Note: for tcp only valid if using ipsec or cipso on lan

Proto:static int apparmor_socket_getpeersec_stream(struct socket *sock, char __user *optval, int __user *optlen, unsigned int len)

Type:int

Parameter:

TypeParameterName
struct socket *sock
char __user *optval
int __user *optlen
unsigned intlen
1073  error = 0
1077  label = gin_current_label_crit_section - current's confining label and update it* Returns: up to date confining label or the ns unconfined label (NOT NULL)* Not safe to call inside locks* The returned reference must be put with end_current_label_crit_section()*
1078  peer = sk_peer_label(sk)
1079  If IS_ERR(peer) Then
1080  error = PTR_ERR(peer)
1081  Go to done
1083  slen = aa_label_asxprint( & name, labels_ns(label), peer, FLAG_SHOW_MODE | FLAG_VIEW_SUBNS | FLAG_HIDDEN_UNCONFINED, GFP_KERNEL)
1087  If slen < 0 Then
1088  error = -ENOMEM
1089  Else
1090  If slen > len Then
1091  error = -ERANGE
1092  Else if copy_to_user(optval, name, slen) Then
1093  error = -EFAULT
1094  Go to out
1096  If Write a simple value into user space(slen, optlen) Then error = -EFAULT
1098  out :
1099  kfree(name)
1103  done :
1104  d_label_crit_section - put a reference found with begin_current_label..*@label: label reference to put* Should only be used with a reference obtained with* begin_current_label_crit_section and never used in situations where the* task cred may be updated
1106  Return error