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/sysctl.h>
31#include <linux/shm.h>
32#include <linux/msg.h>
33#include <linux/sched.h>
34#include <linux/skbuff.h>
35#include <linux/netlink.h>
36
37
38
39
40
41extern int cap_capable (struct task_struct *tsk, int cap);
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
56static inline int cap_netlink_send (struct sock *sk, struct sk_buff *skb)
57{
58 NETLINK_CB (skb).eff_cap = current->cap_effective;
59 return 0;
60}
61
62static inline int cap_netlink_recv (struct sk_buff *skb)
63{
64 if (!cap_raised (NETLINK_CB (skb).eff_cap, CAP_NET_ADMIN))
65 return -EPERM;
66 return 0;
67}
68
69
70
71
72
73#define LSM_SETID_ID 1
74
75
76#define LSM_SETID_RE 2
77
78
79#define LSM_SETID_RES 4
80
81
82#define LSM_SETID_FS 8
83
84
85struct nfsctl_arg;
86struct sched_param;
87struct swap_info_struct;
88
89
90#define LSM_UNSAFE_SHARE 1
91#define LSM_UNSAFE_PTRACE 2
92#define LSM_UNSAFE_PTRACE_CAP 4
93
94#ifdef CONFIG_SECURITY
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
1018struct security_operations {
1019 int (*ptrace) (struct task_struct * parent, struct task_struct * child);
1020 int (*capget) (struct task_struct * target,
1021 kernel_cap_t * effective,
1022 kernel_cap_t * inheritable, kernel_cap_t * permitted);
1023 int (*capset_check) (struct task_struct * target,
1024 kernel_cap_t * effective,
1025 kernel_cap_t * inheritable,
1026 kernel_cap_t * permitted);
1027 void (*capset_set) (struct task_struct * target,
1028 kernel_cap_t * effective,
1029 kernel_cap_t * inheritable,
1030 kernel_cap_t * permitted);
1031 int (*acct) (struct file * file);
1032 int (*sysctl) (ctl_table * table, int op);
1033 int (*capable) (struct task_struct * tsk, int cap);
1034 int (*quotactl) (int cmds, int type, int id, struct super_block * sb);
1035 int (*quota_on) (struct file * f);
1036 int (*syslog) (int type);
1037 int (*vm_enough_memory) (long pages);
1038
1039 int (*bprm_alloc_security) (struct linux_binprm * bprm);
1040 void (*bprm_free_security) (struct linux_binprm * bprm);
1041 void (*bprm_apply_creds) (struct linux_binprm * bprm, int unsafe);
1042 int (*bprm_set_security) (struct linux_binprm * bprm);
1043 int (*bprm_check_security) (struct linux_binprm * bprm);
1044 int (*bprm_secureexec) (struct linux_binprm * bprm);
1045
1046 int (*sb_alloc_security) (struct super_block * sb);
1047 void (*sb_free_security) (struct super_block * sb);
1048 int (*sb_copy_data)(struct file_system_type *type,
1049 void *orig, void *copy);
1050 int (*sb_kern_mount) (struct super_block *sb, void *data);
1051 int (*sb_statfs) (struct super_block * sb);
1052 int (*sb_mount) (char *dev_name, struct nameidata * nd,
1053 char *type, unsigned long flags, void *data);
1054 int (*sb_check_sb) (struct vfsmount * mnt, struct nameidata * nd);
1055 int (*sb_umount) (struct vfsmount * mnt, int flags);
1056 void (*sb_umount_close) (struct vfsmount * mnt);
1057 void (*sb_umount_busy) (struct vfsmount * mnt);
1058 void (*sb_post_remount) (struct vfsmount * mnt,
1059 unsigned long flags, void *data);
1060 void (*sb_post_mountroot) (void);
1061 void (*sb_post_addmount) (struct vfsmount * mnt,
1062 struct nameidata * mountpoint_nd);
1063 int (*sb_pivotroot) (struct nameidata * old_nd,
1064 struct nameidata * new_nd);
1065 void (*sb_post_pivotroot) (struct nameidata * old_nd,
1066 struct nameidata * new_nd);
1067
1068 int (*inode_alloc_security) (struct inode *inode);
1069 void (*inode_free_security) (struct inode *inode);
1070 int (*inode_create) (struct inode *dir,
1071 struct dentry *dentry, int mode);
1072 void (*inode_post_create) (struct inode *dir,
1073 struct dentry *dentry, int mode);
1074 int (*inode_link) (struct dentry *old_dentry,
1075 struct inode *dir, struct dentry *new_dentry);
1076 void (*inode_post_link) (struct dentry *old_dentry,
1077 struct inode *dir, struct dentry *new_dentry);
1078 int (*inode_unlink) (struct inode *dir, struct dentry *dentry);
1079 int (*inode_symlink) (struct inode *dir,
1080 struct dentry *dentry, const char *old_name);
1081 void (*inode_post_symlink) (struct inode *dir,
1082 struct dentry *dentry,
1083 const char *old_name);
1084 int (*inode_mkdir) (struct inode *dir, struct dentry *dentry, int mode);
1085 void (*inode_post_mkdir) (struct inode *dir, struct dentry *dentry,
1086 int mode);
1087 int (*inode_rmdir) (struct inode *dir, struct dentry *dentry);
1088 int (*inode_mknod) (struct inode *dir, struct dentry *dentry,
1089 int mode, dev_t dev);
1090 void (*inode_post_mknod) (struct inode *dir, struct dentry *dentry,
1091 int mode, dev_t dev);
1092 int (*inode_rename) (struct inode *old_dir, struct dentry *old_dentry,
1093 struct inode *new_dir, struct dentry *new_dentry);
1094 void (*inode_post_rename) (struct inode *old_dir,
1095 struct dentry *old_dentry,
1096 struct inode *new_dir,
1097 struct dentry *new_dentry);
1098 int (*inode_readlink) (struct dentry *dentry);
1099 int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd);
1100 int (*inode_permission) (struct inode *inode, int mask, struct nameidata *nd);
1101 int (*inode_setattr) (struct dentry *dentry, struct iattr *attr);
1102 int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry);
1103 void (*inode_delete) (struct inode *inode);
1104 int (*inode_setxattr) (struct dentry *dentry, char *name, void *value,
1105 size_t size, int flags);
1106 void (*inode_post_setxattr) (struct dentry *dentry, char *name, void *value,
1107 size_t size, int flags);
1108 int (*inode_getxattr) (struct dentry *dentry, char *name);
1109 int (*inode_listxattr) (struct dentry *dentry);
1110 int (*inode_removexattr) (struct dentry *dentry, char *name);
1111 int (*inode_getsecurity)(struct dentry *dentry, const char *name, void *buffer, size_t size);
1112 int (*inode_setsecurity)(struct dentry *dentry, const char *name, const void *value, size_t size, int flags);
1113 int (*inode_listsecurity)(struct dentry *dentry, char *buffer);
1114
1115 int (*file_permission) (struct file * file, int mask);
1116 int (*file_alloc_security) (struct file * file);
1117 void (*file_free_security) (struct file * file);
1118 int (*file_ioctl) (struct file * file, unsigned int cmd,
1119 unsigned long arg);
1120 int (*file_mmap) (struct file * file,
1121 unsigned long prot, unsigned long flags);
1122 int (*file_mprotect) (struct vm_area_struct * vma, unsigned long prot);
1123 int (*file_lock) (struct file * file, unsigned int cmd);
1124 int (*file_fcntl) (struct file * file, unsigned int cmd,
1125 unsigned long arg);
1126 int (*file_set_fowner) (struct file * file);
1127 int (*file_send_sigiotask) (struct task_struct * tsk,
1128 struct fown_struct * fown,
1129 int fd, int reason);
1130 int (*file_receive) (struct file * file);
1131
1132 int (*task_create) (unsigned long clone_flags);
1133 int (*task_alloc_security) (struct task_struct * p);
1134 void (*task_free_security) (struct task_struct * p);
1135 int (*task_setuid) (uid_t id0, uid_t id1, uid_t id2, int flags);
1136 int (*task_post_setuid) (uid_t old_ruid ,
1137 uid_t old_euid, uid_t old_suid, int flags);
1138 int (*task_setgid) (gid_t id0, gid_t id1, gid_t id2, int flags);
1139 int (*task_setpgid) (struct task_struct * p, pid_t pgid);
1140 int (*task_getpgid) (struct task_struct * p);
1141 int (*task_getsid) (struct task_struct * p);
1142 int (*task_setgroups) (struct group_info *group_info);
1143 int (*task_setnice) (struct task_struct * p, int nice);
1144 int (*task_setrlimit) (unsigned int resource, struct rlimit * new_rlim);
1145 int (*task_setscheduler) (struct task_struct * p, int policy,
1146 struct sched_param * lp);
1147 int (*task_getscheduler) (struct task_struct * p);
1148 int (*task_kill) (struct task_struct * p,
1149 struct siginfo * info, int sig);
1150 int (*task_wait) (struct task_struct * p);
1151 int (*task_prctl) (int option, unsigned long arg2,
1152 unsigned long arg3, unsigned long arg4,
1153 unsigned long arg5);
1154 void (*task_reparent_to_init) (struct task_struct * p);
1155 void (*task_to_inode)(struct task_struct *p, struct inode *inode);
1156
1157 int (*ipc_permission) (struct kern_ipc_perm * ipcp, short flag);
1158
1159 int (*msg_msg_alloc_security) (struct msg_msg * msg);
1160 void (*msg_msg_free_security) (struct msg_msg * msg);
1161
1162 int (*msg_queue_alloc_security) (struct msg_queue * msq);
1163 void (*msg_queue_free_security) (struct msg_queue * msq);
1164 int (*msg_queue_associate) (struct msg_queue * msq, int msqflg);
1165 int (*msg_queue_msgctl) (struct msg_queue * msq, int cmd);
1166 int (*msg_queue_msgsnd) (struct msg_queue * msq,
1167 struct msg_msg * msg, int msqflg);
1168 int (*msg_queue_msgrcv) (struct msg_queue * msq,
1169 struct msg_msg * msg,
1170 struct task_struct * target,
1171 long type, int mode);
1172
1173 int (*shm_alloc_security) (struct shmid_kernel * shp);
1174 void (*shm_free_security) (struct shmid_kernel * shp);
1175 int (*shm_associate) (struct shmid_kernel * shp, int shmflg);
1176 int (*shm_shmctl) (struct shmid_kernel * shp, int cmd);
1177 int (*shm_shmat) (struct shmid_kernel * shp,
1178 char __user *shmaddr, int shmflg);
1179
1180 int (*sem_alloc_security) (struct sem_array * sma);
1181 void (*sem_free_security) (struct sem_array * sma);
1182 int (*sem_associate) (struct sem_array * sma, int semflg);
1183 int (*sem_semctl) (struct sem_array * sma, int cmd);
1184 int (*sem_semop) (struct sem_array * sma,
1185 struct sembuf * sops, unsigned nsops, int alter);
1186
1187 int (*netlink_send) (struct sock * sk, struct sk_buff * skb);
1188 int (*netlink_recv) (struct sk_buff * skb);
1189
1190
1191 int (*register_security) (const char *name,
1192 struct security_operations *ops);
1193 int (*unregister_security) (const char *name,
1194 struct security_operations *ops);
1195
1196 void (*d_instantiate) (struct dentry *dentry, struct inode *inode);
1197
1198 int (*getprocattr)(struct task_struct *p, char *name, void *value, size_t size);
1199 int (*setprocattr)(struct task_struct *p, char *name, void *value, size_t size);
1200
1201#ifdef CONFIG_SECURITY_NETWORK
1202 int (*unix_stream_connect) (struct socket * sock,
1203 struct socket * other, struct sock * newsk);
1204 int (*unix_may_send) (struct socket * sock, struct socket * other);
1205
1206 int (*socket_create) (int family, int type, int protocol, int kern);
1207 void (*socket_post_create) (struct socket * sock, int family,
1208 int type, int protocol, int kern);
1209 int (*socket_bind) (struct socket * sock,
1210 struct sockaddr * address, int addrlen);
1211 int (*socket_connect) (struct socket * sock,
1212 struct sockaddr * address, int addrlen);
1213 int (*socket_listen) (struct socket * sock, int backlog);
1214 int (*socket_accept) (struct socket * sock, struct socket * newsock);
1215 void (*socket_post_accept) (struct socket * sock,
1216 struct socket * newsock);
1217 int (*socket_sendmsg) (struct socket * sock,
1218 struct msghdr * msg, int size);
1219 int (*socket_recvmsg) (struct socket * sock,
1220 struct msghdr * msg, int size, int flags);
1221 int (*socket_getsockname) (struct socket * sock);
1222 int (*socket_getpeername) (struct socket * sock);
1223 int (*socket_getsockopt) (struct socket * sock, int level, int optname);
1224 int (*socket_setsockopt) (struct socket * sock, int level, int optname);
1225 int (*socket_shutdown) (struct socket * sock, int how);
1226 int (*socket_sock_rcv_skb) (struct sock * sk, struct sk_buff * skb);
1227 int (*socket_getpeersec) (struct socket *sock, char __user *optval, int __user *optlen, unsigned len);
1228 int (*sk_alloc_security) (struct sock *sk, int family, int priority);
1229 void (*sk_free_security) (struct sock *sk);
1230#endif
1231};
1232
1233
1234extern struct security_operations *security_ops;
1235
1236
1237static inline int security_ptrace (struct task_struct * parent, struct task_struct * child)
1238{
1239 return security_ops->ptrace (parent, child);
1240}
1241
1242static inline int security_capget (struct task_struct *target,
1243 kernel_cap_t *effective,
1244 kernel_cap_t *inheritable,
1245 kernel_cap_t *permitted)
1246{
1247 return security_ops->capget (target, effective, inheritable, permitted);
1248}
1249
1250static inline int security_capset_check (struct task_struct *target,
1251 kernel_cap_t *effective,
1252 kernel_cap_t *inheritable,
1253 kernel_cap_t *permitted)
1254{
1255 return security_ops->capset_check (target, effective, inheritable, permitted);
1256}
1257
1258static inline void security_capset_set (struct task_struct *target,
1259 kernel_cap_t *effective,
1260 kernel_cap_t *inheritable,
1261 kernel_cap_t *permitted)
1262{
1263 security_ops->capset_set (target, effective, inheritable, permitted);
1264}
1265
1266static inline int security_acct (struct file *file)
1267{
1268 return security_ops->acct (file);
1269}
1270
1271static inline int security_sysctl(ctl_table * table, int op)
1272{
1273 return security_ops->sysctl(table, op);
1274}
1275
1276static inline int security_quotactl (int cmds, int type, int id,
1277 struct super_block *sb)
1278{
1279 return security_ops->quotactl (cmds, type, id, sb);
1280}
1281
1282static inline int security_quota_on (struct file * file)
1283{
1284 return security_ops->quota_on (file);
1285}
1286
1287static inline int security_syslog(int type)
1288{
1289 return security_ops->syslog(type);
1290}
1291
1292static inline int security_vm_enough_memory(long pages)
1293{
1294 return security_ops->vm_enough_memory(pages);
1295}
1296
1297static inline int security_bprm_alloc (struct linux_binprm *bprm)
1298{
1299 return security_ops->bprm_alloc_security (bprm);
1300}
1301static inline void security_bprm_free (struct linux_binprm *bprm)
1302{
1303 security_ops->bprm_free_security (bprm);
1304}
1305static inline void security_bprm_apply_creds (struct linux_binprm *bprm, int unsafe)
1306{
1307 security_ops->bprm_apply_creds (bprm, unsafe);
1308}
1309static inline int security_bprm_set (struct linux_binprm *bprm)
1310{
1311 return security_ops->bprm_set_security (bprm);
1312}
1313
1314static inline int security_bprm_check (struct linux_binprm *bprm)
1315{
1316 return security_ops->bprm_check_security (bprm);
1317}
1318
1319static inline int security_bprm_secureexec (struct linux_binprm *bprm)
1320{
1321 return security_ops->bprm_secureexec (bprm);
1322}
1323
1324static inline int security_sb_alloc (struct super_block *sb)
1325{
1326 return security_ops->sb_alloc_security (sb);
1327}
1328
1329static inline void security_sb_free (struct super_block *sb)
1330{
1331 security_ops->sb_free_security (sb);
1332}
1333
1334static inline int security_sb_copy_data (struct file_system_type *type,
1335 void *orig, void *copy)
1336{
1337 return security_ops->sb_copy_data (type, orig, copy);
1338}
1339
1340static inline int security_sb_kern_mount (struct super_block *sb, void *data)
1341{
1342 return security_ops->sb_kern_mount (sb, data);
1343}
1344
1345static inline int security_sb_statfs (struct super_block *sb)
1346{
1347 return security_ops->sb_statfs (sb);
1348}
1349
1350static inline int security_sb_mount (char *dev_name, struct nameidata *nd,
1351 char *type, unsigned long flags,
1352 void *data)
1353{
1354 return security_ops->sb_mount (dev_name, nd, type, flags, data);
1355}
1356
1357static inline int security_sb_check_sb (struct vfsmount *mnt,
1358 struct nameidata *nd)
1359{
1360 return security_ops->sb_check_sb (mnt, nd);
1361}
1362
1363static inline int security_sb_umount (struct vfsmount *mnt, int flags)
1364{
1365 return security_ops->sb_umount (mnt, flags);
1366}
1367
1368static inline void security_sb_umount_close (struct vfsmount *mnt)
1369{
1370 security_ops->sb_umount_close (mnt);
1371}
1372
1373static inline void security_sb_umount_busy (struct vfsmount *mnt)
1374{
1375 security_ops->sb_umount_busy (mnt);
1376}
1377
1378static inline void security_sb_post_remount (struct vfsmount *mnt,
1379 unsigned long flags, void *data)
1380{
1381 security_ops->sb_post_remount (mnt, flags, data);
1382}
1383
1384static inline void security_sb_post_mountroot (void)
1385{
1386 security_ops->sb_post_mountroot ();
1387}
1388
1389static inline void security_sb_post_addmount (struct vfsmount *mnt,
1390 struct nameidata *mountpoint_nd)
1391{
1392 security_ops->sb_post_addmount (mnt, mountpoint_nd);
1393}
1394
1395static inline int security_sb_pivotroot (struct nameidata *old_nd,
1396 struct nameidata *new_nd)
1397{
1398 return security_ops->sb_pivotroot (old_nd, new_nd);
1399}
1400
1401static inline void security_sb_post_pivotroot (struct nameidata *old_nd,
1402 struct nameidata *new_nd)
1403{
1404 security_ops->sb_post_pivotroot (old_nd, new_nd);
1405}
1406
1407static inline int security_inode_alloc (struct inode *inode)
1408{
1409 return security_ops->inode_alloc_security (inode);
1410}
1411
1412static inline void security_inode_free (struct inode *inode)
1413{
1414 security_ops->inode_free_security (inode);
1415}
1416
1417static inline int security_inode_create (struct inode *dir,
1418 struct dentry *dentry,
1419 int mode)
1420{
1421 return security_ops->inode_create (dir, dentry, mode);
1422}
1423
1424static inline void security_inode_post_create (struct inode *dir,
1425 struct dentry *dentry,
1426 int mode)
1427{
1428 security_ops->inode_post_create (dir, dentry, mode);
1429}
1430
1431static inline int security_inode_link (struct dentry *old_dentry,
1432 struct inode *dir,
1433 struct dentry *new_dentry)
1434{
1435 return security_ops->inode_link (old_dentry, dir, new_dentry);
1436}
1437
1438static inline void security_inode_post_link (struct dentry *old_dentry,
1439 struct inode *dir,
1440 struct dentry *new_dentry)
1441{
1442 security_ops->inode_post_link (old_dentry, dir, new_dentry);
1443}
1444
1445static inline int security_inode_unlink (struct inode *dir,
1446 struct dentry *dentry)
1447{
1448 return security_ops->inode_unlink (dir, dentry);
1449}
1450
1451static inline int security_inode_symlink (struct inode *dir,
1452 struct dentry *dentry,
1453 const char *old_name)
1454{
1455 return security_ops->inode_symlink (dir, dentry, old_name);
1456}
1457
1458static inline void security_inode_post_symlink (struct inode *dir,
1459 struct dentry *dentry,
1460 const char *old_name)
1461{
1462 security_ops->inode_post_symlink (dir, dentry, old_name);
1463}
1464
1465static inline int security_inode_mkdir (struct inode *dir,
1466 struct dentry *dentry,
1467 int mode)
1468{
1469 return security_ops->inode_mkdir (dir, dentry, mode);
1470}
1471
1472static inline void security_inode_post_mkdir (struct inode *dir,
1473 struct dentry *dentry,
1474 int mode)
1475{
1476 security_ops->inode_post_mkdir (dir, dentry, mode);
1477}
1478
1479static inline int security_inode_rmdir (struct inode *dir,
1480 struct dentry *dentry)
1481{
1482 return security_ops->inode_rmdir (dir, dentry);
1483}
1484
1485static inline int security_inode_mknod (struct inode *dir,
1486 struct dentry *dentry,
1487 int mode, dev_t dev)
1488{
1489 return security_ops->inode_mknod (dir, dentry, mode, dev);
1490}
1491
1492static inline void security_inode_post_mknod (struct inode *dir,
1493 struct dentry *dentry,
1494 int mode, dev_t dev)
1495{
1496 security_ops->inode_post_mknod (dir, dentry, mode, dev);
1497}
1498
1499static inline int security_inode_rename (struct inode *old_dir,
1500 struct dentry *old_dentry,
1501 struct inode *new_dir,
1502 struct dentry *new_dentry)
1503{
1504 return security_ops->inode_rename (old_dir, old_dentry,
1505 new_dir, new_dentry);
1506}
1507
1508static inline void security_inode_post_rename (struct inode *old_dir,
1509 struct dentry *old_dentry,
1510 struct inode *new_dir,
1511 struct dentry *new_dentry)
1512{
1513 security_ops->inode_post_rename (old_dir, old_dentry,
1514 new_dir, new_dentry);
1515}
1516
1517static inline int security_inode_readlink (struct dentry *dentry)
1518{
1519 return security_ops->inode_readlink (dentry);
1520}
1521
1522static inline int security_inode_follow_link (struct dentry *dentry,
1523 struct nameidata *nd)
1524{
1525 return security_ops->inode_follow_link (dentry, nd);
1526}
1527
1528static inline int security_inode_permission (struct inode *inode, int mask,
1529 struct nameidata *nd)
1530{
1531 return security_ops->inode_permission (inode, mask, nd);
1532}
1533
1534static inline int security_inode_setattr (struct dentry *dentry,
1535 struct iattr *attr)
1536{
1537 return security_ops->inode_setattr (dentry, attr);
1538}
1539
1540static inline int security_inode_getattr (struct vfsmount *mnt,
1541 struct dentry *dentry)
1542{
1543 return security_ops->inode_getattr (mnt, dentry);
1544}
1545
1546static inline void security_inode_delete (struct inode *inode)
1547{
1548 security_ops->inode_delete (inode);
1549}
1550
1551static inline int security_inode_setxattr (struct dentry *dentry, char *name,
1552 void *value, size_t size, int flags)
1553{
1554 return security_ops->inode_setxattr (dentry, name, value, size, flags);
1555}
1556
1557static inline void security_inode_post_setxattr (struct dentry *dentry, char *name,
1558 void *value, size_t size, int flags)
1559{
1560 security_ops->inode_post_setxattr (dentry, name, value, size, flags);
1561}
1562
1563static inline int security_inode_getxattr (struct dentry *dentry, char *name)
1564{
1565 return security_ops->inode_getxattr (dentry, name);
1566}
1567
1568static inline int security_inode_listxattr (struct dentry *dentry)
1569{
1570 return security_ops->inode_listxattr (dentry);
1571}
1572
1573static inline int security_inode_removexattr (struct dentry *dentry, char *name)
1574{
1575 return security_ops->inode_removexattr (dentry, name);
1576}
1577
1578static inline int security_inode_getsecurity(struct dentry *dentry, const char *name, void *buffer, size_t size)
1579{
1580 return security_ops->inode_getsecurity(dentry, name, buffer, size);
1581}
1582
1583static inline int security_inode_setsecurity(struct dentry *dentry, const char *name, const void *value, size_t size, int flags)
1584{
1585 return security_ops->inode_setsecurity(dentry, name, value, size, flags);
1586}
1587
1588static inline int security_inode_listsecurity(struct dentry *dentry, char *buffer)
1589{
1590 return security_ops->inode_listsecurity(dentry, buffer);
1591}
1592
1593static inline int security_file_permission (struct file *file, int mask)
1594{
1595 return security_ops->file_permission (file, mask);
1596}
1597
1598static inline int security_file_alloc (struct file *file)
1599{
1600 return security_ops->file_alloc_security (file);
1601}
1602
1603static inline void security_file_free (struct file *file)
1604{
1605 security_ops->file_free_security (file);
1606}
1607
1608static inline int security_file_ioctl (struct file *file, unsigned int cmd,
1609 unsigned long arg)
1610{
1611 return security_ops->file_ioctl (file, cmd, arg);
1612}
1613
1614static inline int security_file_mmap (struct file *file, unsigned long prot,
1615 unsigned long flags)
1616{
1617 return security_ops->file_mmap (file, prot, flags);
1618}
1619
1620static inline int security_file_mprotect (struct vm_area_struct *vma,
1621 unsigned long prot)
1622{
1623 return security_ops->file_mprotect (vma, prot);
1624}
1625
1626static inline int security_file_lock (struct file *file, unsigned int cmd)
1627{
1628 return security_ops->file_lock (file, cmd);
1629}
1630
1631static inline int security_file_fcntl (struct file *file, unsigned int cmd,
1632 unsigned long arg)
1633{
1634 return security_ops->file_fcntl (file, cmd, arg);
1635}
1636
1637static inline int security_file_set_fowner (struct file *file)
1638{
1639 return security_ops->file_set_fowner (file);
1640}
1641
1642static inline int security_file_send_sigiotask (struct task_struct *tsk,
1643 struct fown_struct *fown,
1644 int fd, int reason)
1645{
1646 return security_ops->file_send_sigiotask (tsk, fown, fd, reason);
1647}
1648
1649static inline int security_file_receive (struct file *file)
1650{
1651 return security_ops->file_receive (file);
1652}
1653
1654static inline int security_task_create (unsigned long clone_flags)
1655{
1656 return security_ops->task_create (clone_flags);
1657}
1658
1659static inline int security_task_alloc (struct task_struct *p)
1660{
1661 return security_ops->task_alloc_security (p);
1662}
1663
1664static inline void security_task_free (struct task_struct *p)
1665{
1666 security_ops->task_free_security (p);
1667}
1668
1669static inline int security_task_setuid (uid_t id0, uid_t id1, uid_t id2,
1670 int flags)
1671{
1672 return security_ops->task_setuid (id0, id1, id2, flags);
1673}
1674
1675static inline int security_task_post_setuid (uid_t old_ruid, uid_t old_euid,
1676 uid_t old_suid, int flags)
1677{
1678 return security_ops->task_post_setuid (old_ruid, old_euid, old_suid, flags);
1679}
1680
1681static inline int security_task_setgid (gid_t id0, gid_t id1, gid_t id2,
1682 int flags)
1683{
1684 return security_ops->task_setgid (id0, id1, id2, flags);
1685}
1686
1687static inline int security_task_setpgid (struct task_struct *p, pid_t pgid)
1688{
1689 return security_ops->task_setpgid (p, pgid);
1690}
1691
1692static inline int security_task_getpgid (struct task_struct *p)
1693{
1694 return security_ops->task_getpgid (p);
1695}
1696
1697static inline int security_task_getsid (struct task_struct *p)
1698{
1699 return security_ops->task_getsid (p);
1700}
1701
1702static inline int security_task_setgroups (struct group_info *group_info)
1703{
1704 return security_ops->task_setgroups (group_info);
1705}
1706
1707static inline int security_task_setnice (struct task_struct *p, int nice)
1708{
1709 return security_ops->task_setnice (p, nice);
1710}
1711
1712static inline int security_task_setrlimit (unsigned int resource,
1713 struct rlimit *new_rlim)
1714{
1715 return security_ops->task_setrlimit (resource, new_rlim);
1716}
1717
1718static inline int security_task_setscheduler (struct task_struct *p,
1719 int policy,
1720 struct sched_param *lp)
1721{
1722 return security_ops->task_setscheduler (p, policy, lp);
1723}
1724
1725static inline int security_task_getscheduler (struct task_struct *p)
1726{
1727 return security_ops->task_getscheduler (p);
1728}
1729
1730static inline int security_task_kill (struct task_struct *p,
1731 struct siginfo *info, int sig)
1732{
1733 return security_ops->task_kill (p, info, sig);
1734}
1735
1736static inline int security_task_wait (struct task_struct *p)
1737{
1738 return security_ops->task_wait (p);
1739}
1740
1741static inline int security_task_prctl (int option, unsigned long arg2,
1742 unsigned long arg3,
1743 unsigned long arg4,
1744 unsigned long arg5)
1745{
1746 return security_ops->task_prctl (option, arg2, arg3, arg4, arg5);
1747}
1748
1749static inline void security_task_reparent_to_init (struct task_struct *p)
1750{
1751 security_ops->task_reparent_to_init (p);
1752}
1753
1754static inline void security_task_to_inode(struct task_struct *p, struct inode *inode)
1755{
1756 security_ops->task_to_inode(p, inode);
1757}
1758
1759static inline int security_ipc_permission (struct kern_ipc_perm *ipcp,
1760 short flag)
1761{
1762 return security_ops->ipc_permission (ipcp, flag);
1763}
1764
1765static inline int security_msg_msg_alloc (struct msg_msg * msg)
1766{
1767 return security_ops->msg_msg_alloc_security (msg);
1768}
1769
1770static inline void security_msg_msg_free (struct msg_msg * msg)
1771{
1772 security_ops->msg_msg_free_security(msg);
1773}
1774
1775static inline int security_msg_queue_alloc (struct msg_queue *msq)
1776{
1777 return security_ops->msg_queue_alloc_security (msq);
1778}
1779
1780static inline void security_msg_queue_free (struct msg_queue *msq)
1781{
1782 security_ops->msg_queue_free_security (msq);
1783}
1784
1785static inline int security_msg_queue_associate (struct msg_queue * msq,
1786 int msqflg)
1787{
1788 return security_ops->msg_queue_associate (msq, msqflg);
1789}
1790
1791static inline int security_msg_queue_msgctl (struct msg_queue * msq, int cmd)
1792{
1793 return security_ops->msg_queue_msgctl (msq, cmd);
1794}
1795
1796static inline int security_msg_queue_msgsnd (struct msg_queue * msq,
1797 struct msg_msg * msg, int msqflg)
1798{
1799 return security_ops->msg_queue_msgsnd (msq, msg, msqflg);
1800}
1801
1802static inline int security_msg_queue_msgrcv (struct msg_queue * msq,
1803 struct msg_msg * msg,
1804 struct task_struct * target,
1805 long type, int mode)
1806{
1807 return security_ops->msg_queue_msgrcv (msq, msg, target, type, mode);
1808}
1809
1810static inline int security_shm_alloc (struct shmid_kernel *shp)
1811{
1812 return security_ops->shm_alloc_security (shp);
1813}
1814
1815static inline void security_shm_free (struct shmid_kernel *shp)
1816{
1817 security_ops->shm_free_security (shp);
1818}
1819
1820static inline int security_shm_associate (struct shmid_kernel * shp,
1821 int shmflg)
1822{
1823 return security_ops->shm_associate(shp, shmflg);
1824}
1825
1826static inline int security_shm_shmctl (struct shmid_kernel * shp, int cmd)
1827{
1828 return security_ops->shm_shmctl (shp, cmd);
1829}
1830
1831static inline int security_shm_shmat (struct shmid_kernel * shp,
1832 char __user *shmaddr, int shmflg)
1833{
1834 return security_ops->shm_shmat(shp, shmaddr, shmflg);
1835}
1836
1837static inline int security_sem_alloc (struct sem_array *sma)
1838{
1839 return security_ops->sem_alloc_security (sma);
1840}
1841
1842static inline void security_sem_free (struct sem_array *sma)
1843{
1844 security_ops->sem_free_security (sma);
1845}
1846
1847static inline int security_sem_associate (struct sem_array * sma, int semflg)
1848{
1849 return security_ops->sem_associate (sma, semflg);
1850}
1851
1852static inline int security_sem_semctl (struct sem_array * sma, int cmd)
1853{
1854 return security_ops->sem_semctl(sma, cmd);
1855}
1856
1857static inline int security_sem_semop (struct sem_array * sma,
1858 struct sembuf * sops, unsigned nsops,
1859 int alter)
1860{
1861 return security_ops->sem_semop(sma, sops, nsops, alter);
1862}
1863
1864static inline void security_d_instantiate (struct dentry *dentry, struct inode *inode)
1865{
1866 security_ops->d_instantiate (dentry, inode);
1867}
1868
1869static inline int security_getprocattr(struct task_struct *p, char *name, void *value, size_t size)
1870{
1871 return security_ops->getprocattr(p, name, value, size);
1872}
1873
1874static inline int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size)
1875{
1876 return security_ops->setprocattr(p, name, value, size);
1877}
1878
1879static inline int security_netlink_send(struct sock *sk, struct sk_buff * skb)
1880{
1881 return security_ops->netlink_send(sk, skb);
1882}
1883
1884static inline int security_netlink_recv(struct sk_buff * skb)
1885{
1886 return security_ops->netlink_recv(skb);
1887}
1888
1889
1890extern int security_scaffolding_startup (void);
1891extern int register_security (struct security_operations *ops);
1892extern int unregister_security (struct security_operations *ops);
1893extern int mod_reg_security (const char *name, struct security_operations *ops);
1894extern int mod_unreg_security (const char *name, struct security_operations *ops);
1895
1896
1897#else
1898
1899
1900
1901
1902
1903
1904static inline int security_scaffolding_startup (void)
1905{
1906 return 0;
1907}
1908
1909static inline int security_ptrace (struct task_struct *parent, struct task_struct * child)
1910{
1911 return cap_ptrace (parent, child);
1912}
1913
1914static inline int security_capget (struct task_struct *target,
1915 kernel_cap_t *effective,
1916 kernel_cap_t *inheritable,
1917 kernel_cap_t *permitted)
1918{
1919 return cap_capget (target, effective, inheritable, permitted);
1920}
1921
1922static inline int security_capset_check (struct task_struct *target,
1923 kernel_cap_t *effective,
1924 kernel_cap_t *inheritable,
1925 kernel_cap_t *permitted)
1926{
1927 return cap_capset_check (target, effective, inheritable, permitted);
1928}
1929
1930static inline void security_capset_set (struct task_struct *target,
1931 kernel_cap_t *effective,
1932 kernel_cap_t *inheritable,
1933 kernel_cap_t *permitted)
1934{
1935 cap_capset_set (target, effective, inheritable, permitted);
1936}
1937
1938static inline int security_acct (struct file *file)
1939{
1940 return 0;
1941}
1942
1943static inline int security_sysctl(ctl_table * table, int op)
1944{
1945 return 0;
1946}
1947
1948static inline int security_quotactl (int cmds, int type, int id,
1949 struct super_block * sb)
1950{
1951 return 0;
1952}
1953
1954static inline int security_quota_on (struct file * file)
1955{
1956 return 0;
1957}
1958
1959static inline int security_syslog(int type)
1960{
1961 return cap_syslog(type);
1962}
1963
1964static inline int security_vm_enough_memory(long pages)
1965{
1966 return cap_vm_enough_memory(pages);
1967}
1968
1969static inline int security_bprm_alloc (struct linux_binprm *bprm)
1970{
1971 return 0;
1972}
1973
1974static inline void security_bprm_free (struct linux_binprm *bprm)
1975{ }
1976
1977static inline void security_bprm_apply_creds (struct linux_binprm *bprm, int unsafe)
1978{
1979 cap_bprm_apply_creds (bprm, unsafe);
1980}
1981
1982static inline int security_bprm_set (struct linux_binprm *bprm)
1983{
1984 return cap_bprm_set_security (bprm);
1985}
1986
1987static inline int security_bprm_check (struct linux_binprm *bprm)
1988{
1989 return 0;
1990}
1991
1992static inline int security_bprm_secureexec (struct linux_binprm *bprm)
1993{
1994 return cap_bprm_secureexec(bprm);
1995}
1996
1997static inline int security_sb_alloc (struct super_block *sb)
1998{
1999 return 0;
2000}
2001
2002static inline void security_sb_free (struct super_block *sb)
2003{ }
2004
2005static inline int security_sb_copy_data (struct file_system_type *type,
2006 void *orig, void *copy)
2007{
2008 return 0;
2009}
2010
2011static inline int security_sb_kern_mount (struct super_block *sb, void *data)
2012{
2013 return 0;
2014}
2015
2016static inline int security_sb_statfs (struct super_block *sb)
2017{
2018 return 0;
2019}
2020
2021static inline int security_sb_mount (char *dev_name, struct nameidata *nd,
2022 char *type, unsigned long flags,
2023 void *data)
2024{
2025 return 0;
2026}
2027
2028static inline int security_sb_check_sb (struct vfsmount *mnt,
2029 struct nameidata *nd)
2030{
2031 return 0;
2032}
2033
2034static inline int security_sb_umount (struct vfsmount *mnt, int flags)
2035{
2036 return 0;
2037}
2038
2039static inline void security_sb_umount_close (struct vfsmount *mnt)
2040{ }
2041
2042static inline void security_sb_umount_busy (struct vfsmount *mnt)
2043{ }
2044
2045static inline void security_sb_post_remount (struct vfsmount *mnt,
2046 unsigned long flags, void *data)
2047{ }
2048
2049static inline void security_sb_post_mountroot (void)
2050{ }
2051
2052static inline void security_sb_post_addmount (struct vfsmount *mnt,
2053 struct nameidata *mountpoint_nd)
2054{ }
2055
2056static inline int security_sb_pivotroot (struct nameidata *old_nd,
2057 struct nameidata *new_nd)
2058{
2059 return 0;
2060}
2061
2062static inline void security_sb_post_pivotroot (struct nameidata *old_nd,
2063 struct nameidata *new_nd)
2064{ }
2065
2066static inline int security_inode_alloc (struct inode *inode)
2067{
2068 return 0;
2069}
2070
2071static inline void security_inode_free (struct inode *inode)
2072{ }
2073
2074static inline int security_inode_create (struct inode *dir,
2075 struct dentry *dentry,
2076 int mode)
2077{
2078 return 0;
2079}
2080
2081static inline void security_inode_post_create (struct inode *dir,
2082 struct dentry *dentry,
2083 int mode)
2084{ }
2085
2086static inline int security_inode_link (struct dentry *old_dentry,
2087 struct inode *dir,
2088 struct dentry *new_dentry)
2089{
2090 return 0;
2091}
2092
2093static inline void security_inode_post_link (struct dentry *old_dentry,
2094 struct inode *dir,
2095 struct dentry *new_dentry)
2096{ }
2097
2098static inline int security_inode_unlink (struct inode *dir,
2099 struct dentry *dentry)
2100{
2101 return 0;
2102}
2103
2104static inline int security_inode_symlink (struct inode *dir,
2105 struct dentry *dentry,
2106 const char *old_name)
2107{
2108 return 0;
2109}
2110
2111static inline void security_inode_post_symlink (struct inode *dir,
2112 struct dentry *dentry,
2113 const char *old_name)
2114{ }
2115
2116static inline int security_inode_mkdir (struct inode *dir,
2117 struct dentry *dentry,
2118 int mode)
2119{
2120 return 0;
2121}
2122
2123static inline void security_inode_post_mkdir (struct inode *dir,
2124 struct dentry *dentry,
2125 int mode)
2126{ }
2127
2128static inline int security_inode_rmdir (struct inode *dir,
2129 struct dentry *dentry)
2130{
2131 return 0;
2132}
2133
2134static inline int security_inode_mknod (struct inode *dir,
2135 struct dentry *dentry,
2136 int mode, dev_t dev)
2137{
2138 return 0;
2139}
2140
2141static inline void security_inode_post_mknod (struct inode *dir,
2142 struct dentry *dentry,
2143 int mode, dev_t dev)
2144{ }
2145
2146static inline int security_inode_rename (struct inode *old_dir,
2147 struct dentry *old_dentry,
2148 struct inode *new_dir,
2149 struct dentry *new_dentry)
2150{
2151 return 0;
2152}
2153
2154static inline void security_inode_post_rename (struct inode *old_dir,
2155 struct dentry *old_dentry,
2156 struct inode *new_dir,
2157 struct dentry *new_dentry)
2158{ }
2159
2160static inline int security_inode_readlink (struct dentry *dentry)
2161{
2162 return 0;
2163}
2164
2165static inline int security_inode_follow_link (struct dentry *dentry,
2166 struct nameidata *nd)
2167{
2168 return 0;
2169}
2170
2171static inline int security_inode_permission (struct inode *inode, int mask,
2172 struct nameidata *nd)
2173{
2174 return 0;
2175}
2176
2177static inline int security_inode_setattr (struct dentry *dentry,
2178 struct iattr *attr)
2179{
2180 return 0;
2181}
2182
2183static inline int security_inode_getattr (struct vfsmount *mnt,
2184 struct dentry *dentry)
2185{
2186 return 0;
2187}
2188
2189static inline void security_inode_delete (struct inode *inode)
2190{ }
2191
2192static inline int security_inode_setxattr (struct dentry *dentry, char *name,
2193 void *value, size_t size, int flags)
2194{
2195 return cap_inode_setxattr(dentry, name, value, size, flags);
2196}
2197
2198static inline void security_inode_post_setxattr (struct dentry *dentry, char *name,
2199 void *value, size_t size, int flags)
2200{ }
2201
2202static inline int security_inode_getxattr (struct dentry *dentry, char *name)
2203{
2204 return 0;
2205}
2206
2207static inline int security_inode_listxattr (struct dentry *dentry)
2208{
2209 return 0;
2210}
2211
2212static inline int security_inode_removexattr (struct dentry *dentry, char *name)
2213{
2214 return cap_inode_removexattr(dentry, name);
2215}
2216
2217static inline int security_inode_getsecurity(struct dentry *dentry, const char *name, void *buffer, size_t size)
2218{
2219 return -EOPNOTSUPP;
2220}
2221
2222static inline int security_inode_setsecurity(struct dentry *dentry, const char *name, const void *value, size_t size, int flags)
2223{
2224 return -EOPNOTSUPP;
2225}
2226
2227static inline int security_inode_listsecurity(struct dentry *dentry, char *buffer)
2228{
2229 return 0;
2230}
2231
2232static inline int security_file_permission (struct file *file, int mask)
2233{
2234 return 0;
2235}
2236
2237static inline int security_file_alloc (struct file *file)
2238{
2239 return 0;
2240}
2241
2242static inline void security_file_free (struct file *file)
2243{ }
2244
2245static inline int security_file_ioctl (struct file *file, unsigned int cmd,
2246 unsigned long arg)
2247{
2248 return 0;
2249}
2250
2251static inline int security_file_mmap (struct file *file, unsigned long prot,
2252 unsigned long flags)
2253{
2254 return 0;
2255}
2256
2257static inline int security_file_mprotect (struct vm_area_struct *vma,
2258 unsigned long prot)
2259{
2260 return 0;
2261}
2262
2263static inline int security_file_lock (struct file *file, unsigned int cmd)
2264{
2265 return 0;
2266}
2267
2268static inline int security_file_fcntl (struct file *file, unsigned int cmd,
2269 unsigned long arg)
2270{
2271 return 0;
2272}
2273
2274static inline int security_file_set_fowner (struct file *file)
2275{
2276 return 0;
2277}
2278
2279static inline int security_file_send_sigiotask (struct task_struct *tsk,
2280 struct fown_struct *fown,
2281 int fd, int reason)
2282{
2283 return 0;
2284}
2285
2286static inline int security_file_receive (struct file *file)
2287{
2288 return 0;
2289}
2290
2291static inline int security_task_create (unsigned long clone_flags)
2292{
2293 return 0;
2294}
2295
2296static inline int security_task_alloc (struct task_struct *p)
2297{
2298 return 0;
2299}
2300
2301static inline void security_task_free (struct task_struct *p)
2302{ }
2303
2304static inline int security_task_setuid (uid_t id0, uid_t id1, uid_t id2,
2305 int flags)
2306{
2307 return 0;
2308}
2309
2310static inline int security_task_post_setuid (uid_t old_ruid, uid_t old_euid,
2311 uid_t old_suid, int flags)
2312{
2313 return cap_task_post_setuid (old_ruid, old_euid, old_suid, flags);
2314}
2315
2316static inline int security_task_setgid (gid_t id0, gid_t id1, gid_t id2,
2317 int flags)
2318{
2319 return 0;
2320}
2321
2322static inline int security_task_setpgid (struct task_struct *p, pid_t pgid)
2323{
2324 return 0;
2325}
2326
2327static inline int security_task_getpgid (struct task_struct *p)
2328{
2329 return 0;
2330}
2331
2332static inline int security_task_getsid (struct task_struct *p)
2333{
2334 return 0;
2335}
2336
2337static inline int security_task_setgroups (struct group_info *group_info)
2338{
2339 return 0;
2340}
2341
2342static inline int security_task_setnice (struct task_struct *p, int nice)
2343{
2344 return 0;
2345}
2346
2347static inline int security_task_setrlimit (unsigned int resource,
2348 struct rlimit *new_rlim)
2349{
2350 return 0;
2351}
2352
2353static inline int security_task_setscheduler (struct task_struct *p,
2354 int policy,
2355 struct sched_param *lp)
2356{
2357 return 0;
2358}
2359
2360static inline int security_task_getscheduler (struct task_struct *p)
2361{
2362 return 0;
2363}
2364
2365static inline int security_task_kill (struct task_struct *p,
2366 struct siginfo *info, int sig)
2367{
2368 return 0;
2369}
2370
2371static inline int security_task_wait (struct task_struct *p)
2372{
2373 return 0;
2374}
2375
2376static inline int security_task_prctl (int option, unsigned long arg2,
2377 unsigned long arg3,
2378 unsigned long arg4,
2379 unsigned long arg5)
2380{
2381 return 0;
2382}
2383
2384static inline void security_task_reparent_to_init (struct task_struct *p)
2385{
2386 cap_task_reparent_to_init (p);
2387}
2388
2389static inline void security_task_to_inode(struct task_struct *p, struct inode *inode)
2390{ }
2391
2392static inline int security_ipc_permission (struct kern_ipc_perm *ipcp,
2393 short flag)
2394{
2395 return 0;
2396}
2397
2398static inline int security_msg_msg_alloc (struct msg_msg * msg)
2399{
2400 return 0;
2401}
2402
2403static inline void security_msg_msg_free (struct msg_msg * msg)
2404{ }
2405
2406static inline int security_msg_queue_alloc (struct msg_queue *msq)
2407{
2408 return 0;
2409}
2410
2411static inline void security_msg_queue_free (struct msg_queue *msq)
2412{ }
2413
2414static inline int security_msg_queue_associate (struct msg_queue * msq,
2415 int msqflg)
2416{
2417 return 0;
2418}
2419
2420static inline int security_msg_queue_msgctl (struct msg_queue * msq, int cmd)
2421{
2422 return 0;
2423}
2424
2425static inline int security_msg_queue_msgsnd (struct msg_queue * msq,
2426 struct msg_msg * msg, int msqflg)
2427{
2428 return 0;
2429}
2430
2431static inline int security_msg_queue_msgrcv (struct msg_queue * msq,
2432 struct msg_msg * msg,
2433 struct task_struct * target,
2434 long type, int mode)
2435{
2436 return 0;
2437}
2438
2439static inline int security_shm_alloc (struct shmid_kernel *shp)
2440{
2441 return 0;
2442}
2443
2444static inline void security_shm_free (struct shmid_kernel *shp)
2445{ }
2446
2447static inline int security_shm_associate (struct shmid_kernel * shp,
2448 int shmflg)
2449{
2450 return 0;
2451}
2452
2453static inline int security_shm_shmctl (struct shmid_kernel * shp, int cmd)
2454{
2455 return 0;
2456}
2457
2458static inline int security_shm_shmat (struct shmid_kernel * shp,
2459 char __user *shmaddr, int shmflg)
2460{
2461 return 0;
2462}
2463
2464static inline int security_sem_alloc (struct sem_array *sma)
2465{
2466 return 0;
2467}
2468
2469static inline void security_sem_free (struct sem_array *sma)
2470{ }
2471
2472static inline int security_sem_associate (struct sem_array * sma, int semflg)
2473{
2474 return 0;
2475}
2476
2477static inline int security_sem_semctl (struct sem_array * sma, int cmd)
2478{
2479 return 0;
2480}
2481
2482static inline int security_sem_semop (struct sem_array * sma,
2483 struct sembuf * sops, unsigned nsops,
2484 int alter)
2485{
2486 return 0;
2487}
2488
2489static inline void security_d_instantiate (struct dentry *dentry, struct inode *inode)
2490{ }
2491
2492static inline int security_getprocattr(struct task_struct *p, char *name, void *value, size_t size)
2493{
2494 return -EINVAL;
2495}
2496
2497static inline int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size)
2498{
2499 return -EINVAL;
2500}
2501
2502
2503
2504
2505
2506
2507static inline int security_netlink_send (struct sock *sk, struct sk_buff *skb)
2508{
2509 return cap_netlink_send (sk, skb);
2510}
2511
2512static inline int security_netlink_recv (struct sk_buff *skb)
2513{
2514 return cap_netlink_recv (skb);
2515}
2516
2517#endif
2518
2519#ifdef CONFIG_SECURITY_NETWORK
2520static inline int security_unix_stream_connect(struct socket * sock,
2521 struct socket * other,
2522 struct sock * newsk)
2523{
2524 return security_ops->unix_stream_connect(sock, other, newsk);
2525}
2526
2527
2528static inline int security_unix_may_send(struct socket * sock,
2529 struct socket * other)
2530{
2531 return security_ops->unix_may_send(sock, other);
2532}
2533
2534static inline int security_socket_create (int family, int type,
2535 int protocol, int kern)
2536{
2537 return security_ops->socket_create(family, type, protocol, kern);
2538}
2539
2540static inline void security_socket_post_create(struct socket * sock,
2541 int family,
2542 int type,
2543 int protocol, int kern)
2544{
2545 security_ops->socket_post_create(sock, family, type,
2546 protocol, kern);
2547}
2548
2549static inline int security_socket_bind(struct socket * sock,
2550 struct sockaddr * address,
2551 int addrlen)
2552{
2553 return security_ops->socket_bind(sock, address, addrlen);
2554}
2555
2556static inline int security_socket_connect(struct socket * sock,
2557 struct sockaddr * address,
2558 int addrlen)
2559{
2560 return security_ops->socket_connect(sock, address, addrlen);
2561}
2562
2563static inline int security_socket_listen(struct socket * sock, int backlog)
2564{
2565 return security_ops->socket_listen(sock, backlog);
2566}
2567
2568static inline int security_socket_accept(struct socket * sock,
2569 struct socket * newsock)
2570{
2571 return security_ops->socket_accept(sock, newsock);
2572}
2573
2574static inline void security_socket_post_accept(struct socket * sock,
2575 struct socket * newsock)
2576{
2577 security_ops->socket_post_accept(sock, newsock);
2578}
2579
2580static inline int security_socket_sendmsg(struct socket * sock,
2581 struct msghdr * msg, int size)
2582{
2583 return security_ops->socket_sendmsg(sock, msg, size);
2584}
2585
2586static inline int security_socket_recvmsg(struct socket * sock,
2587 struct msghdr * msg, int size,
2588 int flags)
2589{
2590 return security_ops->socket_recvmsg(sock, msg, size, flags);
2591}
2592
2593static inline int security_socket_getsockname(struct socket * sock)
2594{
2595 return security_ops->socket_getsockname(sock);
2596}
2597
2598static inline int security_socket_getpeername(struct socket * sock)
2599{
2600 return security_ops->socket_getpeername(sock);
2601}
2602
2603static inline int security_socket_getsockopt(struct socket * sock,
2604 int level, int optname)
2605{
2606 return security_ops->socket_getsockopt(sock, level, optname);
2607}
2608
2609static inline int security_socket_setsockopt(struct socket * sock,
2610 int level, int optname)
2611{
2612 return security_ops->socket_setsockopt(sock, level, optname);
2613}
2614
2615static inline int security_socket_shutdown(struct socket * sock, int how)
2616{
2617 return security_ops->socket_shutdown(sock, how);
2618}
2619
2620static inline int security_sock_rcv_skb (struct sock * sk,
2621 struct sk_buff * skb)
2622{
2623 return security_ops->socket_sock_rcv_skb (sk, skb);
2624}
2625
2626static inline int security_socket_getpeersec(struct socket *sock, char __user *optval,
2627 int __user *optlen, unsigned len)
2628{
2629 return security_ops->socket_getpeersec(sock, optval, optlen, len);
2630}
2631
2632static inline int security_sk_alloc(struct sock *sk, int family, int priority)
2633{
2634 return security_ops->sk_alloc_security(sk, family, priority);
2635}
2636
2637static inline void security_sk_free(struct sock *sk)
2638{
2639 return security_ops->sk_free_security(sk);
2640}
2641#else
2642static inline int security_unix_stream_connect(struct socket * sock,
2643 struct socket * other,
2644 struct sock * newsk)
2645{
2646 return 0;
2647}
2648
2649static inline int security_unix_may_send(struct socket * sock,
2650 struct socket * other)
2651{
2652 return 0;
2653}
2654
2655static inline int security_socket_create (int family, int type,
2656 int protocol, int kern)
2657{
2658 return 0;
2659}
2660
2661static inline void security_socket_post_create(struct socket * sock,
2662 int family,
2663 int type,
2664 int protocol, int kern)
2665{
2666}
2667
2668static inline int security_socket_bind(struct socket * sock,
2669 struct sockaddr * address,
2670 int addrlen)
2671{
2672 return 0;
2673}
2674
2675static inline int security_socket_connect(struct socket * sock,
2676 struct sockaddr * address,
2677 int addrlen)
2678{
2679 return 0;
2680}
2681
2682static inline int security_socket_listen(struct socket * sock, int backlog)
2683{
2684 return 0;
2685}
2686
2687static inline int security_socket_accept(struct socket * sock,
2688 struct socket * newsock)
2689{
2690 return 0;
2691}
2692
2693static inline void security_socket_post_accept(struct socket * sock,
2694 struct socket * newsock)
2695{
2696}
2697
2698static inline int security_socket_sendmsg(struct socket * sock,
2699 struct msghdr * msg, int size)
2700{
2701 return 0;
2702}
2703
2704static inline int security_socket_recvmsg(struct socket * sock,
2705 struct msghdr * msg, int size,
2706 int flags)
2707{
2708 return 0;
2709}
2710
2711static inline int security_socket_getsockname(struct socket * sock)
2712{
2713 return 0;
2714}
2715
2716static inline int security_socket_getpeername(struct socket * sock)
2717{
2718 return 0;
2719}
2720
2721static inline int security_socket_getsockopt(struct socket * sock,
2722 int level, int optname)
2723{
2724 return 0;
2725}
2726
2727static inline int security_socket_setsockopt(struct socket * sock,
2728 int level, int optname)
2729{
2730 return 0;
2731}
2732
2733static inline int security_socket_shutdown(struct socket * sock, int how)
2734{
2735 return 0;
2736}
2737static inline int security_sock_rcv_skb (struct sock * sk,
2738 struct sk_buff * skb)
2739{
2740 return 0;
2741}
2742
2743static inline int security_socket_getpeersec(struct socket *sock, char __user *optval,
2744 int __user *optlen, unsigned len)
2745{
2746 return -ENOPROTOOPT;
2747}
2748
2749static inline int security_sk_alloc(struct sock *sk, int family, int priority)
2750{
2751 return 0;
2752}
2753
2754static inline void security_sk_free(struct sock *sk)
2755{
2756}
2757#endif
2758
2759#endif
2760
2761