1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22#ifndef __LINUX_SECURITY_H
23#define __LINUX_SECURITY_H
24
25#include <linux/fs.h>
26#include <linux/binfmts.h>
27#include <linux/signal.h>
28#include <linux/resource.h>
29#include <linux/sem.h>
30#include <linux/shm.h>
31#include <linux/msg.h>
32#include <linux/sched.h>
33
34struct ctl_table;
35
36
37
38
39
40extern int cap_capable (struct task_struct *tsk, int cap);
41extern int cap_settime (struct timespec *ts, struct timezone *tz);
42extern int cap_ptrace (struct task_struct *parent, struct task_struct *child);
43extern int cap_capget (struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted);
44extern int cap_capset_check (struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted);
45extern void cap_capset_set (struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted);
46extern int cap_bprm_set_security (struct linux_binprm *bprm);
47extern void cap_bprm_apply_creds (struct linux_binprm *bprm, int unsafe);
48extern int cap_bprm_secureexec(struct linux_binprm *bprm);
49extern int cap_inode_setxattr(struct dentry *dentry, char *name, void *value, size_t size, int flags);
50extern int cap_inode_removexattr(struct dentry *dentry, char *name);
51extern int cap_task_post_setuid (uid_t old_ruid, uid_t old_euid, uid_t old_suid, int flags);
52extern void cap_task_reparent_to_init (struct task_struct *p);
53extern int cap_syslog (int type);
54extern int cap_vm_enough_memory (long pages);
55
56struct msghdr;
57struct sk_buff;
58struct sock;
59struct sockaddr;
60struct socket;
61
62extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb);
63extern int cap_netlink_recv(struct sk_buff *skb);
64
65
66
67
68
69#define LSM_SETID_ID 1
70
71
72#define LSM_SETID_RE 2
73
74
75#define LSM_SETID_RES 4
76
77
78#define LSM_SETID_FS 8
79
80
81struct nfsctl_arg;
82struct sched_param;
83struct swap_info_struct;
84
85
86#define LSM_UNSAFE_SHARE 1
87#define LSM_UNSAFE_PTRACE 2
88#define LSM_UNSAFE_PTRACE_CAP 4
89
90#ifdef CONFIG_SECURITY
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029struct security_operations {
1030 int (*ptrace) (struct task_struct * parent, struct task_struct * child);
1031 int (*capget) (struct task_struct * target,
1032 kernel_cap_t * effective,
1033 kernel_cap_t * inheritable, kernel_cap_t * permitted);
1034 int (*capset_check) (struct task_struct * target,
1035 kernel_cap_t * effective,
1036 kernel_cap_t * inheritable,
1037 kernel_cap_t * permitted);
1038 void (*capset_set) (struct task_struct * target,
1039 kernel_cap_t * effective,
1040 kernel_cap_t * inheritable,
1041 kernel_cap_t * permitted);
1042 int (*acct) (struct file * file);
1043 int (*sysctl) (struct ctl_table * table, int op);
1044 int (*capable) (struct task_struct * tsk, int cap);
1045 int (*quotactl) (int cmds, int type, int id, struct super_block * sb);
1046 int (*quota_on) (struct dentry * dentry);
1047 int (*syslog) (int type);
1048 int (*settime) (struct timespec *ts, struct timezone *tz);
1049 int (*vm_enough_memory) (long pages);
1050
1051 int (*bprm_alloc_security) (struct linux_binprm * bprm);
1052 void (*bprm_free_security) (struct linux_binprm * bprm);
1053 void (*bprm_apply_creds) (struct linux_binprm * bprm, int unsafe);
1054 void (*bprm_post_apply_creds) (struct linux_binprm * bprm);
1055 int (*bprm_set_security) (struct linux_binprm * bprm);
1056 int (*bprm_check_security) (struct linux_binprm * bprm);
1057 int (*bprm_secureexec) (struct linux_binprm * bprm);
1058
1059 int (*sb_alloc_security) (struct super_block * sb);
1060 void (*sb_free_security) (struct super_block * sb);
1061 int (*sb_copy_data)(struct file_system_type *type,
1062 void *orig, void *copy);
1063 int (*sb_kern_mount) (struct super_block *sb, void *data);
1064 int (*sb_statfs) (struct super_block * sb);
1065 int (*sb_mount) (char *dev_name, struct nameidata * nd,
1066 char *type, unsigned long flags, void *data);
1067 int (*sb_check_sb) (struct vfsmount * mnt, struct nameidata * nd);
1068 int (*sb_umount) (struct vfsmount * mnt, int flags);
1069 void (*sb_umount_close) (struct vfsmount * mnt);
1070 void (*sb_umount_busy) (struct vfsmount * mnt);
1071 void (*sb_post_remount) (struct vfsmount * mnt,
1072 unsigned long flags, void *data);
1073 void (*sb_post_mountroot) (void);
1074 void (*sb_post_addmount) (struct vfsmount * mnt,
1075 struct nameidata * mountpoint_nd);
1076 int (*sb_pivotroot) (struct nameidata * old_nd,
1077 struct nameidata * new_nd);
1078 void (*sb_post_pivotroot) (struct nameidata * old_nd,
1079 struct nameidata * new_nd);
1080
1081 int (*inode_alloc_security) (struct inode *inode);
1082 void (*inode_free_security) (struct inode *inode);
1083 int (*inode_create) (struct inode *dir,
1084 struct dentry *dentry, int mode);
1085 void (*inode_post_create) (struct inode *dir,
1086 struct dentry *dentry, int mode);
1087 int (*inode_link) (struct dentry *old_dentry,
1088 struct inode *dir, struct dentry *new_dentry);
1089 void (*inode_post_link) (struct dentry *old_dentry,
1090 struct inode *dir, struct dentry *new_dentry);
1091 int (*inode_unlink) (struct inode *dir, struct dentry *dentry);
1092 int (*inode_symlink) (struct inode *dir,
1093 struct dentry *dentry, const char *old_name);
1094 void (*inode_post_symlink) (struct inode *dir,
1095 struct dentry *dentry,
1096 const char *old_name);
1097 int (*inode_mkdir) (struct inode *dir, struct dentry *dentry, int mode);
1098 void (*inode_post_mkdir) (struct inode *dir, struct dentry *dentry,
1099 int mode);
1100 int (*inode_rmdir) (struct inode *dir, struct dentry *dentry);
1101 int (*inode_mknod) (struct inode *dir, struct dentry *dentry,
1102 int mode, dev_t dev);
1103 void (*inode_post_mknod) (struct inode *dir, struct dentry *dentry,
1104 int mode, dev_t dev);
1105 int (*inode_rename) (struct inode *old_dir, struct dentry *old_dentry,
1106 struct inode *new_dir, struct dentry *new_dentry);
1107 void (*inode_post_rename) (struct inode *old_dir,
1108 struct dentry *old_dentry,
1109 struct inode *new_dir,
1110 struct dentry *new_dentry);
1111 int (*inode_readlink) (struct dentry *dentry);
1112 int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd);
1113 int (*inode_permission) (struct inode *inode, int mask, struct nameidata *nd);
1114 int (*inode_setattr) (struct dentry *dentry, struct iattr *attr);
1115 int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry);
1116 void (*inode_delete) (struct inode *inode);
1117 int (*inode_setxattr) (struct dentry *dentry, char *name, void *value,
1118 size_t size, int flags);
1119 void (*inode_post_setxattr) (struct dentry *dentry, char *name, void *value,
1120 size_t size, int flags);
1121 int (*inode_getxattr) (struct dentry *dentry, char *name);
1122 int (*inode_listxattr) (struct dentry *dentry);
1123 int (*inode_removexattr) (struct dentry *dentry, char *name);
1124 int (*inode_getsecurity)(struct inode *inode, const char *name, void *buffer, size_t size);
1125 int (*inode_setsecurity)(struct inode *inode, const char *name, const void *value, size_t size, int flags);
1126 int (*inode_listsecurity)(struct inode *inode, char *buffer, size_t buffer_size);
1127
1128 int (*file_permission) (struct file * file, int mask);
1129 int (*file_alloc_security) (struct file * file);
1130 void (*file_free_security) (struct file * file);
1131 int (*file_ioctl) (struct file * file, unsigned int cmd,
1132 unsigned long arg);
1133 int (*file_mmap) (struct file * file,
1134 unsigned long reqprot,
1135 unsigned long prot, unsigned long flags);
1136 int (*file_mprotect) (struct vm_area_struct * vma,
1137 unsigned long reqprot,
1138 unsigned long prot);
1139 int (*file_lock) (struct file * file, unsigned int cmd);
1140 int (*file_fcntl) (struct file * file, unsigned int cmd,
1141 unsigned long arg);
1142 int (*file_set_fowner) (struct file * file);
1143 int (*file_send_sigiotask) (struct task_struct * tsk,
1144 struct fown_struct * fown, int sig);
1145 int (*file_receive) (struct file * file);
1146
1147 int (*task_create) (unsigned long clone_flags);
1148 int (*task_alloc_security) (struct task_struct * p);
1149 void (*task_free_security) (struct task_struct * p);
1150 int (*task_setuid) (uid_t id0, uid_t id1, uid_t id2, int flags);
1151 int (*task_post_setuid) (uid_t old_ruid ,
1152 uid_t old_euid, uid_t old_suid, int flags);
1153 int (*task_setgid) (gid_t id0, gid_t id1, gid_t id2, int flags);
1154 int (*task_setpgid) (struct task_struct * p, pid_t pgid);
1155 int (*task_getpgid) (struct task_struct * p);
1156 int (*task_getsid) (struct task_struct * p);
1157 int (*task_setgroups) (struct group_info *group_info);
1158 int (*task_setnice) (struct task_struct * p, int nice);
1159 int (*task_setrlimit) (unsigned int resource, struct rlimit * new_rlim);
1160 int (*task_setscheduler) (struct task_struct * p, int policy,
1161 struct sched_param * lp);
1162 int (*task_getscheduler) (struct task_struct * p);
1163 int (*task_kill) (struct task_struct * p,
1164 struct siginfo * info, int sig);
1165 int (*task_wait) (struct task_struct * p);
1166 int (*task_prctl) (int option, unsigned long arg2,
1167 unsigned long arg3, unsigned long arg4,
1168 unsigned long arg5);
1169 void (*task_reparent_to_init) (struct task_struct * p);
1170 void (*task_to_inode)(struct task_struct *p, struct inode *inode);
1171
1172 int (*ipc_permission) (struct kern_ipc_perm * ipcp, short flag);
1173
1174 int (*msg_msg_alloc_security) (struct msg_msg * msg);
1175 void (*msg_msg_free_security) (struct msg_msg * msg);
1176
1177 int (*msg_queue_alloc_security) (struct msg_queue * msq);
1178 void (*msg_queue_free_security) (struct msg_queue * msq);
1179 int (*msg_queue_associate) (struct msg_queue * msq, int msqflg);
1180 int (*msg_queue_msgctl) (struct msg_queue * msq, int cmd);
1181 int (*msg_queue_msgsnd) (struct msg_queue * msq,
1182 struct msg_msg * msg, int msqflg);
1183 int (*msg_queue_msgrcv) (struct msg_queue * msq,
1184 struct msg_msg * msg,
1185 struct task_struct * target,
1186 long type, int mode);
1187
1188 int (*shm_alloc_security) (struct shmid_kernel * shp);
1189 void (*shm_free_security) (struct shmid_kernel * shp);
1190 int (*shm_associate) (struct shmid_kernel * shp, int shmflg);
1191 int (*shm_shmctl) (struct shmid_kernel * shp, int cmd);
1192 int (*shm_shmat) (struct shmid_kernel * shp,
1193 char __user *shmaddr, int shmflg);
1194
1195 int (*sem_alloc_security) (struct sem_array * sma);
1196 void (*sem_free_security) (struct sem_array * sma);
1197 int (*sem_associate) (struct sem_array * sma, int semflg);
1198 int (*sem_semctl) (struct sem_array * sma, int cmd);
1199 int (*sem_semop) (struct sem_array * sma,
1200 struct sembuf * sops, unsigned nsops, int alter);
1201
1202 int (*netlink_send) (struct sock * sk, struct sk_buff * skb);
1203 int (*netlink_recv) (struct sk_buff * skb);
1204
1205
1206 int (*register_security) (const char *name,
1207 struct security_operations *ops);
1208 int (*unregister_security) (const char *name,
1209 struct security_operations *ops);
1210
1211 void (*d_instantiate) (struct dentry *dentry, struct inode *inode);
1212
1213 int (*getprocattr)(struct task_struct *p, char *name, void *value, size_t size);
1214 int (*setprocattr)(struct task_struct *p, char *name, void *value, size_t size);
1215
1216#ifdef CONFIG_SECURITY_NETWORK
1217 int (*unix_stream_connect) (struct socket * sock,
1218 struct socket * other, struct sock * newsk);
1219 int (*unix_may_send) (struct socket * sock, struct socket * other);
1220
1221 int (*socket_create) (int family, int type, int protocol, int kern);
1222 void (*socket_post_create) (struct socket * sock, int family,
1223 int type, int protocol, int kern);
1224 int (*socket_bind) (struct socket * sock,
1225 struct sockaddr * address, int addrlen);
1226 int (*socket_connect) (struct socket * sock,
1227 struct sockaddr * address, int addrlen);
1228 int (*socket_listen) (struct socket * sock, int backlog);
1229 int (*socket_accept) (struct socket * sock, struct socket * newsock);
1230 void (*socket_post_accept) (struct socket * sock,
1231 struct socket * newsock);
1232 int (*socket_sendmsg) (struct socket * sock,
1233 struct msghdr * msg, int size);
1234 int (*socket_recvmsg) (struct socket * sock,
1235 struct msghdr * msg, int size, int flags);
1236 int (*socket_getsockname) (struct socket * sock);
1237 int (*socket_getpeername) (struct socket * sock);
1238 int (*socket_getsockopt) (struct socket * sock, int level, int optname);
1239 int (*socket_setsockopt) (struct socket * sock, int level, int optname);
1240 int (*socket_shutdown) (struct socket * sock, int how);
1241 int (*socket_sock_rcv_skb) (struct sock * sk, struct sk_buff * skb);
1242 int (*socket_getpeersec) (struct socket *sock, char __user *optval, int __user *optlen, unsigned len);
1243 int (*sk_alloc_security) (struct sock *sk, int family, int priority);
1244 void (*sk_free_security) (struct sock *sk);
1245#endif
1246};
1247
1248
1249extern struct security_operations *security_ops;
1250
1251
1252static inline int security_ptrace (struct task_struct * parent, struct task_struct * child)
1253{
1254 return security_ops->ptrace (parent, child);
1255}
1256
1257static inline int security_capget (struct task_struct *target,
1258 kernel_cap_t *effective,
1259 kernel_cap_t *inheritable,
1260 kernel_cap_t *permitted)
1261{
1262 return security_ops->capget (target, effective, inheritable, permitted);
1263}
1264
1265static inline int security_capset_check (struct task_struct *target,
1266 kernel_cap_t *effective,
1267 kernel_cap_t *inheritable,
1268 kernel_cap_t *permitted)
1269{
1270 return security_ops->capset_check (target, effective, inheritable, permitted);
1271}
1272
1273static inline void security_capset_set (struct task_struct *target,
1274 kernel_cap_t *effective,
1275 kernel_cap_t *inheritable,
1276 kernel_cap_t *permitted)
1277{
1278 security_ops->capset_set (target, effective, inheritable, permitted);
1279}
1280
1281static inline int security_acct (struct file *file)
1282{
1283 return security_ops->acct (file);
1284}
1285
1286static inline int security_sysctl(struct ctl_table *table, int op)
1287{
1288 return security_ops->sysctl(table, op);
1289}
1290
1291static inline int security_quotactl (int cmds, int type, int id,
1292 struct super_block *sb)
1293{
1294 return security_ops->quotactl (cmds, type, id, sb);
1295}
1296
1297static inline int security_quota_on (struct dentry * dentry)
1298{
1299 return security_ops->quota_on (dentry);
1300}
1301
1302static inline int security_syslog(int type)
1303{
1304 return security_ops->syslog(type);
1305}
1306
1307static inline int security_settime(struct timespec *ts, struct timezone *tz)
1308{
1309 return security_ops->settime(ts, tz);
1310}
1311
1312
1313static inline int security_vm_enough_memory(long pages)
1314{
1315 return security_ops->vm_enough_memory(pages);
1316}
1317
1318static inline int security_bprm_alloc (struct linux_binprm *bprm)
1319{
1320 return security_ops->bprm_alloc_security (bprm);
1321}
1322static inline void security_bprm_free (struct linux_binprm *bprm)
1323{
1324 security_ops->bprm_free_security (bprm);
1325}
1326static inline void security_bprm_apply_creds (struct linux_binprm *bprm, int unsafe)
1327{
1328 security_ops->bprm_apply_creds (bprm, unsafe);
1329}
1330static inline void security_bprm_post_apply_creds (struct linux_binprm *bprm)
1331{
1332 security_ops->bprm_post_apply_creds (bprm);
1333}
1334static inline int security_bprm_set (struct linux_binprm *bprm)
1335{
1336 return security_ops->bprm_set_security (bprm);
1337}
1338
1339static inline int security_bprm_check (struct linux_binprm *bprm)
1340{
1341 return security_ops->bprm_check_security (bprm);
1342}
1343
1344static inline int security_bprm_secureexec (struct linux_binprm *bprm)
1345{
1346 return security_ops->bprm_secureexec (bprm);
1347}
1348
1349static inline int security_sb_alloc (struct super_block *sb)
1350{
1351 return security_ops->sb_alloc_security (sb);
1352}
1353
1354static inline void security_sb_free (struct super_block *sb)
1355{
1356 security_ops->sb_free_security (sb);
1357}
1358
1359static inline int security_sb_copy_data (struct file_system_type *type,
1360 void *orig, void *copy)
1361{
1362 return security_ops->sb_copy_data (type, orig, copy);
1363}
1364
1365static inline int security_sb_kern_mount (struct super_block *sb, void *data)
1366{
1367 return security_ops->sb_kern_mount (sb, data);
1368}
1369
1370static inline int security_sb_statfs (struct super_block *sb)
1371{
1372 return security_ops->sb_statfs (sb);
1373}
1374
1375static inline int security_sb_mount (char *dev_name, struct nameidata *nd,
1376 char *type, unsigned long flags,
1377 void *data)
1378{
1379 return security_ops->sb_mount (dev_name, nd, type, flags, data);
1380}
1381
1382static inline int security_sb_check_sb (struct vfsmount *mnt,
1383 struct nameidata *nd)
1384{
1385 return security_ops->sb_check_sb (mnt, nd);
1386}
1387
1388static inline int security_sb_umount (struct vfsmount *mnt, int flags)
1389{
1390 return security_ops->sb_umount (mnt, flags);
1391}
1392
1393static inline void security_sb_umount_close (struct vfsmount *mnt)
1394{
1395 security_ops->sb_umount_close (mnt);
1396}
1397
1398static inline void security_sb_umount_busy (struct vfsmount *mnt)
1399{
1400 security_ops->sb_umount_busy (mnt);
1401}
1402
1403static inline void security_sb_post_remount (struct vfsmount *mnt,
1404 unsigned long flags, void *data)
1405{
1406 security_ops->sb_post_remount (mnt, flags, data);
1407}
1408
1409static inline void security_sb_post_mountroot (void)
1410{
1411 security_ops->sb_post_mountroot ();
1412}
1413
1414static inline void security_sb_post_addmount (struct vfsmount *mnt,
1415 struct nameidata *mountpoint_nd)
1416{
1417 security_ops->sb_post_addmount (mnt, mountpoint_nd);
1418}
1419
1420static inline int security_sb_pivotroot (struct nameidata *old_nd,
1421 struct nameidata *new_nd)
1422{
1423 return security_ops->sb_pivotroot (old_nd, new_nd);
1424}
1425
1426static inline void security_sb_post_pivotroot (struct nameidata *old_nd,
1427 struct nameidata *new_nd)
1428{
1429 security_ops->sb_post_pivotroot (old_nd, new_nd);
1430}
1431
1432static inline int security_inode_alloc (struct inode *inode)
1433{
1434 if (unlikely (IS_PRIVATE (inode)))
1435 return 0;
1436 return security_ops->inode_alloc_security (inode);
1437}
1438
1439static inline void security_inode_free (struct inode *inode)
1440{
1441 if (unlikely (IS_PRIVATE (inode)))
1442 return;
1443 security_ops->inode_free_security (inode);
1444}
1445
1446static inline int security_inode_create (struct inode *dir,
1447 struct dentry *dentry,
1448 int mode)
1449{
1450 if (unlikely (IS_PRIVATE (dir)))
1451 return 0;
1452 return security_ops->inode_create (dir, dentry, mode);
1453}
1454
1455static inline void security_inode_post_create (struct inode *dir,
1456 struct dentry *dentry,
1457 int mode)
1458{
1459 if (dentry->d_inode && unlikely (IS_PRIVATE (dentry->d_inode)))
1460 return;
1461 security_ops->inode_post_create (dir, dentry, mode);
1462}
1463
1464static inline int security_inode_link (struct dentry *old_dentry,
1465 struct inode *dir,
1466 struct dentry *new_dentry)
1467{
1468 if (unlikely (IS_PRIVATE (old_dentry->d_inode)))
1469 return 0;
1470 return security_ops->inode_link (old_dentry, dir, new_dentry);
1471}
1472
1473static inline void security_inode_post_link (struct dentry *old_dentry,
1474 struct inode *dir,
1475 struct dentry *new_dentry)
1476{
1477 if (new_dentry->d_inode && unlikely (IS_PRIVATE (new_dentry->d_inode)))
1478 return;
1479 security_ops->inode_post_link (old_dentry, dir, new_dentry);
1480}
1481
1482static inline int security_inode_unlink (struct inode *dir,
1483 struct dentry *dentry)
1484{
1485 if (unlikely (IS_PRIVATE (dentry->d_inode)))
1486 return 0;
1487 return security_ops->inode_unlink (dir, dentry);
1488}
1489
1490static inline int security_inode_symlink (struct inode *dir,
1491 struct dentry *dentry,
1492 const char *old_name)
1493{
1494 if (unlikely (IS_PRIVATE (dir)))
1495 return 0;
1496 return security_ops->inode_symlink (dir, dentry, old_name);
1497}
1498
1499static inline void security_inode_post_symlink (struct inode *dir,
1500 struct dentry *dentry,
1501 const char *old_name)
1502{
1503 if (dentry->d_inode && unlikely (IS_PRIVATE (dentry->d_inode)))
1504 return;
1505 security_ops->inode_post_symlink (dir, dentry, old_name);
1506}
1507
1508static inline int security_inode_mkdir (struct inode *dir,
1509 struct dentry *dentry,
1510 int mode)
1511{
1512 if (unlikely (IS_PRIVATE (dir)))
1513 return 0;
1514 return security_ops->inode_mkdir (dir, dentry, mode);
1515}
1516
1517static inline void security_inode_post_mkdir (struct inode *dir,
1518 struct dentry *dentry,
1519 int mode)
1520{
1521 if (dentry->d_inode && unlikely (IS_PRIVATE (dentry->d_inode)))
1522 return;
1523 security_ops->inode_post_mkdir (dir, dentry, mode);
1524}
1525
1526static inline int security_inode_rmdir (struct inode *dir,
1527 struct dentry *dentry)
1528{
1529 if (unlikely (IS_PRIVATE (dentry->d_inode)))
1530 return 0;
1531 return security_ops->inode_rmdir (dir, dentry);
1532}
1533
1534static inline int security_inode_mknod (struct inode *dir,
1535 struct dentry *dentry,
1536 int mode, dev_t dev)
1537{
1538 if (unlikely (IS_PRIVATE (dir)))
1539 return 0;
1540 return security_ops->inode_mknod (dir, dentry, mode, dev);
1541}
1542
1543static inline void security_inode_post_mknod (struct inode *dir,
1544 struct dentry *dentry,
1545 int mode, dev_t dev)
1546{
1547 if (dentry->d_inode && unlikely (IS_PRIVATE (dentry->d_inode)))
1548 return;
1549 security_ops->inode_post_mknod (dir, dentry, mode, dev);
1550}
1551
1552static inline int security_inode_rename (struct inode *old_dir,
1553 struct dentry *old_dentry,
1554 struct inode *new_dir,
1555 struct dentry *new_dentry)
1556{
1557 if (unlikely (IS_PRIVATE (old_dentry->d_inode) ||
1558 (new_dentry->d_inode && IS_PRIVATE (new_dentry->d_inode))))
1559 return 0;
1560 return security_ops->inode_rename (old_dir, old_dentry,
1561 new_dir, new_dentry);
1562}
1563
1564static inline void security_inode_post_rename (struct inode *old_dir,
1565 struct dentry *old_dentry,
1566 struct inode *new_dir,
1567 struct dentry *new_dentry)
1568{
1569 if (unlikely (IS_PRIVATE (old_dentry->d_inode) ||
1570 (new_dentry->d_inode && IS_PRIVATE (new_dentry->d_inode))))
1571 return;
1572 security_ops->inode_post_rename (old_dir, old_dentry,
1573 new_dir, new_dentry);
1574}
1575
1576static inline int security_inode_readlink (struct dentry *dentry)
1577{
1578 if (unlikely (IS_PRIVATE (dentry->d_inode)))
1579 return 0;
1580 return security_ops->inode_readlink (dentry);
1581}
1582
1583static inline int security_inode_follow_link (struct dentry *dentry,
1584 struct nameidata *nd)
1585{
1586 if (unlikely (IS_PRIVATE (dentry->d_inode)))
1587 return 0;
1588 return security_ops->inode_follow_link (dentry, nd);
1589}
1590
1591static inline int security_inode_permission (struct inode *inode, int mask,
1592 struct nameidata *nd)
1593{
1594 if (unlikely (IS_PRIVATE (inode)))
1595 return 0;
1596 return security_ops->inode_permission (inode, mask, nd);
1597}
1598
1599static inline int security_inode_setattr (struct dentry *dentry,
1600 struct iattr *attr)
1601{
1602 if (unlikely (IS_PRIVATE (dentry->d_inode)))
1603 return 0;
1604 return security_ops->inode_setattr (dentry, attr);
1605}
1606
1607static inline int security_inode_getattr (struct vfsmount *mnt,
1608 struct dentry *dentry)
1609{
1610 if (unlikely (IS_PRIVATE (dentry->d_inode)))
1611 return 0;
1612 return security_ops->inode_getattr (mnt, dentry);
1613}
1614
1615static inline void security_inode_delete (struct inode *inode)
1616{
1617 if (unlikely (IS_PRIVATE (inode)))
1618 return;
1619 security_ops->inode_delete (inode);
1620}
1621
1622static inline int security_inode_setxattr (struct dentry *dentry, char *name,
1623 void *value, size_t size, int flags)
1624{
1625 if (unlikely (IS_PRIVATE (dentry->d_inode)))
1626 return 0;
1627 return security_ops->inode_setxattr (dentry, name, value, size, flags);
1628}
1629
1630static inline void security_inode_post_setxattr (struct dentry *dentry, char *name,
1631 void *value, size_t size, int flags)
1632{
1633 if (unlikely (IS_PRIVATE (dentry->d_inode)))
1634 return;
1635 security_ops->inode_post_setxattr (dentry, name, value, size, flags);
1636}
1637
1638static inline int security_inode_getxattr (struct dentry *dentry, char *name)
1639{
1640 if (unlikely (IS_PRIVATE (dentry->d_inode)))
1641 return 0;
1642 return security_ops->inode_getxattr (dentry, name);
1643}
1644
1645static inline int security_inode_listxattr (struct dentry *dentry)
1646{
1647 if (unlikely (IS_PRIVATE (dentry->d_inode)))
1648 return 0;
1649 return security_ops->inode_listxattr (dentry);
1650}
1651
1652static inline int security_inode_removexattr (struct dentry *dentry, char *name)
1653{
1654 if (unlikely (IS_PRIVATE (dentry->d_inode)))
1655 return 0;
1656 return security_ops->inode_removexattr (dentry, name);
1657}
1658
1659static inline int security_inode_getsecurity(struct inode *inode, const char *name, void *buffer, size_t size)
1660{
1661 if (unlikely (IS_PRIVATE (inode)))
1662 return 0;
1663 return security_ops->inode_getsecurity(inode, name, buffer, size);
1664}
1665
1666static inline int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags)
1667{
1668 if (unlikely (IS_PRIVATE (inode)))
1669 return 0;
1670 return security_ops->inode_setsecurity(inode, name, value, size, flags);
1671}
1672
1673static inline int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size)
1674{
1675 if (unlikely (IS_PRIVATE (inode)))
1676 return 0;
1677 return security_ops->inode_listsecurity(inode, buffer, buffer_size);
1678}
1679
1680static inline int security_file_permission (struct file *file, int mask)
1681{
1682 return security_ops->file_permission (file, mask);
1683}
1684
1685static inline int security_file_alloc (struct file *file)
1686{
1687 return security_ops->file_alloc_security (file);
1688}
1689
1690static inline void security_file_free (struct file *file)
1691{
1692 security_ops->file_free_security (file);
1693}
1694
1695static inline int security_file_ioctl (struct file *file, unsigned int cmd,
1696 unsigned long arg)
1697{
1698 return security_ops->file_ioctl (file, cmd, arg);
1699}
1700
1701static inline int security_file_mmap (struct file *file, unsigned long reqprot,
1702 unsigned long prot,
1703 unsigned long flags)
1704{
1705 return security_ops->file_mmap (file, reqprot, prot, flags);
1706}
1707
1708static inline int security_file_mprotect (struct vm_area_struct *vma,
1709 unsigned long reqprot,
1710 unsigned long prot)
1711{
1712 return security_ops->file_mprotect (vma, reqprot, prot);
1713}
1714
1715static inline int security_file_lock (struct file *file, unsigned int cmd)
1716{
1717 return security_ops->file_lock (file, cmd);
1718}
1719
1720static inline int security_file_fcntl (struct file *file, unsigned int cmd,
1721 unsigned long arg)
1722{
1723 return security_ops->file_fcntl (file, cmd, arg);
1724}
1725
1726static inline int security_file_set_fowner (struct file *file)
1727{
1728 return security_ops->file_set_fowner (file);
1729}
1730
1731static inline int security_file_send_sigiotask (struct task_struct *tsk,
1732 struct fown_struct *fown,
1733 int sig)
1734{
1735 return security_ops->file_send_sigiotask (tsk, fown, sig);
1736}
1737
1738static inline int security_file_receive (struct file *file)
1739{
1740 return security_ops->file_receive (file);
1741}
1742
1743static inline int security_task_create (unsigned long clone_flags)
1744{
1745 return security_ops->task_create (clone_flags);
1746}
1747
1748static inline int security_task_alloc (struct task_struct *p)
1749{
1750 return security_ops->task_alloc_security (p);
1751}
1752
1753static inline void security_task_free (struct task_struct *p)
1754{
1755 security_ops->task_free_security (p);
1756}
1757
1758static inline int security_task_setuid (uid_t id0, uid_t id1, uid_t id2,
1759 int flags)
1760{
1761 return security_ops->task_setuid (id0, id1, id2, flags);
1762}
1763
1764static inline int security_task_post_setuid (uid_t old_ruid, uid_t old_euid,
1765 uid_t old_suid, int flags)
1766{
1767 return security_ops->task_post_setuid (old_ruid, old_euid, old_suid, flags);
1768}
1769
1770static inline int security_task_setgid (gid_t id0, gid_t id1, gid_t id2,
1771 int flags)
1772{
1773 return security_ops->task_setgid (id0, id1, id2, flags);
1774}
1775
1776static inline int security_task_setpgid (struct task_struct *p, pid_t pgid)
1777{
1778 return security_ops->task_setpgid (p, pgid);
1779}
1780
1781static inline int security_task_getpgid (struct task_struct *p)
1782{
1783 return security_ops->task_getpgid (p);
1784}
1785
1786static inline int security_task_getsid (struct task_struct *p)
1787{
1788 return security_ops->task_getsid (p);
1789}
1790
1791static inline int security_task_setgroups (struct group_info *group_info)
1792{
1793 return security_ops->task_setgroups (group_info);
1794}
1795
1796static inline int security_task_setnice (struct task_struct *p, int nice)
1797{
1798 return security_ops->task_setnice (p, nice);
1799}
1800
1801static inline int security_task_setrlimit (unsigned int resource,
1802 struct rlimit *new_rlim)
1803{
1804 return security_ops->task_setrlimit (resource, new_rlim);
1805}
1806
1807static inline int security_task_setscheduler (struct task_struct *p,
1808 int policy,
1809 struct sched_param *lp)
1810{
1811 return security_ops->task_setscheduler (p, policy, lp);
1812}
1813
1814static inline int security_task_getscheduler (struct task_struct *p)
1815{
1816 return security_ops->task_getscheduler (p);
1817}
1818
1819static inline int security_task_kill (struct task_struct *p,
1820 struct siginfo *info, int sig)
1821{
1822 return security_ops->task_kill (p, info, sig);
1823}
1824
1825static inline int security_task_wait (struct task_struct *p)
1826{
1827 return security_ops->task_wait (p);
1828}
1829
1830static inline int security_task_prctl (int option, unsigned long arg2,
1831 unsigned long arg3,
1832 unsigned long arg4,
1833 unsigned long arg5)
1834{
1835 return security_ops->task_prctl (option, arg2, arg3, arg4, arg5);
1836}
1837
1838static inline void security_task_reparent_to_init (struct task_struct *p)
1839{
1840 security_ops->task_reparent_to_init (p);
1841}
1842
1843static inline void security_task_to_inode(struct task_struct *p, struct inode *inode)
1844{
1845 security_ops->task_to_inode(p, inode);
1846}
1847
1848static inline int security_ipc_permission (struct kern_ipc_perm *ipcp,
1849 short flag)
1850{
1851 return security_ops->ipc_permission (ipcp, flag);
1852}
1853
1854static inline int security_msg_msg_alloc (struct msg_msg * msg)
1855{
1856 return security_ops->msg_msg_alloc_security (msg);
1857}
1858
1859static inline void security_msg_msg_free (struct msg_msg * msg)
1860{
1861 security_ops->msg_msg_free_security(msg);
1862}
1863
1864static inline int security_msg_queue_alloc (struct msg_queue *msq)
1865{
1866 return security_ops->msg_queue_alloc_security (msq);
1867}
1868
1869static inline void security_msg_queue_free (struct msg_queue *msq)
1870{
1871 security_ops->msg_queue_free_security (msq);
1872}
1873
1874static inline int security_msg_queue_associate (struct msg_queue * msq,
1875 int msqflg)
1876{
1877 return security_ops->msg_queue_associate (msq, msqflg);
1878}
1879
1880static inline int security_msg_queue_msgctl (struct msg_queue * msq, int cmd)
1881{
1882 return security_ops->msg_queue_msgctl (msq, cmd);
1883}
1884
1885static inline int security_msg_queue_msgsnd (struct msg_queue * msq,
1886 struct msg_msg * msg, int msqflg)
1887{
1888 return security_ops->msg_queue_msgsnd (msq, msg, msqflg);
1889}
1890
1891static inline int security_msg_queue_msgrcv (struct msg_queue * msq,
1892 struct msg_msg * msg,
1893 struct task_struct * target,
1894 long type, int mode)
1895{
1896 return security_ops->msg_queue_msgrcv (msq, msg, target, type, mode);
1897}
1898
1899static inline int security_shm_alloc (struct shmid_kernel *shp)
1900{
1901 return security_ops->shm_alloc_security (shp);
1902}
1903
1904static inline void security_shm_free (struct shmid_kernel *shp)
1905{
1906 security_ops->shm_free_security (shp);
1907}
1908
1909static inline int security_shm_associate (struct shmid_kernel * shp,
1910 int shmflg)
1911{
1912 return security_ops->shm_associate(shp, shmflg);
1913}
1914
1915static inline int security_shm_shmctl (struct shmid_kernel * shp, int cmd)
1916{
1917 return security_ops->shm_shmctl (shp, cmd);
1918}
1919
1920static inline int security_shm_shmat (struct shmid_kernel * shp,
1921 char __user *shmaddr, int shmflg)
1922{
1923 return security_ops->shm_shmat(shp, shmaddr, shmflg);
1924}
1925
1926static inline int security_sem_alloc (struct sem_array *sma)
1927{
1928 return security_ops->sem_alloc_security (sma);
1929}
1930
1931static inline void security_sem_free (struct sem_array *sma)
1932{
1933 security_ops->sem_free_security (sma);
1934}
1935
1936static inline int security_sem_associate (struct sem_array * sma, int semflg)
1937{
1938 return security_ops->sem_associate (sma, semflg);
1939}
1940
1941static inline int security_sem_semctl (struct sem_array * sma, int cmd)
1942{
1943 return security_ops->sem_semctl(sma, cmd);
1944}
1945
1946static inline int security_sem_semop (struct sem_array * sma,
1947 struct sembuf * sops, unsigned nsops,
1948 int alter)
1949{
1950 return security_ops->sem_semop(sma, sops, nsops, alter);
1951}
1952
1953static inline void security_d_instantiate (struct dentry *dentry, struct inode *inode)
1954{
1955 if (unlikely (inode && IS_PRIVATE (inode)))
1956 return;
1957 security_ops->d_instantiate (dentry, inode);
1958}
1959
1960static inline int security_getprocattr(struct task_struct *p, char *name, void *value, size_t size)
1961{
1962 return security_ops->getprocattr(p, name, value, size);
1963}
1964
1965static inline int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size)
1966{
1967 return security_ops->setprocattr(p, name, value, size);
1968}
1969
1970static inline int security_netlink_send(struct sock *sk, struct sk_buff * skb)
1971{
1972 return security_ops->netlink_send(sk, skb);
1973}
1974
1975static inline int security_netlink_recv(struct sk_buff * skb)
1976{
1977 return security_ops->netlink_recv(skb);
1978}
1979
1980
1981extern int security_init (void);
1982extern int register_security (struct security_operations *ops);
1983extern int unregister_security (struct security_operations *ops);
1984extern int mod_reg_security (const char *name, struct security_operations *ops);
1985extern int mod_unreg_security (const char *name, struct security_operations *ops);
1986
1987
1988#else
1989
1990
1991
1992
1993
1994
1995static inline int security_init(void)
1996{
1997 return 0;
1998}
1999
2000static inline int security_ptrace (struct task_struct *parent, struct task_struct * child)
2001{
2002 return cap_ptrace (parent, child);
2003}
2004
2005static inline int security_capget (struct task_struct *target,
2006 kernel_cap_t *effective,
2007 kernel_cap_t *inheritable,
2008 kernel_cap_t *permitted)
2009{
2010 return cap_capget (target, effective, inheritable, permitted);
2011}
2012
2013static inline int security_capset_check (struct task_struct *target,
2014 kernel_cap_t *effective,
2015 kernel_cap_t *inheritable,
2016 kernel_cap_t *permitted)
2017{
2018 return cap_capset_check (target, effective, inheritable, permitted);
2019}
2020
2021static inline void security_capset_set (struct task_struct *target,
2022 kernel_cap_t *effective,
2023 kernel_cap_t *inheritable,
2024 kernel_cap_t *permitted)
2025{
2026 cap_capset_set (target, effective, inheritable, permitted);
2027}
2028
2029static inline int security_acct (struct file *file)
2030{
2031 return 0;
2032}
2033
2034static inline int security_sysctl(struct ctl_table *table, int op)
2035{
2036 return 0;
2037}
2038
2039static inline int security_quotactl (int cmds, int type, int id,
2040 struct super_block * sb)
2041{
2042 return 0;
2043}
2044
2045static inline int security_quota_on (struct dentry * dentry)
2046{
2047 return 0;
2048}
2049
2050static inline int security_syslog(int type)
2051{
2052 return cap_syslog(type);
2053}
2054
2055static inline int security_settime(struct timespec *ts, struct timezone *tz)
2056{
2057 return cap_settime(ts, tz);
2058}
2059
2060static inline int security_vm_enough_memory(long pages)
2061{
2062 return cap_vm_enough_memory(pages);
2063}
2064
2065static inline int security_bprm_alloc (struct linux_binprm *bprm)
2066{
2067 return 0;
2068}
2069
2070static inline void security_bprm_free (struct linux_binprm *bprm)
2071{ }
2072
2073static inline void security_bprm_apply_creds (struct linux_binprm *bprm, int unsafe)
2074{
2075 cap_bprm_apply_creds (bprm, unsafe);
2076}
2077
2078static inline void security_bprm_post_apply_creds (struct linux_binprm *bprm)
2079{
2080 return;
2081}
2082
2083static inline int security_bprm_set (struct linux_binprm *bprm)
2084{
2085 return cap_bprm_set_security (bprm);
2086}
2087
2088static inline int security_bprm_check (struct linux_binprm *bprm)
2089{
2090 return 0;
2091}
2092
2093static inline int security_bprm_secureexec (struct linux_binprm *bprm)
2094{
2095 return cap_bprm_secureexec(bprm);
2096}
2097
2098static inline int security_sb_alloc (struct super_block *sb)
2099{
2100 return 0;
2101}
2102
2103static inline void security_sb_free (struct super_block *sb)
2104{ }
2105
2106static inline int security_sb_copy_data (struct file_system_type *type,
2107 void *orig, void *copy)
2108{
2109 return 0;
2110}
2111
2112static inline int security_sb_kern_mount (struct super_block *sb, void *data)
2113{
2114 return 0;
2115}
2116
2117static inline int security_sb_statfs (struct super_block *sb)
2118{
2119 return 0;
2120}
2121
2122static inline int security_sb_mount (char *dev_name, struct nameidata *nd,
2123 char *type, unsigned long flags,
2124 void *data)
2125{
2126 return 0;
2127}
2128
2129static inline int security_sb_check_sb (struct vfsmount *mnt,
2130 struct nameidata *nd)
2131{
2132 return 0;
2133}
2134
2135static inline int security_sb_umount (struct vfsmount *mnt, int flags)
2136{
2137 return 0;
2138}
2139
2140static inline void security_sb_umount_close (struct vfsmount *mnt)
2141{ }
2142
2143static inline void security_sb_umount_busy (struct vfsmount *mnt)
2144{ }
2145
2146static inline void security_sb_post_remount (struct vfsmount *mnt,
2147 unsigned long flags, void *data)
2148{ }
2149
2150static inline void security_sb_post_mountroot (void)
2151{ }
2152
2153static inline void security_sb_post_addmount (struct vfsmount *mnt,
2154 struct nameidata *mountpoint_nd)
2155{ }
2156
2157static inline int security_sb_pivotroot (struct nameidata *old_nd,
2158 struct nameidata *new_nd)
2159{
2160 return 0;
2161}
2162
2163static inline void security_sb_post_pivotroot (struct nameidata *old_nd,
2164 struct nameidata *new_nd)
2165{ }
2166
2167static inline int security_inode_alloc (struct inode *inode)
2168{
2169 return 0;
2170}
2171
2172static inline void security_inode_free (struct inode *inode)
2173{ }
2174
2175static inline int security_inode_create (struct inode *dir,
2176 struct dentry *dentry,
2177 int mode)
2178{
2179 return 0;
2180}
2181
2182static inline void security_inode_post_create (struct inode *dir,
2183 struct dentry *dentry,
2184 int mode)
2185{ }
2186
2187static inline int security_inode_link (struct dentry *old_dentry,
2188 struct inode *dir,
2189 struct dentry *new_dentry)
2190{
2191 return 0;
2192}
2193
2194static inline void security_inode_post_link (struct dentry *old_dentry,
2195 struct inode *dir,
2196 struct dentry *new_dentry)
2197{ }
2198
2199static inline int security_inode_unlink (struct inode *dir,
2200 struct dentry *dentry)
2201{
2202 return 0;
2203}
2204
2205static inline int security_inode_symlink (struct inode *dir,
2206 struct dentry *dentry,
2207 const char *old_name)
2208{
2209 return 0;
2210}
2211
2212static inline void security_inode_post_symlink (struct inode *dir,
2213 struct dentry *dentry,
2214 const char *old_name)
2215{ }
2216
2217static inline int security_inode_mkdir (struct inode *dir,
2218 struct dentry *dentry,
2219 int mode)
2220{
2221 return 0;
2222}
2223
2224static inline void security_inode_post_mkdir (struct inode *dir,
2225 struct dentry *dentry,
2226 int mode)
2227{ }
2228
2229static inline int security_inode_rmdir (struct inode *dir,
2230 struct dentry *dentry)
2231{
2232 return 0;
2233}
2234
2235static inline int security_inode_mknod (struct inode *dir,
2236 struct dentry *dentry,
2237 int mode, dev_t dev)
2238{
2239 return 0;
2240}
2241
2242static inline void security_inode_post_mknod (struct inode *dir,
2243 struct dentry *dentry,
2244 int mode, dev_t dev)
2245{ }
2246
2247static inline int security_inode_rename (struct inode *old_dir,
2248 struct dentry *old_dentry,
2249 struct inode *new_dir,
2250 struct dentry *new_dentry)
2251{
2252 return 0;
2253}
2254
2255static inline void security_inode_post_rename (struct inode *old_dir,
2256 struct dentry *old_dentry,
2257 struct inode *new_dir,
2258 struct dentry *new_dentry)
2259{ }
2260
2261static inline int security_inode_readlink (struct dentry *dentry)
2262{
2263 return 0;
2264}
2265
2266static inline int security_inode_follow_link (struct dentry *dentry,
2267 struct nameidata *nd)
2268{
2269 return 0;
2270}
2271
2272static inline int security_inode_permission (struct inode *inode, int mask,
2273 struct nameidata *nd)
2274{
2275 return 0;
2276}
2277
2278static inline int security_inode_setattr (struct dentry *dentry,
2279 struct iattr *attr)
2280{
2281 return 0;
2282}
2283
2284static inline int security_inode_getattr (struct vfsmount *mnt,
2285 struct dentry *dentry)
2286{
2287 return 0;
2288}
2289
2290static inline void security_inode_delete (struct inode *inode)
2291{ }
2292
2293static inline int security_inode_setxattr (struct dentry *dentry, char *name,
2294 void *value, size_t size, int flags)
2295{
2296 return cap_inode_setxattr(dentry, name, value, size, flags);
2297}
2298
2299static inline void security_inode_post_setxattr (struct dentry *dentry, char *name,
2300 void *value, size_t size, int flags)
2301{ }
2302
2303static inline int security_inode_getxattr (struct dentry *dentry, char *name)
2304{
2305 return 0;
2306}
2307
2308static inline int security_inode_listxattr (struct dentry *dentry)
2309{
2310 return 0;
2311}
2312
2313static inline int security_inode_removexattr (struct dentry *dentry, char *name)
2314{
2315 return cap_inode_removexattr(dentry, name);
2316}
2317
2318static inline int security_inode_getsecurity(struct inode *inode, const char *name, void *buffer, size_t size)
2319{
2320 return -EOPNOTSUPP;
2321}
2322
2323static inline int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags)
2324{
2325 return -EOPNOTSUPP;
2326}
2327
2328static inline int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size)
2329{
2330 return 0;
2331}
2332
2333static inline int security_file_permission (struct file *file, int mask)
2334{
2335 return 0;
2336}
2337
2338static inline int security_file_alloc (struct file *file)
2339{
2340 return 0;
2341}
2342
2343static inline void security_file_free (struct file *file)
2344{ }
2345
2346static inline int security_file_ioctl (struct file *file, unsigned int cmd,
2347 unsigned long arg)
2348{
2349 return 0;
2350}
2351
2352static inline int security_file_mmap (struct file *file, unsigned long reqprot,
2353 unsigned long prot,
2354 unsigned long flags)
2355{
2356 return 0;
2357}
2358
2359static inline int security_file_mprotect (struct vm_area_struct *vma,
2360 unsigned long reqprot,
2361 unsigned long prot)
2362{
2363 return 0;
2364}
2365
2366static inline int security_file_lock (struct file *file, unsigned int cmd)
2367{
2368 return 0;
2369}
2370
2371static inline int security_file_fcntl (struct file *file, unsigned int cmd,
2372 unsigned long arg)
2373{
2374 return 0;
2375}
2376
2377static inline int security_file_set_fowner (struct file *file)
2378{
2379 return 0;
2380}
2381
2382static inline int security_file_send_sigiotask (struct task_struct *tsk,
2383 struct fown_struct *fown,
2384 int sig)
2385{
2386 return 0;
2387}
2388
2389static inline int security_file_receive (struct file *file)
2390{
2391 return 0;
2392}
2393
2394static inline int security_task_create (unsigned long clone_flags)
2395{
2396 return 0;
2397}
2398
2399static inline int security_task_alloc (struct task_struct *p)
2400{
2401 return 0;
2402}
2403
2404static inline void security_task_free (struct task_struct *p)
2405{ }
2406
2407static inline int security_task_setuid (uid_t id0, uid_t id1, uid_t id2,
2408 int flags)
2409{
2410 return 0;
2411}
2412
2413static inline int security_task_post_setuid (uid_t old_ruid, uid_t old_euid,
2414 uid_t old_suid, int flags)
2415{
2416 return cap_task_post_setuid (old_ruid, old_euid, old_suid, flags);
2417}
2418
2419static inline int security_task_setgid (gid_t id0, gid_t id1, gid_t id2,
2420 int flags)
2421{
2422 return 0;
2423}
2424
2425static inline int security_task_setpgid (struct task_struct *p, pid_t pgid)
2426{
2427 return 0;
2428}
2429
2430static inline int security_task_getpgid (struct task_struct *p)
2431{
2432 return 0;
2433}
2434
2435static inline int security_task_getsid (struct task_struct *p)
2436{
2437 return 0;
2438}
2439
2440static inline int security_task_setgroups (struct group_info *group_info)
2441{
2442 return 0;
2443}
2444
2445static inline int security_task_setnice (struct task_struct *p, int nice)
2446{
2447 return 0;
2448}
2449
2450static inline int security_task_setrlimit (unsigned int resource,
2451 struct rlimit *new_rlim)
2452{
2453 return 0;
2454}
2455
2456static inline int security_task_setscheduler (struct task_struct *p,
2457 int policy,
2458 struct sched_param *lp)
2459{
2460 return 0;
2461}
2462
2463static inline int security_task_getscheduler (struct task_struct *p)
2464{
2465 return 0;
2466}
2467
2468static inline int security_task_kill (struct task_struct *p,
2469 struct siginfo *info, int sig)
2470{
2471 return 0;
2472}
2473
2474static inline int security_task_wait (struct task_struct *p)
2475{
2476 return 0;
2477}
2478
2479static inline int security_task_prctl (int option, unsigned long arg2,
2480 unsigned long arg3,
2481 unsigned long arg4,
2482 unsigned long arg5)
2483{
2484 return 0;
2485}
2486
2487static inline void security_task_reparent_to_init (struct task_struct *p)
2488{
2489 cap_task_reparent_to_init (p);
2490}
2491
2492static inline void security_task_to_inode(struct task_struct *p, struct inode *inode)
2493{ }
2494
2495static inline int security_ipc_permission (struct kern_ipc_perm *ipcp,
2496 short flag)
2497{
2498 return 0;
2499}
2500
2501static inline int security_msg_msg_alloc (struct msg_msg * msg)
2502{
2503 return 0;
2504}
2505
2506static inline void security_msg_msg_free (struct msg_msg * msg)
2507{ }
2508
2509static inline int security_msg_queue_alloc (struct msg_queue *msq)
2510{
2511 return 0;
2512}
2513
2514static inline void security_msg_queue_free (struct msg_queue *msq)
2515{ }
2516
2517static inline int security_msg_queue_associate (struct msg_queue * msq,
2518 int msqflg)
2519{
2520 return 0;
2521}
2522
2523static inline int security_msg_queue_msgctl (struct msg_queue * msq, int cmd)
2524{
2525 return 0;
2526}
2527
2528static inline int security_msg_queue_msgsnd (struct msg_queue * msq,
2529 struct msg_msg * msg, int msqflg)
2530{
2531 return 0;
2532}
2533
2534static inline int security_msg_queue_msgrcv (struct msg_queue * msq,
2535 struct msg_msg * msg,
2536 struct task_struct * target,
2537 long type, int mode)
2538{
2539 return 0;
2540}
2541
2542static inline int security_shm_alloc (struct shmid_kernel *shp)
2543{
2544 return 0;
2545}
2546
2547static inline void security_shm_free (struct shmid_kernel *shp)
2548{ }
2549
2550static inline int security_shm_associate (struct shmid_kernel * shp,
2551 int shmflg)
2552{
2553 return 0;
2554}
2555
2556static inline int security_shm_shmctl (struct shmid_kernel * shp, int cmd)
2557{
2558 return 0;
2559}
2560
2561static inline int security_shm_shmat (struct shmid_kernel * shp,
2562 char __user *shmaddr, int shmflg)
2563{
2564 return 0;
2565}
2566
2567static inline int security_sem_alloc (struct sem_array *sma)
2568{
2569 return 0;
2570}
2571
2572static inline void security_sem_free (struct sem_array *sma)
2573{ }
2574
2575static inline int security_sem_associate (struct sem_array * sma, int semflg)
2576{
2577 return 0;
2578}
2579
2580static inline int security_sem_semctl (struct sem_array * sma, int cmd)
2581{
2582 return 0;
2583}
2584
2585static inline int security_sem_semop (struct sem_array * sma,
2586 struct sembuf * sops, unsigned nsops,
2587 int alter)
2588{
2589 return 0;
2590}
2591
2592static inline void security_d_instantiate (struct dentry *dentry, struct inode *inode)
2593{ }
2594
2595static inline int security_getprocattr(struct task_struct *p, char *name, void *value, size_t size)
2596{
2597 return -EINVAL;
2598}
2599
2600static inline int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size)
2601{
2602 return -EINVAL;
2603}
2604
2605static inline int security_netlink_send (struct sock *sk, struct sk_buff *skb)
2606{
2607 return cap_netlink_send (sk, skb);
2608}
2609
2610static inline int security_netlink_recv (struct sk_buff *skb)
2611{
2612 return cap_netlink_recv (skb);
2613}
2614
2615#endif
2616
2617#ifdef CONFIG_SECURITY_NETWORK
2618static inline int security_unix_stream_connect(struct socket * sock,
2619 struct socket * other,
2620 struct sock * newsk)
2621{
2622 return security_ops->unix_stream_connect(sock, other, newsk);
2623}
2624
2625
2626static inline int security_unix_may_send(struct socket * sock,
2627 struct socket * other)
2628{
2629 return security_ops->unix_may_send(sock, other);
2630}
2631
2632static inline int security_socket_create (int family, int type,
2633 int protocol, int kern)
2634{
2635 return security_ops->socket_create(family, type, protocol, kern);
2636}
2637
2638static inline void security_socket_post_create(struct socket * sock,
2639 int family,
2640 int type,
2641 int protocol, int kern)
2642{
2643 security_ops->socket_post_create(sock, family, type,
2644 protocol, kern);
2645}
2646
2647static inline int security_socket_bind(struct socket * sock,
2648 struct sockaddr * address,
2649 int addrlen)
2650{
2651 return security_ops->socket_bind(sock, address, addrlen);
2652}
2653
2654static inline int security_socket_connect(struct socket * sock,
2655 struct sockaddr * address,
2656 int addrlen)
2657{
2658 return security_ops->socket_connect(sock, address, addrlen);
2659}
2660
2661static inline int security_socket_listen(struct socket * sock, int backlog)
2662{
2663 return security_ops->socket_listen(sock, backlog);
2664}
2665
2666static inline int security_socket_accept(struct socket * sock,
2667 struct socket * newsock)
2668{
2669 return security_ops->socket_accept(sock, newsock);
2670}
2671
2672static inline void security_socket_post_accept(struct socket * sock,
2673 struct socket * newsock)
2674{
2675 security_ops->socket_post_accept(sock, newsock);
2676}
2677
2678static inline int security_socket_sendmsg(struct socket * sock,
2679 struct msghdr * msg, int size)
2680{
2681 return security_ops->socket_sendmsg(sock, msg, size);
2682}
2683
2684static inline int security_socket_recvmsg(struct socket * sock,
2685 struct msghdr * msg, int size,
2686 int flags)
2687{
2688 return security_ops->socket_recvmsg(sock, msg, size, flags);
2689}
2690
2691static inline int security_socket_getsockname(struct socket * sock)
2692{
2693 return security_ops->socket_getsockname(sock);
2694}
2695
2696static inline int security_socket_getpeername(struct socket * sock)
2697{
2698 return security_ops->socket_getpeername(sock);
2699}
2700
2701static inline int security_socket_getsockopt(struct socket * sock,
2702 int level, int optname)
2703{
2704 return security_ops->socket_getsockopt(sock, level, optname);
2705}
2706
2707static inline int security_socket_setsockopt(struct socket * sock,
2708 int level, int optname)
2709{
2710 return security_ops->socket_setsockopt(sock, level, optname);
2711}
2712
2713static inline int security_socket_shutdown(struct socket * sock, int how)
2714{
2715 return security_ops->socket_shutdown(sock, how);
2716}
2717
2718static inline int security_sock_rcv_skb (struct sock * sk,
2719 struct sk_buff * skb)
2720{
2721 return security_ops->socket_sock_rcv_skb (sk, skb);
2722}
2723
2724static inline int security_socket_getpeersec(struct socket *sock, char __user *optval,
2725 int __user *optlen, unsigned len)
2726{
2727 return security_ops->socket_getpeersec(sock, optval, optlen, len);
2728}
2729
2730static inline int security_sk_alloc(struct sock *sk, int family, int priority)
2731{
2732 return security_ops->sk_alloc_security(sk, family, priority);
2733}
2734
2735static inline void security_sk_free(struct sock *sk)
2736{
2737 return security_ops->sk_free_security(sk);
2738}
2739#else
2740static inline int security_unix_stream_connect(struct socket * sock,
2741 struct socket * other,
2742 struct sock * newsk)
2743{
2744 return 0;
2745}
2746
2747static inline int security_unix_may_send(struct socket * sock,
2748 struct socket * other)
2749{
2750 return 0;
2751}
2752
2753static inline int security_socket_create (int family, int type,
2754 int protocol, int kern)
2755{
2756 return 0;
2757}
2758
2759static inline void security_socket_post_create(struct socket * sock,
2760 int family,
2761 int type,
2762 int protocol, int kern)
2763{
2764}
2765
2766static inline int security_socket_bind(struct socket * sock,
2767 struct sockaddr * address,
2768 int addrlen)
2769{
2770 return 0;
2771}
2772
2773static inline int security_socket_connect(struct socket * sock,
2774 struct sockaddr * address,
2775 int addrlen)
2776{
2777 return 0;
2778}
2779
2780static inline int security_socket_listen(struct socket * sock, int backlog)
2781{
2782 return 0;
2783}
2784
2785static inline int security_socket_accept(struct socket * sock,
2786 struct socket * newsock)
2787{
2788 return 0;
2789}
2790
2791static inline void security_socket_post_accept(struct socket * sock,
2792 struct socket * newsock)
2793{
2794}
2795
2796static inline int security_socket_sendmsg(struct socket * sock,
2797 struct msghdr * msg, int size)
2798{
2799 return 0;
2800}
2801
2802static inline int security_socket_recvmsg(struct socket * sock,
2803 struct msghdr * msg, int size,
2804 int flags)
2805{
2806 return 0;
2807}
2808
2809static inline int security_socket_getsockname(struct socket * sock)
2810{
2811 return 0;
2812}
2813
2814static inline int security_socket_getpeername(struct socket * sock)
2815{
2816 return 0;
2817}
2818
2819static inline int security_socket_getsockopt(struct socket * sock,
2820 int level, int optname)
2821{
2822 return 0;
2823}
2824
2825static inline int security_socket_setsockopt(struct socket * sock,
2826 int level, int optname)
2827{
2828 return 0;
2829}
2830
2831static inline int security_socket_shutdown(struct socket * sock, int how)
2832{
2833 return 0;
2834}
2835static inline int security_sock_rcv_skb (struct sock * sk,
2836 struct sk_buff * skb)
2837{
2838 return 0;
2839}
2840
2841static inline int security_socket_getpeersec(struct socket *sock, char __user *optval,
2842 int __user *optlen, unsigned len)
2843{
2844 return -ENOPROTOOPT;
2845}
2846
2847static inline int security_sk_alloc(struct sock *sk, int family, int priority)
2848{
2849 return 0;
2850}
2851
2852static inline void security_sk_free(struct sock *sk)
2853{
2854}
2855#endif
2856
2857#endif
2858
2859