Skip to content

Commit 7553566

Browse files
Dr. David Alan Gilbertjrjohansen
authored andcommitted
apparmor: Remove deadcode
aa_label_audit, aa_label_find, aa_label_seq_print and aa_update_label_name were added by commit f1bd904 ("apparmor: add the base fns() for domain labels") but never used. aa_profile_label_perm was added by commit 637f688 ("apparmor: switch from profiles to using labels on contexts") but never used. aa_secid_update was added by commit c092921 ("apparmor: add support for mapping secids and using secctxes") but never used. aa_split_fqname has been unused since commit 3664268 ("apparmor: add namespace lookup fns()") aa_lookup_profile has been unused since commit 93c98a4 ("apparmor: move exec domain mediation to using labels") aa_audit_perms_cb was only used by aa_profile_label_perm (see above). All of these commits are from around 2017. Remove them. Signed-off-by: Dr. David Alan Gilbert <[email protected]> Signed-off-by: John Johansen <[email protected]>
1 parent 648e45d commit 7553566

File tree

9 files changed

+0
-146
lines changed

9 files changed

+0
-146
lines changed

security/apparmor/include/label.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,6 @@ bool aa_label_replace(struct aa_label *old, struct aa_label *new);
291291
bool aa_label_make_newest(struct aa_labelset *ls, struct aa_label *old,
292292
struct aa_label *new);
293293

294-
struct aa_label *aa_label_find(struct aa_label *l);
295-
296294
struct aa_profile *aa_label_next_in_merge(struct label_it *I,
297295
struct aa_label *a,
298296
struct aa_label *b);
@@ -320,8 +318,6 @@ void aa_label_seq_xprint(struct seq_file *f, struct aa_ns *ns,
320318
struct aa_label *label, int flags, gfp_t gfp);
321319
void aa_label_xprintk(struct aa_ns *ns, struct aa_label *label, int flags,
322320
gfp_t gfp);
323-
void aa_label_audit(struct audit_buffer *ab, struct aa_label *label, gfp_t gfp);
324-
void aa_label_seq_print(struct seq_file *f, struct aa_label *label, gfp_t gfp);
325321
void aa_label_printk(struct aa_label *label, gfp_t gfp);
326322

