| 1 |
This is TOMOYO Linux patch for kernel 4.19.12. |
This is TOMOYO Linux patch for kernel 4.19.13. |
| 2 |
|
|
| 3 |
Source code for this patch is https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.19.12.tar.xz |
Source code for this patch is https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.19.13.tar.xz |
| 4 |
--- |
--- |
| 5 |
fs/exec.c | 2 - |
fs/exec.c | 2 - |
| 6 |
fs/open.c | 2 + |
fs/open.c | 2 + |
| 28 |
security/security.c | 9 +++++- |
security/security.c | 9 +++++- |
| 29 |
24 files changed, 148 insertions(+), 29 deletions(-) |
24 files changed, 148 insertions(+), 29 deletions(-) |
| 30 |
|
|
| 31 |
--- linux-4.19.12.orig/fs/exec.c |
--- linux-4.19.13.orig/fs/exec.c |
| 32 |
+++ linux-4.19.12/fs/exec.c |
+++ linux-4.19.13/fs/exec.c |
| 33 |
@@ -1692,7 +1692,7 @@ static int exec_binprm(struct linux_binp |
@@ -1692,7 +1692,7 @@ static int exec_binprm(struct linux_binp |
| 34 |
old_vpid = task_pid_nr_ns(current, task_active_pid_ns(current->parent)); |
old_vpid = task_pid_nr_ns(current, task_active_pid_ns(current->parent)); |
| 35 |
rcu_read_unlock(); |
rcu_read_unlock(); |
| 39 |
if (ret >= 0) { |
if (ret >= 0) { |
| 40 |
audit_bprm(bprm); |
audit_bprm(bprm); |
| 41 |
trace_sched_process_exec(current, old_pid, bprm); |
trace_sched_process_exec(current, old_pid, bprm); |
| 42 |
--- linux-4.19.12.orig/fs/open.c |
--- linux-4.19.13.orig/fs/open.c |
| 43 |
+++ linux-4.19.12/fs/open.c |
+++ linux-4.19.13/fs/open.c |
| 44 |
@@ -1174,6 +1174,8 @@ SYSCALL_DEFINE1(close, unsigned int, fd) |
@@ -1174,6 +1174,8 @@ SYSCALL_DEFINE1(close, unsigned int, fd) |
| 45 |
*/ |
*/ |
| 46 |
SYSCALL_DEFINE0(vhangup) |
SYSCALL_DEFINE0(vhangup) |
| 50 |
if (capable(CAP_SYS_TTY_CONFIG)) { |
if (capable(CAP_SYS_TTY_CONFIG)) { |
| 51 |
tty_vhangup_self(); |
tty_vhangup_self(); |
| 52 |
return 0; |
return 0; |
| 53 |
--- linux-4.19.12.orig/fs/proc/version.c |
--- linux-4.19.13.orig/fs/proc/version.c |
| 54 |
+++ linux-4.19.12/fs/proc/version.c |
+++ linux-4.19.13/fs/proc/version.c |
| 55 |
@@ -21,3 +21,10 @@ static int __init proc_version_init(void |
@@ -21,3 +21,10 @@ static int __init proc_version_init(void |
| 56 |
return 0; |
return 0; |
| 57 |
} |
} |
| 59 |
+ |
+ |
| 60 |
+static int __init ccs_show_version(void) |
+static int __init ccs_show_version(void) |
| 61 |
+{ |
+{ |
| 62 |
+ printk(KERN_INFO "Hook version: 4.19.12 2018/12/24\n"); |
+ printk(KERN_INFO "Hook version: 4.19.13 2019/01/07\n"); |
| 63 |
+ return 0; |
+ return 0; |
| 64 |
+} |
+} |
| 65 |
+fs_initcall(ccs_show_version); |
+fs_initcall(ccs_show_version); |
| 66 |
--- linux-4.19.12.orig/include/linux/sched.h |
--- linux-4.19.13.orig/include/linux/sched.h |
| 67 |
+++ linux-4.19.12/include/linux/sched.h |
+++ linux-4.19.13/include/linux/sched.h |
| 68 |
@@ -34,6 +34,7 @@ struct audit_context; |
@@ -34,6 +34,7 @@ struct audit_context; |
| 69 |
struct backing_dev_info; |
struct backing_dev_info; |
| 70 |
struct bio_list; |
struct bio_list; |
| 84 |
|
|
| 85 |
/* |
/* |
| 86 |
* New fields for task_struct should be added above here, so that |
* New fields for task_struct should be added above here, so that |
| 87 |
--- linux-4.19.12.orig/include/linux/security.h |
--- linux-4.19.13.orig/include/linux/security.h |
| 88 |
+++ linux-4.19.12/include/linux/security.h |
+++ linux-4.19.13/include/linux/security.h |
| 89 |
@@ -53,6 +53,7 @@ struct msg_msg; |
@@ -53,6 +53,7 @@ struct msg_msg; |
| 90 |
struct xattr; |
struct xattr; |
| 91 |
struct xfrm_sec_ctx; |
struct xfrm_sec_ctx; |
| 306 |
} |
} |
| 307 |
#endif /* CONFIG_SECURITY_PATH */ |
#endif /* CONFIG_SECURITY_PATH */ |
| 308 |
|
|
| 309 |
--- linux-4.19.12.orig/include/net/ip.h |
--- linux-4.19.13.orig/include/net/ip.h |
| 310 |
+++ linux-4.19.12/include/net/ip.h |
+++ linux-4.19.13/include/net/ip.h |
| 311 |
@@ -301,6 +301,8 @@ void inet_get_local_port_range(struct ne |
@@ -301,6 +301,8 @@ void inet_get_local_port_range(struct ne |
| 312 |
#ifdef CONFIG_SYSCTL |
#ifdef CONFIG_SYSCTL |
| 313 |
static inline int inet_is_local_reserved_port(struct net *net, int port) |
static inline int inet_is_local_reserved_port(struct net *net, int port) |
| 326 |
return 0; |
return 0; |
| 327 |
} |
} |
| 328 |
|
|
| 329 |
--- linux-4.19.12.orig/init/init_task.c |
--- linux-4.19.13.orig/init/init_task.c |
| 330 |
+++ linux-4.19.12/init/init_task.c |
+++ linux-4.19.13/init/init_task.c |
| 331 |
@@ -179,6 +179,10 @@ struct task_struct init_task |
@@ -179,6 +179,10 @@ struct task_struct init_task |
| 332 |
#ifdef CONFIG_SECURITY |
#ifdef CONFIG_SECURITY |
| 333 |
.security = NULL, |
.security = NULL, |
| 339 |
}; |
}; |
| 340 |
EXPORT_SYMBOL(init_task); |
EXPORT_SYMBOL(init_task); |
| 341 |
|
|
| 342 |
--- linux-4.19.12.orig/kernel/kexec.c |
--- linux-4.19.13.orig/kernel/kexec.c |
| 343 |
+++ linux-4.19.12/kernel/kexec.c |
+++ linux-4.19.13/kernel/kexec.c |
| 344 |
@@ -18,7 +18,7 @@ |
@@ -18,7 +18,7 @@ |
| 345 |
#include <linux/syscalls.h> |
#include <linux/syscalls.h> |
| 346 |
#include <linux/vmalloc.h> |
#include <linux/vmalloc.h> |
| 359 |
|
|
| 360 |
/* Permit LSMs and IMA to fail the kexec */ |
/* Permit LSMs and IMA to fail the kexec */ |
| 361 |
result = security_kernel_load_data(LOADING_KEXEC_IMAGE); |
result = security_kernel_load_data(LOADING_KEXEC_IMAGE); |
| 362 |
--- linux-4.19.12.orig/kernel/module.c |
--- linux-4.19.13.orig/kernel/module.c |
| 363 |
+++ linux-4.19.12/kernel/module.c |
+++ linux-4.19.13/kernel/module.c |
| 364 |
@@ -66,6 +66,7 @@ |
@@ -66,6 +66,7 @@ |
| 365 |
#include <linux/audit.h> |
#include <linux/audit.h> |
| 366 |
#include <uapi/linux/module.h> |
#include <uapi/linux/module.h> |
| 387 |
|
|
| 388 |
return 0; |
return 0; |
| 389 |
} |
} |
| 390 |
--- linux-4.19.12.orig/kernel/ptrace.c |
--- linux-4.19.13.orig/kernel/ptrace.c |
| 391 |
+++ linux-4.19.12/kernel/ptrace.c |
+++ linux-4.19.13/kernel/ptrace.c |
| 392 |
@@ -1112,6 +1112,11 @@ SYSCALL_DEFINE4(ptrace, long, request, l |
@@ -1112,6 +1112,11 @@ SYSCALL_DEFINE4(ptrace, long, request, l |
| 393 |
{ |
{ |
| 394 |
struct task_struct *child; |
struct task_struct *child; |
| 413 |
|
|
| 414 |
if (request == PTRACE_TRACEME) { |
if (request == PTRACE_TRACEME) { |
| 415 |
ret = ptrace_traceme(); |
ret = ptrace_traceme(); |
| 416 |
--- linux-4.19.12.orig/kernel/reboot.c |
--- linux-4.19.13.orig/kernel/reboot.c |
| 417 |
+++ linux-4.19.12/kernel/reboot.c |
+++ linux-4.19.13/kernel/reboot.c |
| 418 |
@@ -16,6 +16,7 @@ |
@@ -16,6 +16,7 @@ |
| 419 |
#include <linux/syscalls.h> |
#include <linux/syscalls.h> |
| 420 |
#include <linux/syscore_ops.h> |
#include <linux/syscore_ops.h> |
| 432 |
|
|
| 433 |
/* |
/* |
| 434 |
* If pid namespaces are enabled and the current task is in a child |
* If pid namespaces are enabled and the current task is in a child |
| 435 |
--- linux-4.19.12.orig/kernel/sched/core.c |
--- linux-4.19.13.orig/kernel/sched/core.c |
| 436 |
+++ linux-4.19.12/kernel/sched/core.c |
+++ linux-4.19.13/kernel/sched/core.c |
| 437 |
@@ -3943,6 +3943,8 @@ int can_nice(const struct task_struct *p |
@@ -3943,6 +3943,8 @@ int can_nice(const struct task_struct *p |
| 438 |
SYSCALL_DEFINE1(nice, int, increment) |
SYSCALL_DEFINE1(nice, int, increment) |
| 439 |
{ |
{ |
| 443 |
|
|
| 444 |
/* |
/* |
| 445 |
* Setpriority might change our priority at the same moment. |
* Setpriority might change our priority at the same moment. |
| 446 |
--- linux-4.19.12.orig/kernel/signal.c |
--- linux-4.19.13.orig/kernel/signal.c |
| 447 |
+++ linux-4.19.12/kernel/signal.c |
+++ linux-4.19.13/kernel/signal.c |
| 448 |
@@ -3210,6 +3210,8 @@ COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait, |
@@ -3210,6 +3210,8 @@ COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait, |
| 449 |
SYSCALL_DEFINE2(kill, pid_t, pid, int, sig) |
SYSCALL_DEFINE2(kill, pid_t, pid, int, sig) |
| 450 |
{ |
{ |
| 490 |
|
|
| 491 |
return do_send_specific(tgid, pid, sig, info); |
return do_send_specific(tgid, pid, sig, info); |
| 492 |
} |
} |
| 493 |
--- linux-4.19.12.orig/kernel/sys.c |
--- linux-4.19.13.orig/kernel/sys.c |
| 494 |
+++ linux-4.19.12/kernel/sys.c |
+++ linux-4.19.13/kernel/sys.c |
| 495 |
@@ -201,6 +201,10 @@ SYSCALL_DEFINE3(setpriority, int, which, |
@@ -201,6 +201,10 @@ SYSCALL_DEFINE3(setpriority, int, which, |
| 496 |
|
|
| 497 |
if (which > PRIO_USER || which < PRIO_PROCESS) |
if (which > PRIO_USER || which < PRIO_PROCESS) |
| 521 |
|
|
| 522 |
errno = -EFAULT; |
errno = -EFAULT; |
| 523 |
if (!copy_from_user(tmp, name, len)) { |
if (!copy_from_user(tmp, name, len)) { |
| 524 |
--- linux-4.19.12.orig/kernel/time/timekeeping.c |
--- linux-4.19.13.orig/kernel/time/timekeeping.c |
| 525 |
+++ linux-4.19.12/kernel/time/timekeeping.c |
+++ linux-4.19.13/kernel/time/timekeeping.c |
| 526 |
@@ -26,6 +26,7 @@ |
@@ -26,6 +26,7 @@ |
| 527 |
#include <linux/stop_machine.h> |
#include <linux/stop_machine.h> |
| 528 |
#include <linux/pvclock_gtod.h> |
#include <linux/pvclock_gtod.h> |
| 556 |
|
|
| 557 |
/* |
/* |
| 558 |
* Validate if a timespec/timeval used to inject a time |
* Validate if a timespec/timeval used to inject a time |
| 559 |
--- linux-4.19.12.orig/net/ipv4/raw.c |
--- linux-4.19.13.orig/net/ipv4/raw.c |
| 560 |
+++ linux-4.19.12/net/ipv4/raw.c |
+++ linux-4.19.13/net/ipv4/raw.c |
| 561 |
@@ -772,6 +772,10 @@ static int raw_recvmsg(struct sock *sk, |
@@ -772,6 +772,10 @@ static int raw_recvmsg(struct sock *sk, |
| 562 |
skb = skb_recv_datagram(sk, flags, noblock, &err); |
skb = skb_recv_datagram(sk, flags, noblock, &err); |
| 563 |
if (!skb) |
if (!skb) |
| 569 |
|
|
| 570 |
copied = skb->len; |
copied = skb->len; |
| 571 |
if (len < copied) { |
if (len < copied) { |
| 572 |
--- linux-4.19.12.orig/net/ipv4/udp.c |
--- linux-4.19.13.orig/net/ipv4/udp.c |
| 573 |
+++ linux-4.19.12/net/ipv4/udp.c |
+++ linux-4.19.13/net/ipv4/udp.c |
| 574 |
@@ -1655,6 +1655,8 @@ try_again: |
@@ -1655,6 +1655,8 @@ try_again: |
| 575 |
skb = __skb_recv_udp(sk, flags, noblock, &peeked, &off, &err); |
skb = __skb_recv_udp(sk, flags, noblock, &peeked, &off, &err); |
| 576 |
if (!skb) |
if (!skb) |
| 580 |
|
|
| 581 |
ulen = udp_skb_len(skb); |
ulen = udp_skb_len(skb); |
| 582 |
copied = len; |
copied = len; |
| 583 |
--- linux-4.19.12.orig/net/ipv6/raw.c |
--- linux-4.19.13.orig/net/ipv6/raw.c |
| 584 |
+++ linux-4.19.12/net/ipv6/raw.c |
+++ linux-4.19.13/net/ipv6/raw.c |
| 585 |
@@ -483,6 +483,10 @@ static int rawv6_recvmsg(struct sock *sk |
@@ -483,6 +483,10 @@ static int rawv6_recvmsg(struct sock *sk |
| 586 |
skb = skb_recv_datagram(sk, flags, noblock, &err); |
skb = skb_recv_datagram(sk, flags, noblock, &err); |
| 587 |
if (!skb) |
if (!skb) |
| 593 |
|
|
| 594 |
copied = skb->len; |
copied = skb->len; |
| 595 |
if (copied > len) { |
if (copied > len) { |
| 596 |
--- linux-4.19.12.orig/net/ipv6/udp.c |
--- linux-4.19.13.orig/net/ipv6/udp.c |
| 597 |
+++ linux-4.19.12/net/ipv6/udp.c |
+++ linux-4.19.13/net/ipv6/udp.c |
| 598 |
@@ -343,6 +343,8 @@ try_again: |
@@ -343,6 +343,8 @@ try_again: |
| 599 |
skb = __skb_recv_udp(sk, flags, noblock, &peeked, &off, &err); |
skb = __skb_recv_udp(sk, flags, noblock, &peeked, &off, &err); |
| 600 |
if (!skb) |
if (!skb) |
| 604 |
|
|
| 605 |
ulen = udp6_skb_len(skb); |
ulen = udp6_skb_len(skb); |
| 606 |
copied = len; |
copied = len; |
| 607 |
--- linux-4.19.12.orig/net/socket.c |
--- linux-4.19.13.orig/net/socket.c |
| 608 |
+++ linux-4.19.12/net/socket.c |
+++ linux-4.19.13/net/socket.c |
| 609 |
@@ -1591,6 +1591,10 @@ int __sys_accept4(int fd, struct sockadd |
@@ -1591,6 +1591,10 @@ int __sys_accept4(int fd, struct sockadd |
| 610 |
if (err < 0) |
if (err < 0) |
| 611 |
goto out_fd; |
goto out_fd; |
| 617 |
if (upeer_sockaddr) { |
if (upeer_sockaddr) { |
| 618 |
len = newsock->ops->getname(newsock, |
len = newsock->ops->getname(newsock, |
| 619 |
(struct sockaddr *)&address, 2); |
(struct sockaddr *)&address, 2); |
| 620 |
--- linux-4.19.12.orig/net/unix/af_unix.c |
--- linux-4.19.13.orig/net/unix/af_unix.c |
| 621 |
+++ linux-4.19.12/net/unix/af_unix.c |
+++ linux-4.19.13/net/unix/af_unix.c |
| 622 |
@@ -2127,6 +2127,10 @@ static int unix_dgram_recvmsg(struct soc |
@@ -2127,6 +2127,10 @@ static int unix_dgram_recvmsg(struct soc |
| 623 |
EPOLLOUT | EPOLLWRNORM | |
EPOLLOUT | EPOLLWRNORM | |
| 624 |
EPOLLWRBAND); |
EPOLLWRBAND); |
| 638 |
mutex_unlock(&u->iolock); |
mutex_unlock(&u->iolock); |
| 639 |
out: |
out: |
| 640 |
return err; |
return err; |
| 641 |
--- linux-4.19.12.orig/security/Kconfig |
--- linux-4.19.13.orig/security/Kconfig |
| 642 |
+++ linux-4.19.12/security/Kconfig |
+++ linux-4.19.13/security/Kconfig |
| 643 |
@@ -276,5 +276,7 @@ config DEFAULT_SECURITY |
@@ -276,5 +276,7 @@ config DEFAULT_SECURITY |
| 644 |
default "apparmor" if DEFAULT_SECURITY_APPARMOR |
default "apparmor" if DEFAULT_SECURITY_APPARMOR |
| 645 |
default "" if DEFAULT_SECURITY_DAC |
default "" if DEFAULT_SECURITY_DAC |
| 648 |
+ |
+ |
| 649 |
endmenu |
endmenu |
| 650 |
|
|
| 651 |
--- linux-4.19.12.orig/security/Makefile |
--- linux-4.19.13.orig/security/Makefile |
| 652 |
+++ linux-4.19.12/security/Makefile |
+++ linux-4.19.13/security/Makefile |
| 653 |
@@ -30,3 +30,6 @@ obj-$(CONFIG_CGROUP_DEVICE) += device_c |
@@ -30,3 +30,6 @@ obj-$(CONFIG_CGROUP_DEVICE) += device_c |
| 654 |
# Object integrity file lists |
# Object integrity file lists |
| 655 |
subdir-$(CONFIG_INTEGRITY) += integrity |
subdir-$(CONFIG_INTEGRITY) += integrity |
| 657 |
+ |
+ |
| 658 |
+subdir-$(CONFIG_CCSECURITY) += ccsecurity |
+subdir-$(CONFIG_CCSECURITY) += ccsecurity |
| 659 |
+obj-$(CONFIG_CCSECURITY) += ccsecurity/ |
+obj-$(CONFIG_CCSECURITY) += ccsecurity/ |
| 660 |
--- linux-4.19.12.orig/security/security.c |
--- linux-4.19.13.orig/security/security.c |
| 661 |
+++ linux-4.19.12/security/security.c |
+++ linux-4.19.13/security/security.c |
| 662 |
@@ -988,12 +988,19 @@ int security_file_open(struct file *file |
@@ -988,12 +988,19 @@ int security_file_open(struct file *file |
| 663 |
|
|
| 664 |
int security_task_alloc(struct task_struct *task, unsigned long clone_flags) |
int security_task_alloc(struct task_struct *task, unsigned long clone_flags) |