Skip to content

Commit 21953eb

Browse files
committed
Merge tag 'lsm-pr-20230626' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm
Pull lsm updates from Paul Moore: - A SafeSetID patch to correct what appears to be a cut-n-paste typo in the code causing a UID to be printed where a GID was desired. This is coming via the LSM tree because we haven't been able to get a response from the SafeSetID maintainer (Micah Morton) in several months. Hopefully we are able to get in touch with Micah, but until we do I'm going to pick them up in the LSM tree. - A small fix to the reiserfs LSM xattr code. We're continuing to work through some issues with the reiserfs code as we try to fixup the LSM xattr handling, but in the process we're uncovering some ugly problems in reiserfs and we may just end up removing the LSM xattr support in reiserfs prior to reiserfs' removal. For better or worse, this shouldn't impact any of the reiserfs users, as we discovered that LSM xattrs on reiserfs were completely broken, meaning no one is currently using the combo of reiserfs and a file labeling LSM. - A tweak to how the cap_user_data_t struct/typedef is declared in the header file to appease the Sparse gods. - In the process of trying to sort out the SafeSetID lost-maintainer problem I realized that I needed to update the labeled networking entry to "Supported". - Minor comment/documentation and spelling fixes. * tag 'lsm-pr-20230626' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm: device_cgroup: Fix kernel-doc warnings in device_cgroup SafeSetID: fix UID printed instead of GID MAINTAINERS: move labeled networking to "supported" capability: erase checker warnings about struct __user_cap_data_struct lsm: fix a number of misspellings reiserfs: Initialize sec->length in reiserfs_security_init(). capability: fix kernel-doc warnings in capability.c
2 parents 729b39e + 4be22f1 commit 21953eb

9 files changed

Lines changed: 22 additions & 19 deletions

File tree

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14727,7 +14727,7 @@ NETWORKING [LABELED] (NetLabel, Labeled IPsec, SECMARK)
1472714727
M: Paul Moore <paul@paul-moore.com>
1472814728
L: netdev@vger.kernel.org
1472914729
L: linux-security-module@vger.kernel.org
14730-
S: Maintained
14730+
S: Supported
1473114731
W: https://github.com/netlabel
1473214732
F: Documentation/netlabel/
1473314733
F: include/net/calipso.h

