| 1 |
This is TOMOYO Linux patch for kernel 5.4.82. |
This is TOMOYO Linux patch for kernel 5.4.83. |
| 2 |
|
|
| 3 |
Source code for this patch is https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.4.82.tar.xz |
Source code for this patch is https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.4.83.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 | 5 ++- |
security/security.c | 5 ++- |
| 29 |
24 files changed, 160 insertions(+), 30 deletions(-) |
24 files changed, 160 insertions(+), 30 deletions(-) |
| 30 |
|
|
| 31 |
--- linux-5.4.82.orig/fs/exec.c |
--- linux-5.4.83.orig/fs/exec.c |
| 32 |
+++ linux-5.4.82/fs/exec.c |
+++ linux-5.4.83/fs/exec.c |
| 33 |
@@ -1730,7 +1730,7 @@ static int exec_binprm(struct linux_binp |
@@ -1730,7 +1730,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-5.4.82.orig/fs/open.c |
--- linux-5.4.83.orig/fs/open.c |
| 43 |
+++ linux-5.4.82/fs/open.c |
+++ linux-5.4.83/fs/open.c |
| 44 |
@@ -1205,6 +1205,8 @@ SYSCALL_DEFINE1(close, unsigned int, fd) |
@@ -1205,6 +1205,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-5.4.82.orig/fs/proc/version.c |
--- linux-5.4.83.orig/fs/proc/version.c |
| 54 |
+++ linux-5.4.82/fs/proc/version.c |
+++ linux-5.4.83/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: 5.4.82 2020/12/08\n"); |
+ printk(KERN_INFO "Hook version: 5.4.83 2020/12/14\n"); |
| 63 |
+ return 0; |
+ return 0; |
| 64 |
+} |
+} |
| 65 |
+fs_initcall(ccs_show_version); |
+fs_initcall(ccs_show_version); |
| 66 |
--- linux-5.4.82.orig/include/linux/sched.h |
--- linux-5.4.83.orig/include/linux/sched.h |
| 67 |
+++ linux-5.4.82/include/linux/sched.h |
+++ linux-5.4.83/include/linux/sched.h |
| 68 |
@@ -38,6 +38,7 @@ struct backing_dev_info; |
@@ -38,6 +38,7 @@ struct backing_dev_info; |
| 69 |
struct bio_list; |
struct bio_list; |
| 70 |
struct blk_plug; |
struct blk_plug; |
| 84 |
|
|
| 85 |
#ifdef CONFIG_GCC_PLUGIN_STACKLEAK |
#ifdef CONFIG_GCC_PLUGIN_STACKLEAK |
| 86 |
unsigned long lowest_stack; |
unsigned long lowest_stack; |
| 87 |
--- linux-5.4.82.orig/include/linux/security.h |
--- linux-5.4.83.orig/include/linux/security.h |
| 88 |
+++ linux-5.4.82/include/linux/security.h |
+++ linux-5.4.83/include/linux/security.h |
| 89 |
@@ -57,6 +57,7 @@ struct mm_struct; |
@@ -57,6 +57,7 @@ struct mm_struct; |
| 90 |
struct fs_context; |
struct fs_context; |
| 91 |
struct fs_parameter; |
struct fs_parameter; |
| 315 |
} |
} |
| 316 |
#endif /* CONFIG_SECURITY_PATH */ |
#endif /* CONFIG_SECURITY_PATH */ |
| 317 |
|
|
| 318 |
--- linux-5.4.82.orig/include/net/ip.h |
--- linux-5.4.83.orig/include/net/ip.h |
| 319 |
+++ linux-5.4.82/include/net/ip.h |
+++ linux-5.4.83/include/net/ip.h |
| 320 |
@@ -341,6 +341,8 @@ void inet_get_local_port_range(struct ne |
@@ -341,6 +341,8 @@ void inet_get_local_port_range(struct ne |
| 321 |
#ifdef CONFIG_SYSCTL |
#ifdef CONFIG_SYSCTL |
| 322 |
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) |
| 335 |
return 0; |
return 0; |
| 336 |
} |
} |
| 337 |
|
|
| 338 |
--- linux-5.4.82.orig/init/init_task.c |
--- linux-5.4.83.orig/init/init_task.c |
| 339 |
+++ linux-5.4.82/init/init_task.c |
+++ linux-5.4.83/init/init_task.c |
| 340 |
@@ -182,6 +182,10 @@ struct task_struct init_task |
@@ -182,6 +182,10 @@ struct task_struct init_task |
| 341 |
#ifdef CONFIG_SECURITY |
#ifdef CONFIG_SECURITY |
| 342 |
.security = NULL, |
.security = NULL, |
| 348 |
}; |
}; |
| 349 |
EXPORT_SYMBOL(init_task); |
EXPORT_SYMBOL(init_task); |
| 350 |
|
|
| 351 |
--- linux-5.4.82.orig/kernel/kexec.c |
--- linux-5.4.83.orig/kernel/kexec.c |
| 352 |
+++ linux-5.4.82/kernel/kexec.c |
+++ linux-5.4.83/kernel/kexec.c |
| 353 |
@@ -16,7 +16,7 @@ |
@@ -16,7 +16,7 @@ |
| 354 |
#include <linux/syscalls.h> |
#include <linux/syscalls.h> |
| 355 |
#include <linux/vmalloc.h> |
#include <linux/vmalloc.h> |
| 368 |
|
|
| 369 |
/* Permit LSMs and IMA to fail the kexec */ |
/* Permit LSMs and IMA to fail the kexec */ |
| 370 |
result = security_kernel_load_data(LOADING_KEXEC_IMAGE); |
result = security_kernel_load_data(LOADING_KEXEC_IMAGE); |
| 371 |
--- linux-5.4.82.orig/kernel/module.c |
--- linux-5.4.83.orig/kernel/module.c |
| 372 |
+++ linux-5.4.82/kernel/module.c |
+++ linux-5.4.83/kernel/module.c |
| 373 |
@@ -55,6 +55,7 @@ |
@@ -55,6 +55,7 @@ |
| 374 |
#include <linux/audit.h> |
#include <linux/audit.h> |
| 375 |
#include <uapi/linux/module.h> |
#include <uapi/linux/module.h> |
| 396 |
|
|
| 397 |
return 0; |
return 0; |
| 398 |
} |
} |
| 399 |
--- linux-5.4.82.orig/kernel/ptrace.c |
--- linux-5.4.83.orig/kernel/ptrace.c |
| 400 |
+++ linux-5.4.82/kernel/ptrace.c |
+++ linux-5.4.83/kernel/ptrace.c |
| 401 |
@@ -1238,6 +1238,11 @@ SYSCALL_DEFINE4(ptrace, long, request, l |
@@ -1238,6 +1238,11 @@ SYSCALL_DEFINE4(ptrace, long, request, l |
| 402 |
{ |
{ |
| 403 |
struct task_struct *child; |
struct task_struct *child; |
| 422 |
|
|
| 423 |
if (request == PTRACE_TRACEME) { |
if (request == PTRACE_TRACEME) { |
| 424 |
ret = ptrace_traceme(); |
ret = ptrace_traceme(); |
| 425 |
--- linux-5.4.82.orig/kernel/reboot.c |
--- linux-5.4.83.orig/kernel/reboot.c |
| 426 |
+++ linux-5.4.82/kernel/reboot.c |
+++ linux-5.4.83/kernel/reboot.c |
| 427 |
@@ -17,6 +17,7 @@ |
@@ -17,6 +17,7 @@ |
| 428 |
#include <linux/syscalls.h> |
#include <linux/syscalls.h> |
| 429 |
#include <linux/syscore_ops.h> |
#include <linux/syscore_ops.h> |
| 441 |
|
|
| 442 |
/* |
/* |
| 443 |
* 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 |
| 444 |
--- linux-5.4.82.orig/kernel/sched/core.c |
--- linux-5.4.83.orig/kernel/sched/core.c |
| 445 |
+++ linux-5.4.82/kernel/sched/core.c |
+++ linux-5.4.83/kernel/sched/core.c |
| 446 |
@@ -4663,6 +4663,8 @@ int can_nice(const struct task_struct *p |
@@ -4663,6 +4663,8 @@ int can_nice(const struct task_struct *p |
| 447 |
SYSCALL_DEFINE1(nice, int, increment) |
SYSCALL_DEFINE1(nice, int, increment) |
| 448 |
{ |
{ |
| 452 |
|
|
| 453 |
/* |
/* |
| 454 |
* Setpriority might change our priority at the same moment. |
* Setpriority might change our priority at the same moment. |
| 455 |
--- linux-5.4.82.orig/kernel/signal.c |
--- linux-5.4.83.orig/kernel/signal.c |
| 456 |
+++ linux-5.4.82/kernel/signal.c |
+++ linux-5.4.83/kernel/signal.c |
| 457 |
@@ -3644,6 +3644,8 @@ static inline void prepare_kill_siginfo( |
@@ -3644,6 +3644,8 @@ static inline void prepare_kill_siginfo( |
| 458 |
SYSCALL_DEFINE2(kill, pid_t, pid, int, sig) |
SYSCALL_DEFINE2(kill, pid_t, pid, int, sig) |
| 459 |
{ |
{ |
| 521 |
|
|
| 522 |
return do_send_specific(tgid, pid, sig, info); |
return do_send_specific(tgid, pid, sig, info); |
| 523 |
} |
} |
| 524 |
--- linux-5.4.82.orig/kernel/sys.c |
--- linux-5.4.83.orig/kernel/sys.c |
| 525 |
+++ linux-5.4.82/kernel/sys.c |
+++ linux-5.4.83/kernel/sys.c |
| 526 |
@@ -204,6 +204,10 @@ SYSCALL_DEFINE3(setpriority, int, which, |
@@ -204,6 +204,10 @@ SYSCALL_DEFINE3(setpriority, int, which, |
| 527 |
|
|
| 528 |
if (which > PRIO_USER || which < PRIO_PROCESS) |
if (which > PRIO_USER || which < PRIO_PROCESS) |
| 552 |
|
|
| 553 |
errno = -EFAULT; |
errno = -EFAULT; |
| 554 |
if (!copy_from_user(tmp, name, len)) { |
if (!copy_from_user(tmp, name, len)) { |
| 555 |
--- linux-5.4.82.orig/kernel/time/timekeeping.c |
--- linux-5.4.83.orig/kernel/time/timekeeping.c |
| 556 |
+++ linux-5.4.82/kernel/time/timekeeping.c |
+++ linux-5.4.83/kernel/time/timekeeping.c |
| 557 |
@@ -22,6 +22,7 @@ |
@@ -22,6 +22,7 @@ |
| 558 |
#include <linux/pvclock_gtod.h> |
#include <linux/pvclock_gtod.h> |
| 559 |
#include <linux/compiler.h> |
#include <linux/compiler.h> |
| 587 |
|
|
| 588 |
/* |
/* |
| 589 |
* Validate if a timespec/timeval used to inject a time |
* Validate if a timespec/timeval used to inject a time |
| 590 |
--- linux-5.4.82.orig/net/ipv4/raw.c |
--- linux-5.4.83.orig/net/ipv4/raw.c |
| 591 |
+++ linux-5.4.82/net/ipv4/raw.c |
+++ linux-5.4.83/net/ipv4/raw.c |
| 592 |
@@ -767,6 +767,10 @@ static int raw_recvmsg(struct sock *sk, |
@@ -767,6 +767,10 @@ static int raw_recvmsg(struct sock *sk, |
| 593 |
skb = skb_recv_datagram(sk, flags, noblock, &err); |
skb = skb_recv_datagram(sk, flags, noblock, &err); |
| 594 |
if (!skb) |
if (!skb) |
| 600 |
|
|
| 601 |
copied = skb->len; |
copied = skb->len; |
| 602 |
if (len < copied) { |
if (len < copied) { |
| 603 |
--- linux-5.4.82.orig/net/ipv4/udp.c |
--- linux-5.4.83.orig/net/ipv4/udp.c |
| 604 |
+++ linux-5.4.82/net/ipv4/udp.c |
+++ linux-5.4.83/net/ipv4/udp.c |
| 605 |
@@ -1744,6 +1744,8 @@ try_again: |
@@ -1744,6 +1744,8 @@ try_again: |
| 606 |
skb = __skb_recv_udp(sk, flags, noblock, &off, &err); |
skb = __skb_recv_udp(sk, flags, noblock, &off, &err); |
| 607 |
if (!skb) |
if (!skb) |
| 611 |
|
|
| 612 |
ulen = udp_skb_len(skb); |
ulen = udp_skb_len(skb); |
| 613 |
copied = len; |
copied = len; |
| 614 |
--- linux-5.4.82.orig/net/ipv6/raw.c |
--- linux-5.4.83.orig/net/ipv6/raw.c |
| 615 |
+++ linux-5.4.82/net/ipv6/raw.c |
+++ linux-5.4.83/net/ipv6/raw.c |
| 616 |
@@ -480,6 +480,10 @@ static int rawv6_recvmsg(struct sock *sk |
@@ -480,6 +480,10 @@ static int rawv6_recvmsg(struct sock *sk |
| 617 |
skb = skb_recv_datagram(sk, flags, noblock, &err); |
skb = skb_recv_datagram(sk, flags, noblock, &err); |
| 618 |
if (!skb) |
if (!skb) |
| 624 |
|
|
| 625 |
copied = skb->len; |
copied = skb->len; |
| 626 |
if (copied > len) { |
if (copied > len) { |
| 627 |
--- linux-5.4.82.orig/net/ipv6/udp.c |
--- linux-5.4.83.orig/net/ipv6/udp.c |
| 628 |
+++ linux-5.4.82/net/ipv6/udp.c |
+++ linux-5.4.83/net/ipv6/udp.c |
| 629 |
@@ -291,6 +291,8 @@ try_again: |
@@ -291,6 +291,8 @@ try_again: |
| 630 |
skb = __skb_recv_udp(sk, flags, noblock, &off, &err); |
skb = __skb_recv_udp(sk, flags, noblock, &off, &err); |
| 631 |
if (!skb) |
if (!skb) |
| 635 |
|
|
| 636 |
ulen = udp6_skb_len(skb); |
ulen = udp6_skb_len(skb); |
| 637 |
copied = len; |
copied = len; |
| 638 |
--- linux-5.4.82.orig/net/socket.c |
--- linux-5.4.83.orig/net/socket.c |
| 639 |
+++ linux-5.4.82/net/socket.c |
+++ linux-5.4.83/net/socket.c |
| 640 |
@@ -1755,6 +1755,10 @@ int __sys_accept4(int fd, struct sockadd |
@@ -1755,6 +1755,10 @@ int __sys_accept4(int fd, struct sockadd |
| 641 |
if (err < 0) |
if (err < 0) |
| 642 |
goto out_fd; |
goto out_fd; |
| 648 |
if (upeer_sockaddr) { |
if (upeer_sockaddr) { |
| 649 |
len = newsock->ops->getname(newsock, |
len = newsock->ops->getname(newsock, |
| 650 |
(struct sockaddr *)&address, 2); |
(struct sockaddr *)&address, 2); |
| 651 |
--- linux-5.4.82.orig/net/unix/af_unix.c |
--- linux-5.4.83.orig/net/unix/af_unix.c |
| 652 |
+++ linux-5.4.82/net/unix/af_unix.c |
+++ linux-5.4.83/net/unix/af_unix.c |
| 653 |
@@ -2094,6 +2094,10 @@ static int unix_dgram_recvmsg(struct soc |
@@ -2094,6 +2094,10 @@ static int unix_dgram_recvmsg(struct soc |
| 654 |
EPOLLOUT | EPOLLWRNORM | |
EPOLLOUT | EPOLLWRNORM | |
| 655 |
EPOLLWRBAND); |
EPOLLWRBAND); |
| 669 |
mutex_unlock(&u->iolock); |
mutex_unlock(&u->iolock); |
| 670 |
out: |
out: |
| 671 |
return err; |
return err; |
| 672 |
--- linux-5.4.82.orig/security/Kconfig |
--- linux-5.4.83.orig/security/Kconfig |
| 673 |
+++ linux-5.4.82/security/Kconfig |
+++ linux-5.4.83/security/Kconfig |
| 674 |
@@ -291,5 +291,7 @@ config LSM |
@@ -291,5 +291,7 @@ config LSM |
| 675 |
|
|
| 676 |
source "security/Kconfig.hardening" |
source "security/Kconfig.hardening" |
| 679 |
+ |
+ |
| 680 |
endmenu |
endmenu |
| 681 |
|
|
| 682 |
--- linux-5.4.82.orig/security/Makefile |
--- linux-5.4.83.orig/security/Makefile |
| 683 |
+++ linux-5.4.82/security/Makefile |
+++ linux-5.4.83/security/Makefile |
| 684 |
@@ -34,3 +34,6 @@ obj-$(CONFIG_CGROUP_DEVICE) += device_c |
@@ -34,3 +34,6 @@ obj-$(CONFIG_CGROUP_DEVICE) += device_c |
| 685 |
# Object integrity file lists |
# Object integrity file lists |
| 686 |
subdir-$(CONFIG_INTEGRITY) += integrity |
subdir-$(CONFIG_INTEGRITY) += integrity |
| 688 |
+ |
+ |
| 689 |
+subdir-$(CONFIG_CCSECURITY) += ccsecurity |
+subdir-$(CONFIG_CCSECURITY) += ccsecurity |
| 690 |
+obj-$(CONFIG_CCSECURITY) += ccsecurity/ |
+obj-$(CONFIG_CCSECURITY) += ccsecurity/ |
| 691 |
--- linux-5.4.82.orig/security/security.c |
--- linux-5.4.83.orig/security/security.c |
| 692 |
+++ linux-5.4.82/security/security.c |
+++ linux-5.4.83/security/security.c |
| 693 |
@@ -1507,7 +1507,9 @@ int security_task_alloc(struct task_stru |
@@ -1507,7 +1507,9 @@ int security_task_alloc(struct task_stru |
| 694 |
|
|
| 695 |
if (rc) |
if (rc) |