aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/audit.h
diff options
context:
space:
mode:
authorJames Morris <jmorris@namei.org>2009-02-05 19:01:45 -0500
committerJames Morris <jmorris@namei.org>2009-02-05 19:01:45 -0500
commitcb5629b10d64a8006622ce3a52bc887d91057d69 (patch)
tree7c06d8f30783115e3384721046258ce615b129c5 /include/linux/audit.h
parent8920d5ad6ba74ae8ab020e90cc4d976980e68701 (diff)
parentf01d1d546abb2f4028b5299092f529eefb01253a (diff)
Merge branch 'master' into next
Conflicts: fs/namei.c Manually merged per: diff --cc fs/namei.c index 734f2b5,bbc15c2..0000000 --- a/fs/namei.c +++ b/fs/namei.c @@@ -860,9 -848,8 +849,10 @@@ static int __link_path_walk(const char nd->flags |= LOOKUP_CONTINUE; err = exec_permission_lite(inode); if (err == -EAGAIN) - err = vfs_permission(nd, MAY_EXEC); + err = inode_permission(nd->path.dentry->d_inode, + MAY_EXEC); + if (!err) + err = ima_path_check(&nd->path, MAY_EXEC); if (err) break; @@@ -1525,14 -1506,9 +1509,14 @@@ int may_open(struct path *path, int acc flag &= ~O_TRUNC; } - error = vfs_permission(nd, acc_mode); + error = inode_permission(inode, acc_mode); if (error) return error; + - error = ima_path_check(&nd->path, ++ error = ima_path_check(path, + acc_mode & (MAY_READ | MAY_WRITE | MAY_EXEC)); + if (error) + return error; /* * An append-only file must be opened in append mode for writing. */ Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'include/linux/audit.h')
-rw-r--r--include/linux/audit.h98
1 files changed, 48 insertions, 50 deletions
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 8d1f67789b53..930939abfbc6 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -252,6 +252,18 @@
252#define AUDIT_GREATER_THAN_OR_EQUAL (AUDIT_GREATER_THAN|AUDIT_EQUAL) 252#define AUDIT_GREATER_THAN_OR_EQUAL (AUDIT_GREATER_THAN|AUDIT_EQUAL)
253#define AUDIT_OPERATORS (AUDIT_EQUAL|AUDIT_NOT_EQUAL|AUDIT_BIT_MASK) 253#define AUDIT_OPERATORS (AUDIT_EQUAL|AUDIT_NOT_EQUAL|AUDIT_BIT_MASK)
254 254
255enum {
256 Audit_equal,
257 Audit_not_equal,
258 Audit_bitmask,
259 Audit_bittest,
260 Audit_lt,
261 Audit_gt,
262 Audit_le,
263 Audit_ge,
264 Audit_bad
265};
266
255/* Status symbols */ 267/* Status symbols */
256 /* Mask values */ 268 /* Mask values */
257#define AUDIT_STATUS_ENABLED 0x0001 269#define AUDIT_STATUS_ENABLED 0x0001
@@ -378,6 +390,8 @@ struct audit_krule {
378 struct audit_watch *watch; /* associated watch */ 390 struct audit_watch *watch; /* associated watch */
379 struct audit_tree *tree; /* associated watched tree */ 391 struct audit_tree *tree; /* associated watched tree */
380 struct list_head rlist; /* entry in audit_{watch,tree}.rules list */ 392 struct list_head rlist; /* entry in audit_{watch,tree}.rules list */
393 struct list_head list; /* for AUDIT_LIST* purposes only */
394 u64 prio;
381}; 395};
382 396
383struct audit_field { 397struct audit_field {
@@ -448,70 +462,56 @@ extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid);
448#define audit_get_loginuid(t) ((t)->loginuid) 462#define audit_get_loginuid(t) ((t)->loginuid)
449#define audit_get_sessionid(t) ((t)->sessionid) 463#define audit_get_sessionid(t) ((t)->sessionid)
450extern void audit_log_task_context(struct audit_buffer *ab); 464extern void audit_log_task_context(struct audit_buffer *ab);
451extern int __audit_ipc_obj(struct kern_ipc_perm *ipcp); 465extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp);
452extern int __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode); 466extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode);
453extern int audit_bprm(struct linux_binprm *bprm); 467extern int audit_bprm(struct linux_binprm *bprm);
454extern int audit_socketcall(int nargs, unsigned long *args); 468extern void audit_socketcall(int nargs, unsigned long *args);
455extern int audit_sockaddr(int len, void *addr); 469extern int audit_sockaddr(int len, void *addr);
456extern int __audit_fd_pair(int fd1, int fd2); 470extern void __audit_fd_pair(int fd1, int fd2);
457extern int audit_set_macxattr(const char *name); 471extern int audit_set_macxattr(const char *name);
458extern int __audit_mq_open(int oflag, mode_t mode, struct mq_attr __user *u_attr); 472extern void __audit_mq_open(int oflag, mode_t mode, struct mq_attr *attr);
459extern int __audit_mq_timedsend(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec __user *u_abs_timeout); 473extern void __audit_mq_sendrecv(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec *abs_timeout);
460extern int __audit_mq_timedreceive(mqd_t mqdes, size_t msg_len, unsigned int __user *u_msg_prio, const struct timespec __user *u_abs_timeout); 474extern void __audit_mq_notify(mqd_t mqdes, const struct sigevent *notification);
461extern int __audit_mq_notify(mqd_t mqdes, const struct sigevent __user *u_notification); 475extern void __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat);
462extern int __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat);
463extern int __audit_log_bprm_fcaps(struct linux_binprm *bprm, 476extern int __audit_log_bprm_fcaps(struct linux_binprm *bprm,
464 const struct cred *new, 477 const struct cred *new,
465 const struct cred *old); 478 const struct cred *old);
466extern int __audit_log_capset(pid_t pid, const struct cred *new, const struct cred *old); 479extern void __audit_log_capset(pid_t pid, const struct cred *new, const struct cred *old);
467 480
468static inline int audit_ipc_obj(struct kern_ipc_perm *ipcp) 481static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp)
469{ 482{
470 if (unlikely(!audit_dummy_context())) 483 if (unlikely(!audit_dummy_context()))
471 return __audit_ipc_obj(ipcp); 484 __audit_ipc_obj(ipcp);
472 return 0;
473}
474static inline int audit_fd_pair(int fd1, int fd2)
475{
476 if (unlikely(!audit_dummy_context()))
477 return __audit_fd_pair(fd1, fd2);
478 return 0;
479} 485}
480static inline int audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode) 486static inline void audit_fd_pair(int fd1, int fd2)
481{ 487{
482 if (unlikely(!audit_dummy_context())) 488 if (unlikely(!audit_dummy_context()))
483 return __audit_ipc_set_perm(qbytes, uid, gid, mode); 489 __audit_fd_pair(fd1, fd2);
484 return 0;
485} 490}
486static inline int audit_mq_open(int oflag, mode_t mode, struct mq_attr __user *u_attr) 491static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode)
487{ 492{
488 if (unlikely(!audit_dummy_context())) 493 if (unlikely(!audit_dummy_context()))
489 return __audit_mq_open(oflag, mode, u_attr); 494 __audit_ipc_set_perm(qbytes, uid, gid, mode);
490 return 0;
491} 495}
492static inline int audit_mq_timedsend(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec __user *u_abs_timeout) 496static inline void audit_mq_open(int oflag, mode_t mode, struct mq_attr *attr)
493{ 497{
494 if (unlikely(!audit_dummy_context())) 498 if (unlikely(!audit_dummy_context()))
495 return __audit_mq_timedsend(mqdes, msg_len, msg_prio, u_abs_timeout); 499 __audit_mq_open(oflag, mode, attr);
496 return 0;
497} 500}
498static inline int audit_mq_timedreceive(mqd_t mqdes, size_t msg_len, unsigned int __user *u_msg_prio, const struct timespec __user *u_abs_timeout) 501static inline void audit_mq_sendrecv(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec *abs_timeout)
499{ 502{
500 if (unlikely(!audit_dummy_context())) 503 if (unlikely(!audit_dummy_context()))
501 return __audit_mq_timedreceive(mqdes, msg_len, u_msg_prio, u_abs_timeout); 504 __audit_mq_sendrecv(mqdes, msg_len, msg_prio, abs_timeout);
502 return 0;
503} 505}
504static inline int audit_mq_notify(mqd_t mqdes, const struct sigevent __user *u_notification) 506static inline void audit_mq_notify(mqd_t mqdes, const struct sigevent *notification)
505{ 507{
506 if (unlikely(!audit_dummy_context())) 508 if (unlikely(!audit_dummy_context()))
507 return __audit_mq_notify(mqdes, u_notification); 509 __audit_mq_notify(mqdes, notification);
508 return 0;
509} 510}
510static inline int audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat) 511static inline void audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat)
511{ 512{
512 if (unlikely(!audit_dummy_context())) 513 if (unlikely(!audit_dummy_context()))
513 return __audit_mq_getsetattr(mqdes, mqstat); 514 __audit_mq_getsetattr(mqdes, mqstat);
514 return 0;
515} 515}
516 516
517static inline int audit_log_bprm_fcaps(struct linux_binprm *bprm, 517static inline int audit_log_bprm_fcaps(struct linux_binprm *bprm,
@@ -523,12 +523,11 @@ static inline int audit_log_bprm_fcaps(struct linux_binprm *bprm,
523 return 0; 523 return 0;
524} 524}
525 525
526static inline int audit_log_capset(pid_t pid, const struct cred *new, 526static inline void audit_log_capset(pid_t pid, const struct cred *new,
527 const struct cred *old) 527 const struct cred *old)
528{ 528{
529 if (unlikely(!audit_dummy_context())) 529 if (unlikely(!audit_dummy_context()))
530 return __audit_log_capset(pid, new, old); 530 __audit_log_capset(pid, new, old);
531 return 0;
532} 531}
533 532
534extern int audit_n_rules; 533extern int audit_n_rules;
@@ -551,20 +550,19 @@ extern int audit_signals;
551#define audit_get_loginuid(t) (-1) 550#define audit_get_loginuid(t) (-1)
552#define audit_get_sessionid(t) (-1) 551#define audit_get_sessionid(t) (-1)
553#define audit_log_task_context(b) do { ; } while (0) 552#define audit_log_task_context(b) do { ; } while (0)
554#define audit_ipc_obj(i) ({ 0; }) 553#define audit_ipc_obj(i) ((void)0)
555#define audit_ipc_set_perm(q,u,g,m) ({ 0; }) 554#define audit_ipc_set_perm(q,u,g,m) ((void)0)
556#define audit_bprm(p) ({ 0; }) 555#define audit_bprm(p) ({ 0; })
557#define audit_socketcall(n,a) ({ 0; }) 556#define audit_socketcall(n,a) ((void)0)
558#define audit_fd_pair(n,a) ({ 0; }) 557#define audit_fd_pair(n,a) ((void)0)
559#define audit_sockaddr(len, addr) ({ 0; }) 558#define audit_sockaddr(len, addr) ({ 0; })
560#define audit_set_macxattr(n) do { ; } while (0) 559#define audit_set_macxattr(n) do { ; } while (0)
561#define audit_mq_open(o,m,a) ({ 0; }) 560#define audit_mq_open(o,m,a) ((void)0)
562#define audit_mq_timedsend(d,l,p,t) ({ 0; }) 561#define audit_mq_sendrecv(d,l,p,t) ((void)0)
563#define audit_mq_timedreceive(d,l,p,t) ({ 0; }) 562#define audit_mq_notify(d,n) ((void)0)
564#define audit_mq_notify(d,n) ({ 0; }) 563#define audit_mq_getsetattr(d,s) ((void)0)
565#define audit_mq_getsetattr(d,s) ({ 0; })
566#define audit_log_bprm_fcaps(b, ncr, ocr) ({ 0; }) 564#define audit_log_bprm_fcaps(b, ncr, ocr) ({ 0; })
567#define audit_log_capset(pid, ncr, ocr) ({ 0; }) 565#define audit_log_capset(pid, ncr, ocr) ((void)0)
568#define audit_ptrace(t) ((void)0) 566#define audit_ptrace(t) ((void)0)
569#define audit_n_rules 0 567#define audit_n_rules 0
570#define audit_signals 0 568#define audit_signals 0