Skip to content

Commit fc7eadf

Browse files
rgbriggsJames Morris
authored andcommitted
capabilities: rename has_cap to has_fcap
Rename has_cap to has_fcap to clarify it applies to file capabilities since the entire source file is about capabilities. Signed-off-by: Richard Guy Briggs <rgb@redhat.com> Reviewed-by: Serge Hallyn <serge@hallyn.com> Acked-by: James Morris <james.l.morris@oracle.com> Acked-by: Kees Cook <keescook@chromium.org> Okay-ished-by: Paul Moore <paul@paul-moore.com> Signed-off-by: James Morris <james.l.morris@oracle.com>
1 parent 4c7e715 commit fc7eadf

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

‎security/commoncap.c‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ int cap_convert_nscap(struct dentry *dentry, void **ivalue, size_t size)
536536
static inline int bprm_caps_from_vfs_caps(struct cpu_vfs_cap_data *caps,
537537
struct linux_binprm *bprm,
538538
bool *effective,
539-
bool *has_cap)
539+
bool *has_fcap)
540540
{
541541
struct cred *new = bprm->cred;
542542
unsigned i;
@@ -546,7 +546,7 @@ static inline int bprm_caps_from_vfs_caps(struct cpu_vfs_cap_data *caps,
546546
*effective = true;
547547

548548
if (caps->magic_etc & VFS_CAP_REVISION_MASK)
549-
*has_cap = true;
549+
*has_fcap = true;
550550

551551
CAP_FOR_EACH_U32(i) {
552552
__u32 permitted = caps->permitted.cap[i];
@@ -652,7 +652,7 @@ int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data
652652
* its xattrs and, if present, apply them to the proposed credentials being
653653
* constructed by execve().
654654
*/
655-
static int get_file_caps(struct linux_binprm *bprm, bool *effective, bool *has_cap)
655+
static int get_file_caps(struct linux_binprm *bprm, bool *effective, bool *has_fcap)
656656
{
657657
int rc = 0;
658658
struct cpu_vfs_cap_data vcaps;
@@ -683,7 +683,7 @@ static int get_file_caps(struct linux_binprm *bprm, bool *effective, bool *has_c
683683
goto out;
684684
}
685685

686-
rc = bprm_caps_from_vfs_caps(&vcaps, bprm, effective, has_cap);
686+
rc = bprm_caps_from_vfs_caps(&vcaps, bprm, effective, has_fcap);
687687
if (rc == -EINVAL)
688688
printk(KERN_NOTICE "%s: cap_from_disk returned %d for %s\n",
689689
__func__, rc, bprm->filename);
@@ -707,7 +707,7 @@ static int get_file_caps(struct linux_binprm *bprm, bool *effective, bool *has_c
707707
* set UID root and nothing is changed. If we are root, cap_permitted is
708708
* updated. If we have become set UID root, the effective bit is set.
709709
*/
710-
static void handle_privileged_root(struct linux_binprm *bprm, bool has_cap,
710+
static void handle_privileged_root(struct linux_binprm *bprm, bool has_fcap,
711711
bool *effective, kuid_t root_uid)
712712
{
713713
const struct cred *old = current_cred();
@@ -720,7 +720,7 @@ static void handle_privileged_root(struct linux_binprm *bprm, bool has_cap,
720720
* for a setuid root binary run by a non-root user. Do set it
721721
* for a root user just to cause least surprise to an admin.
722722
*/
723-
if (has_cap && !uid_eq(new->uid, root_uid) && uid_eq(new->euid, root_uid)) {
723+
if (has_fcap && !uid_eq(new->uid, root_uid) && uid_eq(new->euid, root_uid)) {
724724
warn_setuid_and_fcaps_mixed(bprm->filename);
725725
return;
726726
}
@@ -759,20 +759,20 @@ int cap_bprm_set_creds(struct linux_binprm *bprm)
759759
{
760760
const struct cred *old = current_cred();
761761
struct cred *new = bprm->cred;
762-
bool effective = false, has_cap = false, is_setid;
762+
bool effective = false, has_fcap = false, is_setid;
763763
int ret;
764764
kuid_t root_uid;
765765

766766
if (WARN_ON(!cap_ambient_invariant_ok(old)))
767767
return -EPERM;
768768

769-
ret = get_file_caps(bprm, &effective, &has_cap);
769+
ret = get_file_caps(bprm, &effective, &has_fcap);
770770
if (ret < 0)
771771
return ret;
772772

773773
root_uid = make_kuid(new->user_ns, 0);
774774

775-
handle_privileged_root(bprm, has_cap, &effective, root_uid);
775+
handle_privileged_root(bprm, has_fcap, &effective, root_uid);
776776

777777
/* if we have fs caps, clear dangerous personality flags */
778778
if (__cap_gained(permitted, new, old))
@@ -802,7 +802,7 @@ int cap_bprm_set_creds(struct linux_binprm *bprm)
802802
new->sgid = new->fsgid = new->egid;
803803

804804
/* File caps or setid cancels ambient. */
805-
if (has_cap || is_setid)
805+
if (has_fcap || is_setid)
806806
cap_clear(new->cap_ambient);
807807

808808
/*

0 commit comments

Comments
 (0)