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