forked from linuxppc/linux-ci
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag 'caps-6.13-rc1' of git://git.kernel.org/pub/scm/linux/kerne…
…l/git/sergeh/linux Pull capabilities updates from Serge Hallyn: - remove the cap_mmap_file() hook, as it simply returned the default return value and so doesn't need to exist (Paul Moore) - add a trace event for cap_capable() (Jordan Rome) * tag 'caps-6.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/sergeh/linux: security: add trace event for cap_capable capabilities: remove cap_mmap_file()
- Loading branch information
Showing
3 changed files
with
99 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5182,6 +5182,7 @@ M: Serge Hallyn <[email protected]> | |
L: [email protected] | ||
S: Supported | ||
F: include/linux/capability.h | ||
F: include/trace/events/capability.h | ||
F: include/uapi/linux/capability.h | ||
F: kernel/capability.c | ||
F: security/commoncap.c | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
#undef TRACE_SYSTEM | ||
#define TRACE_SYSTEM capability | ||
|
||
#if !defined(_TRACE_CAPABILITY_H) || defined(TRACE_HEADER_MULTI_READ) | ||
#define _TRACE_CAPABILITY_H | ||
|
||
#include <linux/cred.h> | ||
#include <linux/tracepoint.h> | ||
#include <linux/user_namespace.h> | ||
|
||
/** | ||
* cap_capable - called after it's determined if a task has a particular | ||
* effective capability | ||
* | ||
* @cred: The credentials used | ||
* @target_ns: The user namespace of the resource being accessed | ||
* @capable_ns: The user namespace in which the credential provides the | ||
* capability to access the targeted resource. | ||
* This will be NULL if ret is not 0. | ||
* @cap: The capability to check for | ||
* @ret: The return value of the check: 0 if it does, -ve if it does not | ||
* | ||
* Allows to trace calls to cap_capable in commoncap.c | ||
*/ | ||
TRACE_EVENT(cap_capable, | ||
|
||
TP_PROTO(const struct cred *cred, struct user_namespace *target_ns, | ||
const struct user_namespace *capable_ns, int cap, int ret), | ||
|
||
TP_ARGS(cred, target_ns, capable_ns, cap, ret), | ||
|
||
TP_STRUCT__entry( | ||
__field(const struct cred *, cred) | ||
__field(struct user_namespace *, target_ns) | ||
__field(const struct user_namespace *, capable_ns) | ||
__field(int, cap) | ||
__field(int, ret) | ||
), | ||
|
||
TP_fast_assign( | ||
__entry->cred = cred; | ||
__entry->target_ns = target_ns; | ||
__entry->capable_ns = ret == 0 ? capable_ns : NULL; | ||
__entry->cap = cap; | ||
__entry->ret = ret; | ||
), | ||
|
||
TP_printk("cred %p, target_ns %p, capable_ns %p, cap %d, ret %d", | ||
__entry->cred, __entry->target_ns, __entry->capable_ns, __entry->cap, | ||
__entry->ret) | ||
); | ||
|
||
#endif /* _TRACE_CAPABILITY_H */ | ||
|
||
/* This part must be outside protection */ | ||
#include <trace/define_trace.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters