Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:aa_replace_profiles - replace profile(s) on the profile list*@policy_ns: namespace load is occurring on*@label: label that is attempting to load/replace policy*@mask: permission mask*@udata: serialized data stream (NOT NULL)* unpack and replace a profile

Proto:ssize_t aa_replace_profiles(struct aa_ns *policy_ns, struct aa_label *label, unsigned int mask, struct aa_loaddata *udata)

Type:ssize_t

Parameter:

TypeParameterName
struct aa_ns *policy_ns
struct aa_label *label
unsigned intmask
struct aa_loaddata *udata
859  const char * ns_name = NULL, * info = NULL
860  struct aa_ns * ns = NULL
865  LIST_HEAD(lh)
867  op = If mask & AA_MAY_REPLACE_POLICY Then OP_PROF_REPL Else OP_PROF_LOAD
868  aa_get_loaddata - get a reference count from a counted data reference*@data: reference to get a count on* Returns: point to reference* Requires: @data to have a valid reference count on it. It is a bug
870  error = aa_unpack - unpack packed binary profile(s) data loaded from user space*@udata: user data copied to kmem (NOT NULL)*@lh: list to place unpacked profiles in a aa_repl_ws*@ns: Returns namespace profile is in if specified else NULL (NOT NULL)* Unpack user
871  If error Then Go to out
879  count = 0
881  If ns_name Then
882  If ns_name && strcmp(ns_name, ns_name) != 0 Then
884  info = "policy load has mixed namespaces"
885  error = -EACCES
886  Go to fail
888  Else if ns_name Then
889  If count Then
890  info = "policy load has mixed namespaces"
891  error = -EACCES
892  Go to fail
894  ns_name = ns_name
895  Else count++
898  If ns_name Then
899  ns = aa_prepare_ns - find an existing or create a new namespace of @name*@parent: ns to treat as parent*@name: the namespace to find or add (NOT NULL)* Returns: refcounted namespace or PTR_ERR if failed to create one
901  If IS_ERR(ns) Then
902  op = OP_PROF_LOAD
903  info = "failed to prepare namespace"
904  error = PTR_ERR(ns)
905  ns = NULL
906  ent = NULL
907  Go to fail
909  Else ns = aa_get_ns - increment references count on @ns*@ns: namespace to increment reference count of (MAYBE NULL)* Returns: pointer to @ns, if @ns is NULL returns NULL* Requires: @ns must be held with valid refcount when called
912  mutex_lock_nested( & lock, level)
915  If aa_rawdata_eq(rawdata_ent, udata) Then
918  tmp = __aa_get_loaddata - get a reference count to uncounted data reference*@data: reference to get a count on* Returns: pointer to reference OR NULL if race is lost and reference is* being repeated
920  If tmp Then
922  udata = tmp
923  Break
935  If error Then Go to fail_lock
938  If rename Then
949  If old || rename Then Continue
954  If Not policy Then
963  Else if policy != base Then
971  If Not dents[AAFS_LOADDATA_DIR] Then
973  If error Then
1002  op = If Not old && Not rename Then OP_PROF_LOAD Else OP_PROF_REPL
1004  If old && rawdata == rawdata Then
1022  If old Then
1025  Else
1037  :
1040  __aa_labelset_update_subtree(ns)
1041  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
1043  out :
1044  aa_put_ns - decrement refcount on @ns*@ns: namespace to put reference of* Decrement reference count of @ns and if no longer in use free it
1045  aa_put_loaddata(udata)
1046  kfree(ns_name)
1048  If error Then Return error
1050  Return he original size of the payload
1052  fail_lock :
1053  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
1056  op = If ent && Not old Then OP_PROF_LOAD Else OP_PROF_REPL
1057  fail :
1058  audit_policy - Do auditing of policy changes*@label: label to check if it can manage policy*@op: policy operation being performed*@ns_name: name of namespace being manipulated*@name: name of profile being manipulated (NOT NULL)*@info: any extra
1061  info = "valid profile in failed atomic policy load"
1063  If tmp == ent Then
1064  info = "unchecked profile in failed atomic policy load"
1066  Continue
1068  op = If Not old Then OP_PROF_LOAD Else OP_PROF_REPL
1069  audit_policy - Do auditing of policy changes*@label: label to check if it can manage policy*@op: policy operation being performed*@ns_name: name of namespace being manipulated*@name: name of profile being manipulated (NOT NULL)*@info: any extra
1073  list_del_init - deletes entry from list and reinitialize it.*@entry: the element to delete from the list.
1074  aa_load_ent_free(ent)
1077  Go to out
Caller
NameDescribe
policy_update