327323
struct aa_label *aa_label_strn_parse(struct aa_label *base, const char *str,

security/apparmor/include/lib.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ extern int apparmor_initialized;
5959

6060
/* fn's in lib */
6161
const char *skipn_spaces(const char *str, size_t n);
62-
char *aa_split_fqname(char *args, char **ns_name);
6362
const char *aa_splitn_fqname(const char *fqname, size_t n, const char **ns_name,
6463
size_t *ns_len);
6564
void aa_info_message(const char *str);

security/apparmor/include/perms.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,6 @@ void aa_perms_accum_raw(struct aa_perms *accum, struct aa_perms *addend);
213213
void aa_profile_match_label(struct aa_profile *profile,
214214
struct aa_ruleset *rules, struct aa_label *label,
215215
int type, u32 request, struct aa_perms *perms);
216-
int aa_profile_label_perm(struct aa_profile *profile, struct aa_profile *target,
217-
u32 request, int type, u32 *deny,
218-
struct apparmor_audit_data *ad);
219216
int aa_check_perms(struct aa_profile *profile, struct aa_perms *perms,
220217
u32 request, struct apparmor_audit_data *ad,
221218
void (*cb)(struct audit_buffer *, void *));

security/apparmor/include/policy.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ void aa_free_profile(struct aa_profile *profile);
264264
struct aa_profile *aa_find_child(struct aa_profile *parent, const char *name);
265265
struct aa_profile *aa_lookupn_profile(struct aa_ns *ns, const char *hname,
266266
size_t n);
267-
struct aa_profile *aa_lookup_profile(struct aa_ns *ns, const char *name);
268267
struct aa_profile *aa_fqlookupn_profile(struct aa_label *base,
269268
const char *fqname, size_t n);
270269

security/apparmor/include/secid.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,5 @@ void apparmor_release_secctx(char *secdata, u32 seclen);
3434

3535
int aa_alloc_secid(struct aa_label *label, gfp_t gfp);
3636
void aa_free_secid(u32 secid);
37-
void aa_secid_update(u32 secid, struct aa_label *label);
3837

3938
#endif /* __AA_SECID_H */

security/apparmor/label.c

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -899,23 +899,6 @@ struct aa_label *aa_vec_find_or_create_label(struct aa_profile **vec, int len,
899899
return vec_create_and_insert_label(vec, len, gfp);
900900
}
901901

902-
/**
903-
* aa_label_find - find label @label in label set
904-
* @label: label to find (NOT NULL)
905-
*
906-
* Requires: caller to hold a valid ref on l
907-
*
908-
* Returns: refcounted @label if @label is in tree
909-
* refcounted label that is equiv to @label in tree
910-
* else NULL if @label or equiv is not in tree
911-
*/
912-
struct aa_label *aa_label_find(struct aa_label *label)
913-
{
914-
AA_BUG(!label);
915-
916-
return vec_find(label->vec, label->size);
917-
}
918-
919902

920903
/**
921904
* aa_label_insert - insert label @label into @ls or return existing label
@@ -1811,22 +1794,6 @@ void aa_label_xprintk(struct aa_ns *ns, struct aa_label *label, int flags,
18111794
pr_info("%s", label->hname);
18121795
}
18131796

1814-
void aa_label_audit(struct audit_buffer *ab, struct aa_label *label, gfp_t gfp)
1815-
{
1816-
struct aa_ns *ns = aa_get_current_ns();
1817-
1818-
aa_label_xaudit(ab, ns, label, FLAG_VIEW_SUBNS, gfp);
1819-
aa_put_ns(ns);
1820-
}
1821-
1822-
void aa_label_seq_print(struct seq_file *f, struct aa_label *label, gfp_t gfp)
1823-
{
1824-
struct aa_ns *ns = aa_get_current_ns();
1825-
1826-
aa_label_seq_xprint(f, ns, label, FLAG_VIEW_SUBNS, gfp);
1827-
aa_put_ns(ns);
1828-
}
1829-
18301797
void aa_label_printk(struct aa_label *label, gfp_t gfp)
18311798
{
18321799
struct aa_ns *ns = aa_get_current_ns();

security/apparmor/lib.c

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -45,44 +45,6 @@ void aa_free_str_table(struct aa_str_table *t)
4545
}
4646
}
4747

48-
/**
49-
* aa_split_fqname - split a fqname into a profile and namespace name
50-
* @fqname: a full qualified name in namespace profile format (NOT NULL)
51-
* @ns_name: pointer to portion of the string containing the ns name (NOT NULL)
52-
*
53-
* Returns: profile name or NULL if one is not specified
54-
*
55-
* Split a namespace name from a profile name (see policy.c for naming
56-
* description). If a portion of the name is missing it returns NULL for
57-
* that portion.
58-
*
59-
* NOTE: may modify the @fqname string. The pointers returned point
60-
* into the @fqname string.
61-
*/
62-
char *aa_split_fqname(char *fqname, char **ns_name)
63-
{
64-
char *name = strim(fqname);
65-
66-
*ns_name = NULL;
67-
if (name[0] == ':') {
68-
char *split = strchr(&name[1], ':');
69-
*ns_name = skip_spaces(&name[1]);
70-
if (split) {
71-
/* overwrite ':' with \0 */
72-
*split++ = 0;
73-
if (strncmp(split, "//", 2) == 0)
74-
split += 2;
75-
name = skip_spaces(split);
76-
} else
77-
/* a ns name without a following profile is allowed */
78-
name = NULL;
79-
}
80-
if (name && *name == 0)
81-
name = NULL;
82-
83-
return name;
84-
}
85-
8648
/**
8749
* skipn_spaces - Removes leading whitespace from @str.
8850
* @str: The string to be stripped.
@@ -275,33 +237,6 @@ void aa_audit_perm_mask(struct audit_buffer *ab, u32 mask, const char *chrs,
275237
audit_log_format(ab, "\"");
276238
}
277239

278-
/**
279-
* aa_audit_perms_cb - generic callback fn for auditing perms
280-
* @ab: audit buffer (NOT NULL)
281-
* @va: audit struct to audit values of (NOT NULL)
282-
*/
283-
static void aa_audit_perms_cb(struct audit_buffer *ab, void *va)
284-
{
285-
struct common_audit_data *sa = va;
286-
struct apparmor_audit_data *ad = aad(sa);
287-
288-
if (ad->request) {
289-
audit_log_format(ab, " requested_mask=");
290-
aa_audit_perm_mask(ab, ad->request, aa_file_perm_chrs,
291-
PERMS_CHRS_MASK, aa_file_perm_names,
292-
PERMS_NAMES_MASK);
293-
}
294-
if (ad->denied) {
295-
audit_log_format(ab, "denied_mask=");
296-
aa_audit_perm_mask(ab, ad->denied, aa_file_perm_chrs,
297-
PERMS_CHRS_MASK, aa_file_perm_names,
298-
PERMS_NAMES_MASK);
299-
}
300-
audit_log_format(ab, " peer=");
301-
aa_label_xaudit(ab, labels_ns(ad->subj_label), ad->peer,
302-
FLAGS_NONE, GFP_ATOMIC);
303-
}
304-
305240
/**
306241
* aa_apply_modes_to_perms - apply namespace and profile flags to perms
307242
* @profile: that perms where computed from
@@ -349,25 +284,6 @@ void aa_profile_match_label(struct aa_profile *profile,
349284
}
350285

351286

352-
/* currently unused */
353-
int aa_profile_label_perm(struct aa_profile *profile, struct aa_profile *target,
354-
u32 request, int type, u32 *deny,
355-
struct apparmor_audit_data *ad)
356-
{
357-
struct aa_ruleset *rules = list_first_entry(&profile->rules,
358-
typeof(*rules), list);
359-
struct aa_perms perms;
360-
361-
ad->peer = &target->label;
362-
ad->request = request;
363-
364-
aa_profile_match_label(profile, rules, &target->label, type, request,
365-
&perms);
366-
aa_apply_modes_to_perms(profile, &perms);
367-
*deny |= request & perms.deny;
368-
return aa_check_perms(profile, &perms, request, ad, aa_audit_perms_cb);
369-
}
370-
371287
/**
372288
* aa_check_perms - do audit mode selection based on perms set
373289
* @profile: profile being checked

security/apparmor/policy.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -579,11 +579,6 @@ struct aa_profile *aa_lookupn_profile(struct aa_ns *ns, const char *hname,
579579
return profile;
580580
}
581581

582-
struct aa_profile *aa_lookup_profile(struct aa_ns *ns, const char *hname)
583-
{
584-
return aa_lookupn_profile(ns, hname, strlen(hname));
585-
}
586-
587582
struct aa_profile *aa_fqlookupn_profile(struct aa_label *base,
588583
const char *fqname, size_t n)
589584
{

security/apparmor/secid.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,6 @@ int apparmor_display_secid_mode;
3939
* TODO: use secid_update in label replace
4040
*/
4141

42-
/**
43-
* aa_secid_update - update a secid mapping to a new label
44-
* @secid: secid to update
45-
* @label: label the secid will now map to
46-
*/
47-
void aa_secid_update(u32 secid, struct aa_label *label)
48-
{
49-
unsigned long flags;
50-
51-
xa_lock_irqsave(&aa_secids, flags);
52-
__xa_store(&aa_secids, secid, label, 0);
53-
xa_unlock_irqrestore(&aa_secids, flags);
54-
}
55-
5642
/*
5743
* see label for inverse aa_label_to_secid
5844
*/

0 commit comments

Comments
 (0)