@@ -144,11 +144,6 @@ enum lockdown_reason {
LOCKDOWN_CONFIDENTIALITY_MAX,
};
-/* scaffolding */
-struct lsm_prop_scaffold {
- u32 secid;
-};
-
/*
* Data exported by the security modules
*/
@@ -157,7 +152,6 @@ struct lsm_prop {
struct lsm_prop_smack smack;
struct lsm_prop_apparmor apparmor;
struct lsm_prop_bpf bpf;
- struct lsm_prop_scaffold scaffold;
};
extern const char *const lockdown_reasons[LOCKDOWN_CONFIDENTIALITY_MAX+1];
@@ -270,11 +270,7 @@ int aa_audit_rule_match(struct lsm_prop *prop, u32 field, u32 op, void *vrule)
struct aa_label *label;
int found = 0;
- /* scaffolding */
- if (!prop->apparmor.label && prop->scaffold.secid)
- label = aa_secid_to_label(prop->scaffold.secid);
- else
- label = prop->apparmor.label;
+ label = prop->apparmor.label;
if (!label)
return -ENOENT;
@@ -987,8 +987,6 @@ static void apparmor_current_getlsmprop_subj(struct lsm_prop *prop)
struct aa_label *label = __begin_current_label_crit_section();
prop->apparmor.label = label;
- /* scaffolding */
- prop->scaffold.secid = label->secid;
__end_current_label_crit_section(label);
}
@@ -998,8 +996,6 @@ static void apparmor_task_getlsmprop_obj(struct task_struct *p,
struct aa_label *label = aa_get_task_label(p);
prop->apparmor.label = label;
- /* scaffolding */
- prop->scaffold.secid = label->secid;
aa_put_label(label);
}
@@ -102,11 +102,7 @@ int apparmor_lsmprop_to_secctx(struct lsm_prop *prop, char **secdata,
{
struct aa_label *label;
- /* scaffolding */
- if (!prop->apparmor.label && prop->scaffold.secid)
- label = aa_secid_to_label(prop->scaffold.secid);
- else
- label = prop->apparmor.label;
+ label = prop->apparmor.label;
return apparmor_label_to_secctx(label, secdata, seclen);
}
@@ -3510,8 +3510,6 @@ static void selinux_inode_getlsmprop(struct inode *inode, struct lsm_prop *prop)
struct inode_security_struct *isec = inode_security_novalidate(inode);
prop->selinux.secid = isec->sid;
- /* scaffolding */
- prop->scaffold.secid = isec->sid;
}
static int selinux_inode_copy_up(struct dentry *src, struct cred **new)
@@ -4032,8 +4030,6 @@ static void selinux_cred_getsecid(const struct cred *c, u32 *secid)
static void selinux_cred_getlsmprop(const struct cred *c, struct lsm_prop *prop)
{
prop->selinux.secid = cred_sid(c);
- /* scaffolding */
- prop->scaffold.secid = prop->selinux.secid;
}
/*
@@ -4174,16 +4170,12 @@ static int selinux_task_getsid(struct task_struct *p)
static void selinux_current_getlsmprop_subj(struct lsm_prop *prop)
{
prop->selinux.secid = current_sid();
- /* scaffolding */
- prop->scaffold.secid = prop->selinux.secid;
}
static void selinux_task_getlsmprop_obj(struct task_struct *p,
struct lsm_prop *prop)
{
prop->selinux.secid = task_sid_obj(p);
- /* scaffolding */
- prop->scaffold.secid = prop->selinux.secid;
}
static int selinux_task_setnice(struct task_struct *p, int nice)
@@ -6348,8 +6340,6 @@ static void selinux_ipc_getlsmprop(struct kern_ipc_perm *ipcp,
{
struct ipc_security_struct *isec = selinux_ipc(ipcp);
prop->selinux.secid = isec->sid;
- /* scaffolding */
- prop->scaffold.secid = isec->sid;
}
static void selinux_d_instantiate(struct dentry *dentry, struct inode *inode)
@@ -6634,13 +6624,7 @@ static int selinux_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
static int selinux_lsmprop_to_secctx(struct lsm_prop *prop, char **secdata,
u32 *seclen)
{
- u32 secid = prop->selinux.secid;
-
- /* scaffolding */
- if (!secid)
- secid = prop->scaffold.secid;
-
- return selinux_secid_to_secctx(secid, secdata, seclen);
+ return selinux_secid_to_secctx(prop->selinux.secid, secdata, seclen);
}
static int selinux_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid)
@@ -3659,10 +3659,6 @@ int selinux_audit_rule_match(struct lsm_prop *prop, u32 field, u32 op, void *vru
goto out;
}
- /* scaffolding */
- if (!prop->selinux.secid && prop->scaffold.secid)
- prop->selinux.secid = prop->scaffold.secid;
-
ctxt = sidtab_search(policy->sidtab, prop->selinux.secid);
if (unlikely(!ctxt)) {
WARN_ONCE(1, "selinux_audit_rule_match: unrecognized SID %d\n",
@@ -1655,11 +1655,7 @@ static int smack_inode_listsecurity(struct inode *inode, char *buffer,
*/
static void smack_inode_getlsmprop(struct inode *inode, struct lsm_prop *prop)
{
- struct smack_known *skp = smk_of_inode(inode);
-
- prop->smack.skp = skp;
- /* scaffolding */
- prop->scaffold.secid = skp->smk_secid;
+ prop->smack.skp = smk_of_inode(inode);
}
/*
@@ -2162,8 +2158,6 @@ static void smack_cred_getlsmprop(const struct cred *cred,
{
rcu_read_lock();
prop->smack.skp = smk_of_task(smack_cred(cred));
- /* scaffolding */
- prop->scaffold.secid = prop->smack.skp->smk_secid;
rcu_read_unlock();
}
@@ -2265,11 +2259,7 @@ static int smack_task_getsid(struct task_struct *p)
*/
static void smack_current_getlsmprop_subj(struct lsm_prop *prop)
{
- struct smack_known *skp = smk_of_current();
-
- prop->smack.skp = skp;
- /* scaffolding */
- prop->scaffold.secid = skp->smk_secid;
+ prop->smack.skp = smk_of_current();
}
/**
@@ -2282,11 +2272,7 @@ static void smack_current_getlsmprop_subj(struct lsm_prop *prop)
static void smack_task_getlsmprop_obj(struct task_struct *p,
struct lsm_prop *prop)
{
- struct smack_known *skp = smk_of_task_struct_obj(p);
-
- prop->smack.skp = skp;
- /* scaffolding */
- prop->scaffold.secid = skp->smk_secid;
+ prop->smack.skp = smk_of_task_struct_obj(p);
}
/**
@@ -3473,11 +3459,8 @@ static int smack_ipc_permission(struct kern_ipc_perm *ipp, short flag)
static void smack_ipc_getlsmprop(struct kern_ipc_perm *ipp, struct lsm_prop *prop)
{
struct smack_known **iskpp = smack_ipc(ipp);
- struct smack_known *iskp = *iskpp;
- prop->smack.skp = iskp;
- /* scaffolding */
- prop->scaffold.secid = iskp->smk_secid;
+ prop->smack.skp = *iskpp;
}
/**
@@ -4824,10 +4807,6 @@ static int smack_audit_rule_match(struct lsm_prop *prop, u32 field, u32 op,
if (field != AUDIT_SUBJ_USER && field != AUDIT_OBJ_USER)
return 0;
- /* scaffolding */
- if (!skp && prop->scaffold.secid)
- skp = smack_from_secid(prop->scaffold.secid);
-
/*
* No need to do string comparisons. If a match occurs,
* both pointers will point to the same smack_known
@@ -4888,10 +4867,6 @@ static int smack_lsmprop_to_secctx(struct lsm_prop *prop, char **secdata,
{
struct smack_known *skp = prop->smack.skp;
- /* scaffolding */
- if (!skp && prop->scaffold.secid)
- skp = smack_from_secid(prop->scaffold.secid);
-
if (secdata)
*secdata = skp->smk_known;
*seclen = strlen(skp->smk_known);
Remove the scaffold member from the lsm_prop. Remove the remaining places it is being set. Signed-off-by: Casey Schaufler <casey@schaufler-ca.com> --- include/linux/security.h | 6 ------ security/apparmor/audit.c | 6 +----- security/apparmor/lsm.c | 4 ---- security/apparmor/secid.c | 6 +----- security/selinux/hooks.c | 18 +----------------- security/selinux/ss/services.c | 4 ---- security/smack/smack_lsm.c | 33 ++++----------------------------- 7 files changed, 7 insertions(+), 70 deletions(-)