Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
passt-mac
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Simon Ruderich
passt-mac
Commits
fbb55fdb
Commit
fbb55fdb
authored
9 years ago
by
Lukas Braun
Committed by
Simon Ruderich
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
slsm: refactor and rename new_passt_task()
passt_dup_task() initializes all fields, not just ->label.
parent
ab7a6fa5
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
security/slsm/lsm.c
+8
-9
8 additions, 9 deletions
security/slsm/lsm.c
with
8 additions
and
9 deletions
security/slsm/lsm.c
+
8
−
9
View file @
fbb55fdb
...
...
@@ -16,14 +16,12 @@ static char *init = "<<init>>";
/**
* new_passt_task - allocate a task security blob
* @lbl: a pointer to the label for the running task
* @gfp: type of the memory for the allocation
* passt_dup_task - duplicates all resources related to @old_pt
*
* Returns the new
blob
or NULL if there's no memory available
* Returns the new
passt_task
or NULL if there's no memory available
*/
static
struct
passt_task
*
new_
passt_task
(
c
har
*
lbl
,
gfp_t
gfp
)
{
struct
passt_task
*
pt
=
k
zalloc
(
sizeof
(
struct
passt_task
),
gfp
);
static
struct
passt_task
*
passt_
dup_
task
(
c
onst
struct
passt_task
*
old_pt
,
gfp_t
gfp
)
{
struct
passt_task
*
pt
=
k
memdup
(
old_pt
,
sizeof
(
struct
passt_task
),
gfp
);
if
(
!
pt
)
return
NULL
;
...
...
@@ -31,7 +29,7 @@ static struct passt_task *new_passt_task(char *lbl, gfp_t gfp) {
* TODO: global cache for labels, see SMACK
* for now we duplicate everything to avoid refcounting headaches
*/
pt
->
label
=
kstrdup
(
lb
l
,
gfp
);
pt
->
label
=
kstrdup
(
old_pt
->
labe
l
,
gfp
);
if
(
!
pt
->
label
)
{
kfree
(
pt
);
return
NULL
;
...
...
@@ -68,7 +66,7 @@ static int passt_cred_prepare(struct cred *new, const struct cred *old,
gfp_t
gfp
)
{
struct
passt_task
*
new_pt
,
*
old_pt
=
old
->
security
;
new_pt
=
new_
passt_task
(
old_pt
->
label
,
gfp
);
new_pt
=
passt_
dup_
task
(
old_pt
,
gfp
);
if
(
!
new_pt
)
return
-
ENOMEM
;
...
...
@@ -336,6 +334,7 @@ static struct security_hook_list passt_hooks[] = {
static
__init
int
passt_init
(
void
)
{
struct
cred
*
cred
;
struct
passt_task
*
pt
;
struct
passt_task
init_pt
=
{
.
label
=
init
,
.
confined
=
0
};
if
(
!
security_module_enable
(
"passt"
))
{
printk
(
KERN_INFO
"PASST-MAC disabled by boot parameter
\n
"
);
...
...
@@ -348,7 +347,7 @@ static __init int passt_init(void) {
* how do we find out what init actually is?
* hardcode /sbin/init? beware symlinks
*/
pt
=
new_
passt_task
(
init
,
GFP_KERNEL
);
pt
=
passt_
dup_
task
(
&
init
_pt
,
GFP_KERNEL
);
if
(
!
pt
)
/* TODO: panic? */
return
-
ENOMEM
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment