-
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.
CRED: Introduce credential access wrappers
The patches that are intended to introduce copy-on-write credentials for 2.6.28 require abstraction of access to some fields of the task structure, particularly for the case of one task accessing another's credentials where RCU will have to be observed. Introduced here are trivial no-op versions of the desired accessors for current and other tasks so that other subsystems can start to be converted over more easily. Wrappers are introduced into a new header (linux/cred.h) for UID/GID, EUID/EGID, SUID/SGID, FSUID/FSGID, cap_effective and current's subscribed user_struct. These wrappers are macros because the ordering between header files mitigates against making them inline functions. linux/cred.h is #included from linux/sched.h. Further, XFS is modified such that it no longer defines and uses parameterised versions of current_fs[ug]id(), thus getting rid of the namespace collision otherwise incurred. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: James Morris <jmorris@namei.org>
- Loading branch information
David Howells
authored and
James Morris
committed
Aug 13, 2008
1 parent
8d0968a
commit 9e2b2dc
Showing
5 changed files
with
57 additions
and
8 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
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
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
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,50 @@ | ||
/* Credentials management | ||
* | ||
* Copyright (C) 2008 Red Hat, Inc. All Rights Reserved. | ||
* Written by David Howells (dhowells@redhat.com) | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public Licence | ||
* as published by the Free Software Foundation; either version | ||
* 2 of the Licence, or (at your option) any later version. | ||
*/ | ||
|
||
#ifndef _LINUX_CRED_H | ||
#define _LINUX_CRED_H | ||
|
||
#define get_current_user() (get_uid(current->user)) | ||
|
||
#define task_uid(task) ((task)->uid) | ||
#define task_gid(task) ((task)->gid) | ||
#define task_euid(task) ((task)->euid) | ||
#define task_egid(task) ((task)->egid) | ||
|
||
#define current_uid() (current->uid) | ||
#define current_gid() (current->gid) | ||
#define current_euid() (current->euid) | ||
#define current_egid() (current->egid) | ||
#define current_suid() (current->suid) | ||
#define current_sgid() (current->sgid) | ||
#define current_fsuid() (current->fsuid) | ||
#define current_fsgid() (current->fsgid) | ||
#define current_cap() (current->cap_effective) | ||
|
||
#define current_uid_gid(_uid, _gid) \ | ||
do { \ | ||
*(_uid) = current->uid; \ | ||
*(_gid) = current->gid; \ | ||
} while(0) | ||
|
||
#define current_euid_egid(_uid, _gid) \ | ||
do { \ | ||
*(_uid) = current->euid; \ | ||
*(_gid) = current->egid; \ | ||
} while(0) | ||
|
||
#define current_fsuid_fsgid(_uid, _gid) \ | ||
do { \ | ||
*(_uid) = current->fsuid; \ | ||
*(_gid) = current->fsgid; \ | ||
} while(0) | ||
|
||
#endif /* _LINUX_CRED_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