Blame view

security/selinux/include/objsec.h 3.34 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
6
  /*
   *  NSA Security-Enhanced Linux (SELinux) security module
   *
   *  This file contains the SELinux security data structures for kernel objects.
   *
   *  Author(s):  Stephen Smalley, <sds@epoch.ncsc.mil>
a936b79bd   Eric Paris   SELinux: objsec.h...
7
8
9
   *		Chris Vance, <cvance@nai.com>
   *		Wayne Salamon, <wsalamon@nai.com>
   *		James Morris <jmorris@redhat.com>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
10
11
12
13
14
15
   *
   *  Copyright (C) 2001,2002 Networks Associates Technology, Inc.
   *  Copyright (C) 2003 Red Hat, Inc., James Morris <jmorris@redhat.com>
   *
   *	This program is free software; you can redistribute it and/or modify
   *	it under the terms of the GNU General Public License version 2,
a936b79bd   Eric Paris   SELinux: objsec.h...
16
   *	as published by the Free Software Foundation.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
17
18
19
20
21
22
23
24
25
   */
  #ifndef _SELINUX_OBJSEC_H_
  #define _SELINUX_OBJSEC_H_
  
  #include <linux/list.h>
  #include <linux/sched.h>
  #include <linux/fs.h>
  #include <linux/binfmts.h>
  #include <linux/in.h>
9f2ad6650   Paul Moore   NetLabel: SELinux...
26
  #include <linux/spinlock.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
27
28
29
30
  #include "flask.h"
  #include "avc.h"
  
  struct task_security_struct {
a936b79bd   Eric Paris   SELinux: objsec.h...
31
32
33
34
35
36
  	u32 osid;		/* SID prior to last execve */
  	u32 sid;		/* current SID */
  	u32 exec_sid;		/* exec SID */
  	u32 create_sid;		/* fscreate SID */
  	u32 keycreate_sid;	/* keycreate SID */
  	u32 sockcreate_sid;	/* fscreate SID */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
37
38
39
  };
  
  struct inode_security_struct {
a936b79bd   Eric Paris   SELinux: objsec.h...
40
41
42
43
44
45
  	struct inode *inode;	/* back pointer to inode object */
  	struct list_head list;	/* list of inode_security_struct */
  	u32 task_sid;		/* SID of creating task */
  	u32 sid;		/* SID of this object */
  	u16 sclass;		/* security class of this object */
  	unsigned char initialized;	/* initialization flag */
fdeb05184   Richard Kennedy   SELinux: reorder ...
46
  	struct mutex lock;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
47
48
49
  };
  
  struct file_security_struct {
a936b79bd   Eric Paris   SELinux: objsec.h...
50
51
52
53
  	u32 sid;		/* SID of open file description */
  	u32 fown_sid;		/* SID of file owner (for SIGIO) */
  	u32 isid;		/* SID of inode at the time of file open */
  	u32 pseqno;		/* Policy seqno at the time of file open */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
54
55
56
  };
  
  struct superblock_security_struct {
a936b79bd   Eric Paris   SELinux: objsec.h...
57
58
  	struct super_block *sb;		/* back pointer to sb object */
  	struct list_head list;		/* list of superblock_security_struct */
c312feb29   Eric Paris   [PATCH] SELinux: ...
59
  	u32 sid;			/* SID of file system superblock */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
60
  	u32 def_sid;			/* default SID for labeling */
c312feb29   Eric Paris   [PATCH] SELinux: ...
61
  	u32 mntpoint_sid;		/* SECURITY_FS_USE_MNTPOINT context for files */
a936b79bd   Eric Paris   SELinux: objsec.h...
62
  	unsigned int behavior;		/* labeling behavior */
c9180a57a   Eric Paris   Security: add get...
63
  	unsigned char flags;		/* which mount options were specified */
bc7e982b8   Eric Paris   [PATCH] SELinux: ...
64
  	struct mutex lock;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
65
66
67
68
69
  	struct list_head isec_head;
  	spinlock_t isec_lock;
  };
  
  struct msg_security_struct {
a936b79bd   Eric Paris   SELinux: objsec.h...
70
  	u32 sid;	/* SID of message */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
71
72
73
  };
  
  struct ipc_security_struct {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
74
  	u16 sclass;	/* security class of this object */
a936b79bd   Eric Paris   SELinux: objsec.h...
75
  	u32 sid;	/* SID of IPC resource */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
76
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
77
  struct netif_security_struct {
e8bfdb9d0   Paul Moore   SELinux: Convert ...
78
79
  	int ifindex;			/* device index */
  	u32 sid;			/* SID for this interface */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
80
  };
224dfbd81   Paul Moore   SELinux: Add a ne...
81
82
83
84
85
86
87
88
  struct netnode_security_struct {
  	union {
  		__be32 ipv4;		/* IPv4 node address */
  		struct in6_addr ipv6;	/* IPv6 node address */
  	} addr;
  	u32 sid;			/* SID for this node */
  	u16 family;			/* address family */
  };
3e1121726   Paul Moore   SELinux: Add netw...
89
90
91
92
93
  struct netport_security_struct {
  	u32 sid;			/* SID for this node */
  	u16 port;			/* port number */
  	u8 protocol;			/* transport protocol */
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
94
  struct sk_security_struct {
220deb966   Paul Moore   SELinux: Better i...
95
  #ifdef CONFIG_NETLABEL
7420ed23a   Venkat Yekkirala   [NetLabel]: SELin...
96
97
98
99
  	enum {				/* NetLabel state */
  		NLBL_UNSET = 0,
  		NLBL_REQUIRE,
  		NLBL_LABELED,
948bf85c1   Paul Moore   netlabel: Add fun...
100
  		NLBL_REQSKB,
014ab19a6   Paul Moore   selinux: Set sock...
101
  		NLBL_CONNLABELED,
7420ed23a   Venkat Yekkirala   [NetLabel]: SELin...
102
  	} nlbl_state;
6c5b3fc01   Paul Moore   selinux: Cache Ne...
103
  	struct netlbl_lsm_secattr *nlbl_secattr; /* NetLabel sec attributes */
7420ed23a   Venkat Yekkirala   [NetLabel]: SELin...
104
  #endif
6c5b3fc01   Paul Moore   selinux: Cache Ne...
105
106
107
  	u32 sid;			/* SID of this object */
  	u32 peer_sid;			/* SID of peer */
  	u16 sclass;			/* sock security class */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
108
  };
d720024e9   Michael LeMay   [PATCH] selinux: ...
109
  struct key_security_struct {
a936b79bd   Eric Paris   SELinux: objsec.h...
110
  	u32 sid;	/* SID of key */
d720024e9   Michael LeMay   [PATCH] selinux: ...
111
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
112
113
114
  extern unsigned int selinux_checkreqprot;
  
  #endif /* _SELINUX_OBJSEC_H_ */