Skip to contentSkip to conversation

inclusion of selinux.h in cred.h

DISCUSSION Casey Schaufler 2 participants 4 messages Aug 17, 2011 SELinux security module

lore
Share & tools
lore
#0 lore raw

Is there some reason that linux/selinux.h is
#included in linux/cred.h?

I've been building kernels with the inclusion
commented out and I have encountered no problems.

It's not a problem, but I am curious.

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#1 lore raw
Quoted 8 lines · Casey Schaufler

Is there some reason that linux/selinux.h is
#included in linux/cred.h?

I've been building kernels with the inclusion
commented out and I have encountered no problems.

It's not a problem, but I am curious.

It can be safely moved, but not removed. This was added when creds_are_invalid() was implemented in the header, which makes SELinux specific calls (see commit ed868a56988464cd31de0302426a5e94d3127f10). This function was moved to kernel/cred.c in commit 74908a0009eb36054190ab80deb9671014efed96 but the header was not moved with it. If you want to send a patch to move the header from cred.h to cred.c I think that would make a lot of sense.

-Eric

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#2 lore raw
Quoted 7 lines · Eric Paris
Quoted 6 lines · Casey Schaufler

Is there some reason that linux/selinux.h is
#included in linux/cred.h?

I've been building kernels with the inclusion
commented out and I have encountered no problems.

Quoted 8 lines
Quoted 1 line

It's not a problem, but I am curious.

It can be safely moved, but not removed. This was added when creds_are_invalid() was implemented in the header, which makes SELinux specific calls (see commit ed868a56988464cd31de0302426a5e94d3127f10). This function was moved to kernel/cred.c in commit 74908a0009eb36054190ab80deb9671014efed96 but the header was not moved with it. If you want to send a patch to move the header from cred.h to cred.c I think that would make a lot of sense.

Enlightenment. Thank you.

Since creds_are_invalid() only exists under CONFIG_DEBUG_CREDENTIALS I would expect the include of selinux.h to be under that ifdef as well.

Quoted 8 lines

-Eric

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#3 lore raw
Quoted 21 lines · Casey Schaufler
Quoted 12 lines · Eric Paris
Quoted 8 lines · Casey Schaufler

Is there some reason that linux/selinux.h is
#included in linux/cred.h?

I've been building kernels with the inclusion
commented out and I have encountered no problems.

It's not a problem, but I am curious.

Quoted 7 lines

It can be safely moved, but not removed.  This was added when creds_are_invalid() was implemented in the header, which makes SELinux specific calls (see commit ed868a56988464cd31de0302426a5e94d3127f10). This function was moved to kernel/cred.c in commit 74908a0009eb36054190ab80deb9671014efed96 but the header was not moved with it.  If you want to send a patch to move the header from cred.h to cred.c I think that would make a lot of sense.

Quoted 4 lines

Enlightenment. Thank you.

Since creds_are_invalid() only exists under CONFIG_DEBUG_CREDENTIALS I would expect the include of selinux.h to be under that ifdef as well.

Seems quite reasonable to me...

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.