fs/reiserfs/xattr_security.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ int reiserfs_security_init(struct inode *dir, struct inode *inode,
6767

6868
sec->name = NULL;
6969
sec->value = NULL;
70+
sec->length = 0;
7071

7172
/* Don't add selinux attributes on xattrs - they'll never get used */
7273
if (IS_PRIVATE(dir))

include/uapi/linux/capability.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@ typedef struct __user_cap_header_struct {
4141
int pid;
4242
} __user *cap_user_header_t;
4343

44-
typedef struct __user_cap_data_struct {
44+
struct __user_cap_data_struct {
4545
__u32 effective;
4646
__u32 permitted;
4747
__u32 inheritable;
48-
} __user *cap_user_data_t;
48+
};
49+
typedef struct __user_cap_data_struct __user *cap_user_data_t;
4950

5051

5152
#define VFS_CAP_REVISION_MASK 0xFF000000

kernel/capability.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,7 @@ EXPORT_SYMBOL(file_ns_capable);
467467
/**
468468
* privileged_wrt_inode_uidgid - Do capabilities in the namespace work over the inode?
469469
* @ns: The user namespace in question
470+
* @idmap: idmap of the mount @inode was found from
470471
* @inode: The inode in question
471472
*
472473
* Return true if the inode uid and gid are within the namespace.
@@ -481,6 +482,7 @@ bool privileged_wrt_inode_uidgid(struct user_namespace *ns,
481482

482483
/**
483484
* capable_wrt_inode_uidgid - Check nsown_capable and uid and gid mapped
485+
* @idmap: idmap of the mount @inode was found from
484486
* @inode: The inode in question
485487
* @cap: The capability in question
486488
*

security/commoncap.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ int cap_inode_need_killpriv(struct dentry *dentry)
314314
* the vfsmount must be passed through @idmap. This function will then
315315
* take care to map the inode according to @idmap before checking
316316
* permissions. On non-idmapped mounts or if permission checking is to be
317-
* performed on the raw inode simply passs @nop_mnt_idmap.
317+
* performed on the raw inode simply pass @nop_mnt_idmap.
318318
*
319319
* Return: 0 if successful, -ve on error.
320320
*/
@@ -522,7 +522,7 @@ static bool validheader(size_t size, const struct vfs_cap_data *cap)
522522
* the vfsmount must be passed through @idmap. This function will then
523523
* take care to map the inode according to @idmap before checking
524524
* permissions. On non-idmapped mounts or if permission checking is to be
525-
* performed on the raw inode simply passs @nop_mnt_idmap.
525+
* performed on the raw inode simply pass @nop_mnt_idmap.
526526
*
527527
* Return: On success, return the new size; on error, return < 0.
528528
*/
@@ -630,7 +630,7 @@ static inline int bprm_caps_from_vfs_caps(struct cpu_vfs_cap_data *caps,
630630
* the vfsmount must be passed through @idmap. This function will then
631631
* take care to map the inode according to @idmap before checking
632632
* permissions. On non-idmapped mounts or if permission checking is to be
633-
* performed on the raw inode simply passs @nop_mnt_idmap.
633+
* performed on the raw inode simply pass @nop_mnt_idmap.
634634
*/
635635
int get_vfs_caps_from_disk(struct mnt_idmap *idmap,
636636
const struct dentry *dentry,
@@ -1133,7 +1133,7 @@ int cap_task_fix_setuid(struct cred *new, const struct cred *old, int flags)
11331133
break;
11341134

11351135
case LSM_SETID_FS:
1136-
/* juggle the capabilties to follow FSUID changes, unless
1136+
/* juggle the capabilities to follow FSUID changes, unless
11371137
* otherwise suppressed
11381138
*
11391139
* FIXME - is fsuser used for all CAP_FS_MASK capabilities?
@@ -1184,10 +1184,10 @@ static int cap_safe_nice(struct task_struct *p)
11841184
}
11851185

11861186
/**
1187-
* cap_task_setscheduler - Detemine if scheduler policy change is permitted
1187+
* cap_task_setscheduler - Determine if scheduler policy change is permitted
11881188
* @p: The task to affect
11891189
*
1190-
* Detemine if the requested scheduler policy change is permitted for the
1190+
* Determine if the requested scheduler policy change is permitted for the
11911191
* specified task.
11921192
*
11931193
* Return: 0 if permission is granted, -ve if denied.
@@ -1198,11 +1198,11 @@ int cap_task_setscheduler(struct task_struct *p)
11981198
}
11991199

12001200
/**
1201-
* cap_task_setioprio - Detemine if I/O priority change is permitted
1201+
* cap_task_setioprio - Determine if I/O priority change is permitted
12021202
* @p: The task to affect
12031203
* @ioprio: The I/O priority to set
12041204
*
1205-
* Detemine if the requested I/O priority change is permitted for the specified
1205+
* Determine if the requested I/O priority change is permitted for the specified
12061206
* task.
12071207
*
12081208
* Return: 0 if permission is granted, -ve if denied.
@@ -1213,11 +1213,11 @@ int cap_task_setioprio(struct task_struct *p, int ioprio)
12131213
}
12141214

12151215
/**
1216-
* cap_task_setnice - Detemine if task priority change is permitted
1216+
* cap_task_setnice - Determine if task priority change is permitted
12171217
* @p: The task to affect
12181218
* @nice: The nice value to set
12191219
*
1220-
* Detemine if the requested task priority change is permitted for the
1220+
* Determine if the requested task priority change is permitted for the
12211221
* specified task.
12221222
*
12231223
* Return: 0 if permission is granted, -ve if denied.

security/device_cgroup.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ static bool verify_new_ex(struct dev_cgroup *dev_cgroup,
421421
} else {
422422
/*
423423
* new exception in the child will add more devices
424-
* that can be acessed, so it can't match any of
424+
* that can be accessed, so it can't match any of
425425
* parent's exceptions, even slightly
426426
*/
427427
match = match_exception_partial(&dev_cgroup->exceptions,
@@ -822,7 +822,6 @@ struct cgroup_subsys devices_cgrp_subsys = {
822822

823823
/**
824824
* devcgroup_legacy_check_permission - checks if an inode operation is permitted
825-
* @dev_cgroup: the dev cgroup to be tested against
826825
* @type: device type
827826
* @major: device major number
828827
* @minor: device minor number

security/lsm_audit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ static void dump_common_audit_data(struct audit_buffer *ab,
200200
char comm[sizeof(current->comm)];
201201

202202
/*
203-
* To keep stack sizes in check force programers to notice if they
203+
* To keep stack sizes in check force programmers to notice if they
204204
* start making this union too large! See struct lsm_network_audit
205205
* as an example of how to deal with large data.
206206
*/

security/safesetid/lsm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ static int safesetid_security_capable(const struct cred *cred,
131131
* set*gid() (e.g. setting up userns gid mappings).
132132
*/
133133
pr_warn("Operation requires CAP_SETGID, which is not available to GID %u for operations besides approved set*gid transitions\n",
134-
__kuid_val(cred->uid));
134+
__kgid_val(cred->gid));
135135
return -EPERM;
136136
default:
137137
/* Error, the only capabilities were checking for is CAP_SETUID/GID */

security/security.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2491,7 +2491,7 @@ int security_inode_copy_up_xattr(const char *name)
24912491
/*
24922492
* The implementation can return 0 (accept the xattr), 1 (discard the
24932493
* xattr), -EOPNOTSUPP if it does not know anything about the xattr or
2494-
* any other error code incase of an error.
2494+
* any other error code in case of an error.
24952495
*/
24962496
hlist_for_each_entry(hp,
24972497
&security_hook_heads.inode_copy_up_xattr, list) {
@@ -4693,7 +4693,7 @@ int security_mptcp_add_subflow(struct sock *sk, struct sock *ssk)
46934693
* @subnet_prefix: subnet prefix of the port
46944694
* @pkey: IB pkey
46954695
*
4696-
* Check permission to access a pkey when modifing a QP.
4696+
* Check permission to access a pkey when modifying a QP.
46974697
*
46984698
* Return: Returns 0 if permission is granted.
46994699
*/

0 commit comments

Comments
 (0)