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