--- trunk/1.6.x/ccs-patch/README.ccs 2009/05/19 01:11:55 2562 +++ trunk/1.8.x/ccs-patch/README.ccs 2011/03/31 02:27:31 4782 @@ -16,10 +16,6 @@ This project was very inspired by the comic "Card Captor SAKURA", one of the CLAMP's masterworks. -The names SAKURA and TOMOYO and SYAORAN were borrowed from the comic -with the heartfelt thanks to CLAMP. - - ChangeLog: @@ -197,7 +193,7 @@ @ Fix handling of trailing '\*' in PathMatchesToPattern(). PathMatchesToPattern("/tmp/", "/tmp/\*") returned true - because "\*" matches to "more than or equals to 0 character + because "\*" matches "zero or more repetitions of characters until '/' or end". But since this is a comparison between directory and non-directory, this should not match. @@ -408,14 +404,14 @@ @ Change behavior of pathname pattern matching. - Until now, it was impossible to use patterns like "\*.txt" - because "\*" matched to more than 0 characters until next '/'. - Now, "\*" matches to more than 0 characters. + Until now, it was impossible to use patterns like "\*.txt" because + "\*" matched zero or more repetitions of characters until next '/'. + Now, "\*" matches zero or more repetitions of characters. Until now, it was impossible to use patterns like "\$00" - because "\$" matched to more than 1 digits until next + because "\$" matched one or more repetitions of digits until next non digit character. - Now, "\$" matches to more than 1 digits. + Now, "\$" matches one or more repetitions of digits. Also, new patterns "\x" "\X" "\a" "\A" "\@" are added. @@ -432,7 +428,7 @@ @ Change matching rule for CheckFileACL(). - Until now, only first entry that matched to the requested pathname + Until now, only first entry that matched the requested pathname was used for permission checking. For example, two entries "2 /tmp/file-\$.txt" @@ -448,7 +444,7 @@ This may potentially cause trouble because the result of permission checks depends on the order of entries. - Now, all entries that matched to the requested pathname + Now, all entries that matched the requested pathname are used for permission checking so that the result of permission checks doesn't depend on the order of entries. @@ -489,14 +485,14 @@ domain ACL. For example, "1 /bin/sh if task.euid!=0" - + allows the domain to execute /bin/sh only when the process's euid is not 0, and "6 /home/\*/\* if task.uid=path1.uid" allows the domain to read-write user's home directory - only when the file's owner matches to the process's uid. + only when the file's owner matches the process's uid. Fix 2006/08/22 @@ -762,7 +758,7 @@ if /some/program is called from "some_domain" domain. "some_domain" can be just the last component of domainname. - For example, giving "/bin/mail" as "some_domain" matches to + For example, giving "/bin/mail" as "some_domain" matches all domains whose domainname ends with "/bin/mail". Fix 2007/01/19 @@ -875,7 +871,7 @@ based on realpath while argv[0] check is done based on the symlink's pathname and argv[0], this specification will allow attackers behave as /bin/cat in the domain of /bin/ls if "/bin/ls and /bin/cat are - links to /sbin/busybox" and "the attacker is permitted to create + links to /sbin/busybox" and "the attacker is permitted to create a symlink named ~/cat that points to /bin/ls" and "the attacker is permitted to run /bin/ls". So, I changed to compare the basename of realpath and argv[0]. @@ -963,7 +959,7 @@ Until now, users had to add init=/.init parameter to load policy before /sbin/init starts. - I inserted call_usermodehelper() to call external policy loader when + I inserted call_usermodehelper() to call external policy loader when execve("/sbin/init") is requested and external policy loader exists. This change will remove init=/.init parameter from most environment, @@ -1007,7 +1003,7 @@ @ Remove initializer directive. - Use "initialize_domain" instrad of "initializer". + Use "initialize_domain" instead of "initializer". Fix 2007/08/21 @@ -1727,7 +1723,7 @@ to see process information. The content of /proc/ccs/.execute_handler is identical to /proc/ccs/.process_status . -Version 1.6.5 2008/11/11 Third anniversary release. +Version 1.6.5 2008/11/11 Third anniversary release. Fix 2008/12/01 @@ -1922,16 +1918,6 @@ This problem happens on little endian platforms (e.g. x86). -Fix 2009/04/20 - - @ Update recvmsg() hooks. - - Since 1.5.0, I was doing network access control for incoming UDP and RAW - packets inside skb_recv_datagram(). But to synchronize with LSM version, - I moved ccs_recv_datagram_permission() hook from skb_recv_datagram() to - udp_recvmsg()/udpv6_recvmsg()/raw_recvmsg()/rawv6_recvmsg() with name - change to ccs_recvmsg_permission(). - Fix 2009/05/08 @ Add condition for symlink's target pathname. @@ -1977,4 +1963,852 @@ I modified to unlock the mutex before calling get_fs_type(). -Version 1.6.8 2009/05/?? Feature enhancement release. +Fix 2009/05/20 + + @ Update recvmsg() hooks. + + Since 1.5.0, I was doing network access control for incoming UDP and RAW + packets inside skb_recv_datagram(). But to synchronize with LSM version, + I moved ccs_recv_datagram_permission() hook from skb_recv_datagram() to + udp_recvmsg()/udpv6_recvmsg()/raw_recvmsg()/rawv6_recvmsg() with name + change to ccs_recvmsg_permission(). + +Version 1.6.8 2009/05/28 Feature enhancement release. + +Fix 2009/07/03 + + @ Fix buffer overrun when used with CONFIG_SLOB=y . + + Since 1.6.7 , ccs_allocate_execve_entry() was requesting for only 4000 + bytes while the comment says it is 4096 bytes. This may lead to buffer + overrun when slob allocator is used, for slob allocator allocates exactly + 4000 bytes whereas slab and slub allocators allocate 4096 bytes. + +Fix 2009/09/01 + + @ Add garbage collector support. + + Until now, it was impossible to release memory used by deleted policy. + I added SRCU based garbage collector so that memory used by deleted + policy will be automatically released. + + @ Remove word length limitation and line length limitation. + + Until now, the max length of a word is 4000 and the max length of a line + is 8192. To be able to handle longer pathnames, I removed these + limitations. Now, the max length (except the domainname and + argv[]/envp[]) is 128K (which is the max amount of memory kmalloc() + can allocate in most environments). + + @ Support more fine grained profile configuration. + + Profile was reconstructed. + + @ Support more fine grained parameters restrictions. + + "allow_create", "allow_mkdir", "allow_mkfifo", "allow_mksock" check + create mode. "allow_mkblock" and "allow_mkchar" check create mode and + major/minor device numbers. "allow_chmod" check new mode. "allow_chown" + checks new owner. "allow_chgrp" checks new group. + + @ Allow number grouping. + + To help specifying numeric values, a new directive "number_group" is + introduced. + + @ Remove "alias" directive and "allow_argv0" directive. + + Until now, "allow_execute" used dereferenced pathname if it is a symlink + unless explicitly specified by "alias" directive. + + Now, "allow_execute" uses symlink's pathname if it is a symlink. + "exec.realpath" in "if" clause checks the dereferenced pathname. + "exec.argv[0]" in "if" clause checks the invocation name. + + @ Remove /proc/ccs/system_policy and /etc/ccs/system_policy.conf . + + "deny_autobind" was moved to /proc/ccs/exception_policy and + /etc/ccs/exception_policy.conf . Other directives were moved to + /proc/ccs/domain_policy and /etc/ccs/domain_policy.conf . + + @ Remove syaoran filesystem. + + Since "allow_create"/"allow_mkdir"/"allow_mkfifo"/"allow_mksock"/ + "allow_mkblock"/"allow_mkchar"/"allow_chmod"/"allow_chown"/"allow_chgrp" + can restrict mode changes and owner/group changes, there is no need to + restrict these changes at filesystem level. + + Thus, I removed syaoran filesystem. + + @ Reduce spinlocks. + + Until now, TOMOYO was using own list for detecting memory leak. But as + kernel 2.6.31 introduced memory leak detection mechanism + ( CONFIG_DEBUG_KMEMLEAK ), TOMOYO no longer needs to use own list. + + I removed the list to reduce use of spinlocks. + + @ Rewrite ccs-patch-2.\*.diff . + + ccs-patch-2.\*.diff was rewritten like LSM hooks. + + @ Don't check "allow_read/write" for open-for-ioctl-only. + + open(pathname, 3) means open for ioctl() only. + Until now, TOMOYO was checking "allow_read/write" for open(pathname, 3). + But since TOMOYO checks "allow_ioctl" for ioctl(), I modified not to + require "allow_read/write" for open(pathname, 3). + + @ Add missing sigqueue() and tgsigqueue() hooks. + + Until now, kill(), tkill(), tgkill() had hooks but sigqueue() and + tgsigqueue() didn't. + + @ Move files from fs/ to security/ccsecurity. + + Config menu section changed from "File systems" to "Security options". + + Kernel config symbols changed from CONFIG_SAKURA CONFIG_TOMOYO + CONFIG_SYAORAN to CONFIG_CCSECURITY . + + @ Add global PID to audit logs. + + ccs-queryd was using domainname for reaching the domain which the process + belongs to, but the domain could be deleted while ccs-queryd is handling + policy violation. If the domain is deleted, ccs-queryd no longer can + reach the domain by domainname. Thus, ccs-queryd now uses PID for + reaching the domain which the process belongs to. + + Kernel 2.6.24 introduced PID namespace. The PID in access logs generated + by a process inside a container is useless for ccs-queryd for reaching + the domain which the process belongs to. + + Thus, I added global PID in audit logs. + + @ Transit to new domain before do_execve() succeeds. + + Permission checks for interpreters and environment variables are + done using new domain. In order to allow ccs-queryd to reach the new + domain via global PID, I reverted "Don't transit to new domain until + do_execve() succeeds." made on 2008/10/07. + +Version 1.7.0 2009/09/03 Feature enhancement release. + +Fix 2009/09/04 + + @ Fix wrong ccs_profile() calls. + + I can't call ccs_profile() for profile existence test because + ccs_profile() never returns NULL. + +Fix 2009/09/06 + + @ Fix wrong error code in ccs_try_alt_exec(). + + ccs_try_alt_exec() was returning ENOMEM when kmalloc() failed. + It needs to return -ENOMEM to fail. + +Fix 2009/09/10 + + @ Do not check umount() permission for mount(MS_MOVE) requests. + + Until 1.6.x , umount() restriction was black listing. In 1.7.0 , it is + white listing. This change caused "mount --move old new" requests to + require "allow_unmount old" permission in addition to + "allow_mount old new --move 0" permission. + But we don't want to allow umount(old) requests when we want to allow + only mount(old, new, MS_MOVE) requests. Thus, I modified not to check + "allow_unmount old" permission for mount(old, new, MS_MOVE) requests. + +Fix 2009/09/11 + + @ Support recursive match operators. + + Until now, ccs_path_matches_pattern() did not support recursive + comparison. Thus, users had to repeat "/\*" when they want to specify + recursively. + + I introduced "\{" and "\}" as repetition operator. + To ensure consistency with TOMOYO's '/'-tokenized pattern matching rules + and "\-" operator, only "/\{dir\}/" sequences (where dir does not contain + '/') is permitted. + +Fix 2009/09/24 + + @ Don't check chmod/chown capability for requests from kernel. + + Until now, ccs_setattr_permission() was inserted in notify_change(). + But notify_change() is also called by requests from kernel (e.g. UnionFS) + and it made difficult to use TOMOYO on UnionFS. + + Thus, I moved ccs_capable() checks from ccs_setattr_permission() to + ccs_chmod_permission() and ccs_chown_permission(), and removed + ccs_setattr_permission(). + +Fix 2009/09/25 + + @ Embed more information into audit logs. + + Until now, /proc/ccs/grant_log /proc/ccs/reject_log /proc/ccs/query were + not printing file's information (e.g. file's uid/gid/mode). + + Recently, users who started using "if" clause expect that the learning + mode automatically adds various conditions like "if task.uid=path1.uid". + + But the profile will become too complicated if I support all possible + conditions. Thus, I added all information which is enough to generate + "if" clause with all possible conditions from audit logs. + + Now, the learning mode got different usage. Users can specify + "CONFIG::learning={ max_entry=0 }" in the profile. All requests which + are not permitted by policy will be sent to /proc/ccs/reject_log with + "mode=learning" header lines. Users can selectively append conditions + and append to the policy using "/usr/sbin/ccs-loadpolicy -d". + The learning mode with "CONFIG::learning={ max_entry=0 }" is almost + the same with the permissive mode, only difference is "mode=learning" + and "mode=permissive". + +Fix 2009/10/05 + + @ Fix size truncation bug at ccs_memcmp(). + + ccs_memcmp() was using "u8" for size parameter by error. Therefore, when + size >= 256 was passed to ccs_memcmp(), it was doing partial comparison + (incorrect result) or read overrun (CPU stall). + + ccs_memcmp() should use "size_t" for size parameter because size of + "struct ccs_condition" may exceed 256 bytes if complicated condition was + given. + +Fix 2009/10/08 + + @ Add CONFIG_CCSECURITY_DEFAULT_LOADER option. + + I made the default policy loader's pathname ( /sbin/ccs-init ) + configurable. + + @ Add CONFIG_CCSECURITY_ALTERNATIVE_TRIGGER option. + + Some environments do not have /sbin/init . In such environments, we need + to use different program's pathname (e.g. /init or /linuxrc ) as + activation trigger. + + Thus, I made the alternative trigger ( /sbin/ccs-start ) configurable. + +Fix 2009/11/02 + + @ Fix buffer contention. + + A permission like + + allow_env PATH if exec.envp["PATH"]="/" + + was not working since I was using the same buffer for both environment + variable's name and value. + +Fix 2009/11/03 + + @ Fix memory leak in ccs_write_address_group_policy(). + + I forgot to call kfree() if same entry was added. + + @ Reduce mutexes. + + I was using mutex_lock()/mutex_unlock() so that I can use + atomic_dec_and_test() for removing an element from a list. + I moved that operation to garbage collector in order to reduce frequency + of mutex_lock()/mutex_unlock() calls. + + @ Escape from nested loops correctly. + + In ccs_read_address_group_policy(), I was escaping from nested loops + correctly. But in ccs_read_path_group_policy() and + ccs_read_number_group_policy(), I wasn't. + + As a result, reading path_group and number_group caused kernel oops + when they were not read atomically. + +Fix 2009/11/06 + + @ Fix incorrect allow_mount audit log. + + Audit log for allow_mount was using decimal format. + It needs to use hexadecimal format. + +Fix 2009/11/09 + + @ Add profile version check. + + To avoid upgrading from TOMOYO 1.6.x to TOMOYO 1.7.x without upgrading + /proc/ccs/profile (which results in not protecting the system at all), + I added a check for PROFILE_VERSION= . + +Version 1.7.1 2009/11/11 Fourth anniversary release. + +Fix 2009/11/13 + + @ Don't use core_initcall() for initializing lock for GC. + + Some kernels call TOMOYO's hooks before processing core_initcall(). + Thus, I can't use core_initcall() for initializing lock for GC. + +Fix 2009/11/18 + + @ Don't check "allow_write" permission for open(O_RDONLY | O_TRUNC). + + Since TOMOYO checks "allow_truncate" permission rather than "allow_write" + permission for O_TRUNC, I need to distinguish open(O_RDONLY | O_TRUNC) + and open(O_RDWR | O_TRUNC). But I made a mistake between TOMOYO 1.7.0 and + 1.7.1 which made it impossible for TOMOYO for kernels 2.6.14 and earlier + to distinguish them. + +Fix 2009/11/27 + + @ Use newly created domain's name for domain creation audit log. + + Since 1.7.0 , /proc/ccs/reject_log was by error using existing domain's + name when auditing newly created domain's "use_profile" line. + +Fix 2009/12/12 + + @ Use rcu_read_lock() for find_task_by_pid(). + + Since kernel 2.6.18 , caller of find_task_by_pid() needs to call + rcu_read_lock() rather than read_lock(&tasklist_lock) because find_pid() + uses RCU primitives but spinlock does not prevent RCU callback if + preemptive RCU ( CONFIG_PREEMPT_RCU or CONFIG_TREE_PREEMPT_RCU ) is + enabled. + +Fix 2009/12/15 + + @ Allow deleting "quota_exceeded" and "transition_failed" entries. + + To notify users of "this domain has too many entries to hold" and "some + process in this domain was not able to perform domain transition", + "quota_exceeded" and "transition_failed" messages are used respectively. + These messages were not deletable. But it is more convenient for users + to be notified again if such events occurred again after tuning policy. + Thus, I made these messages deletable. + +Fix 2009/12/17 + + @ Don't check read permission in ccs_try_alt_exec(). + + While I was trying to remove ccs_execve_list list for GC optimization + between TOMOYO 1.7.0 and 1.7.1 , I made a mistake which made TOMOYO to + check allow_read permission of the programs specified by execute_handler + and denied_execute_handler keywords. + + @ Don't check DAC permission if disabled mode. + + I was checking DAC permissions regarding directory entry modification + operations (e.g. mkdir()) even if mode=disabled . It is a waste of CPU + resource to check DAC permissions when MAC permissions are not checked. + Thus, I modified to skip DAC permission checks if mode=disabled . + +Fix 2009/12/19 + + @ Fix memory leak in ccs_environ(). + + When I fixed a bug that a permission like + + allow_env PATH if exec.envp["PATH"]="/" + + was not working (2009/11/02), I allocated two buffers but only one buffer + was released. + + This bug will trigger OOM killer if environment variable checking is + enabled. + +Fix 2010/01/17 + + @ Use current domain's name for execute_handler audit log. + + Since 1.6.7 , /proc/ccs/grant_log was by error using next domain's name + when auditing current domain's "execute_handler" line. + +Fix 2010/03/02 + + @ Allow domain transition without execve(). + + To be able to split permissions for Apache's CGI programs which are + executed without execve(), I added special domain transition which is + performed by atomically writing '\0'-terminated binary string to + /proc/ccs/.transition interface. For example, a process which belongs to + " /usr/sbin/httpd" domain will transit to + " /usr/sbin/httpd //app=cgi1\040id=10000" domain by atomically + writing "app=cgi1 id=10000" + '\0' to /proc/ccs/.transition using + Apache's ap_hook_handler() functionality. + + Note that '\0'-terminated binary string is converted to TOMOYO's string + inside kernel and prefix "//" is automatically added to the string so + that domainname does not conflict with domainnames created by execve(). + Without this prefix, if " /usr/sbin/sshd /bin/bash" domain is + allowed to open /proc/ccs/.transition for writing and + " /usr/sbin/sshd /bin/bash /usr/bin/passwd" domain is allowed to + access /etc/shadow , /bin/bash will be able to access /etc/shadow by + atomically writing "/usr/bin/passwd" + '\0' to /proc/ccs/.transition . + Allowing /bin/bash to access /etc/shadow is not what people want. + + Permission for this operation is checked by "allow_transit" keyword. + Unlike "allow_execute" keyword, the string parameter for "allow_transit" + keyword does not refer a real file on filesystem's namespace. Therefore, + you can store any combination of parameters like LDAP's DN entry in the + string parameter for "allow_transit" keyword. + +Fix 2010/03/08 + + @ Allow building as loadable kernel module. + + To be able to minimize filesize increment of vmlinux, I made it + possible to compile TOMOYO Linux as loadable kernel module. + Although patching the kernel source and recompiling the kernel are + inevitable, this change will make it easier to enable TOMOYO Linux + when there is a filesize limitation on vmlinux (e.g. embedded systems). + +Fix 2010/03/25 + + @ Fix ccs_get_ipv6_address() bug. + + Since 1.7.0 , ccs_get_ipv6_address() was by error returning address of + "struct list_head ccs_address_list" if memory allocation failed. + As a result, ccs_put_ipv6_address() will modify memory near + "struct list_head ccs_address_list" if memory allocation failed. + +Fix 2010/03/26 + + @ Fix ccs_lport_reserved() bug. + + Since 1.7.0 , ccs_lport_reserved() was by error checking wrong port + number. As a result, "deny_autobind" keyword was not working as expected. + +Version 1.7.2 2010/04/01 Feature enhancement release. + +Fix 2010/04/10 + + @ Fix invalid "struct nameidata" to "struct path" conversion macro. + + Regarding kernels 2.6.24 and earlier, I was converting "struct nameidata" + to "struct path" in caller side so that I can unify the callee function's + parameter type. But it turned out that the macro I used did not follow C + standards and did not work with gcc 4.x . As a result, "allow_pivot_root" + keyword was not working as expected. + +Fix 2010/05/05 + + @ Fix incorrect audit on/off control. + + The grant_log= and reject_log= parameters of CONFIG::misc::env were not + used because I forgot to update request type. As a result, those of + CONFIG::file::execute were used for CONFIG::misc::env . + + Those of CONFIG::file::rewrite were not used because I forgot to update + request type. As a result, those of CONFIG::file::truncate were used for + CONFIG::file::rewrite . + +Fix 2010/05/10 + + @ Fix incorrect out of memory warning. + + Out of memory warnings were not printed in some cases by error. + +Fix 2010/05/27 + + @ Add missing rcu_dereference() for ccs_find_execute_handler(). + + Since 1.7.0 , ccs_find_execute_handler() was by error using + list_for_each_entry() rather than list_for_each_entry_rcu(). + This bug affects only Alpha architecture. + +Fix 2010/06/03 + + @ Fix missing sanity check for "file_pattern". + + Since 1.7.0 , ccs_write_pattern_policy() was by error accepting + invalid pathname. + +Fix 2010/06/09 + + @ Add missing ccs_put_name() in ccs_parse_envp(). + + Since 1.7.0 , ccs_parse_envp() was not calling ccs_put_name() if + environment variable's value ('if exec.envp["name"]="value"' condition) + was invalid. + + @ Add missing NULL check in ccs_condition(). + + Since 1.7.0 , if 'if symlink.target=' part was given against non-file + permissions (e.g. allow_env PATH if symlink.target="/"), it triggered + NULL pointer dereference. + +Fix 2010/10/28 + + @ Fix umount() pathname calculation. + + "mount --bind /path/to/file1 /path/to/file2" is legal. + Therefore, "umount /path/to/file2" is also legal. + Do not automatically append trailing '/' if pathname to be unmounted + does not end with '/'. + + @ Add preserve KABI compatibility option. (2.6 kernels only) + + TOMOYO needs "struct ccs_domain_info *" and "u32" for each + "struct task_struct". But embedding these variables into + "struct task_struct" breaks KABI for prebuilt kernel modules (which + means that you will need to rebuild prebuilt kernel modules). + + Since KABI is commonly used (compared to 5 years ago), asking users to + rebuild kernel modules which are not included in kernel package is no + longer preferable. Therefore, I added a new option that keeps + "struct task_struct" unmodified in order to keep KABI. + + Note that you have to use ccs-patch-2.6.\*.diff which patches + kernel/fork.c in order to use this option. Otherwise, TOMOYO will leak + memory whenever "struct task_struct" is released. + + @ Change directives. + + I removed "allow_" prefix from directives. New directives for files are + prefixed with "file ". For example, "allow_read" changed to "file read", + "allow_ioctl" changed to "file ioctl". New directive for "allow_network + TCP" is "network inet stream", "allow_network UDP" is "network inet + dgram", "allow_network RAW" is "network inet raw". New directive for + "allow_env" is "misc env". New directive for "allow_signal" is "ipc + signal". New directive for "allow_capability" is "capability". These new + directives correspond with keywords used by profile's CONFIG lines. + + I removed "deny_rewrite" and "allow_rewrite" directives and introduced + "file append" directive. Thus, permission for open(O_WRONLY | O_APPEND) + changed from "allow_write" + "allow_rewrite" to "file append". + + I removed "SYS_MOUNT", "SYS_UMOUNT", "SYS_CHROOT", "SYS_KILL", + "SYS_LINK", "SYS_SYMLINK", "SYS_RENAME", "SYS_UNLINK", "SYS_CHMOD", + "SYS_CHOWN", "SYS_IOCTL", "SYS_PIVOT_ROOT" keywords from capabilities + because these permissions can be checked by other directives (e.g. + "file mount", "ipc signal"). + + I also removed "conceal_mount" keyword from capabilities because this + check requires hooks in filesystem part while almost all hooks for + filesystem part have moved to LSM by Linux 2.6.34. + + New directive for "execute_handler" is "task auto_execute_handler", + "denied_execute_handler" is "task denied_execute_handler". + + @ Distinguish send() and recv() operations. + + Until now, it was impossible for UDP and IP sockets to allow either + only sending or only receiving because permissions were aggregated with + "connect" keyword. I broke "connect" keyword into "send" and "recv" + keywords so that you can keep access control for send() operation enabled + when you have to disable access control for recv() operation due to + application breakage by discarding incoming datagram. + + @ Add Unix domain socket restriction support. + + Until now, it was possible to restrict only inet domain sockets (i.e. + TCP/UDP/RAW). I added restriction for Unix domain sockets (i.e. stream/ + dgram/seqpacket). New directive "network unix" is added as well as + "network inet" directive. + + @ Allow specifying multiple permissions in a line. + + Until now, only "allow_read/write" can be specified for combination of + "allow_read" + "allow_write". Now, you can combine other permissions as + long as type of parameters for these permissions is same. For example, + "file read/write/append/execute/unlink/truncate /tmp/file" is correct + but "file read/write/create /tmp/file" is wrong because "file create" + requires create mode whereas "file read" and "file write" do not. + + @ Allow wildcard for execute permission and domainname. + + Until now, to execute programs with temporary names, "aggregator" is + needed. To simplify code, I modified to accept wildcards for execute + permission and domainname. Now, you can directly specify + "file execute /tmp/logrotate.\?\?\?\?\?\?" and use + "/tmp/logrotate.\?\?\?\?\?\?" within domainnames. + + @ Change pathname for non-rename()able filesystems. + + LSM version of TOMOYO wants to use /proc/self/ rather than /proc/$PID/ if + $PID matches current thread's process ID in order to prevent current + thread from accessing other process's information unless needed. + But since procfs can be mounted on various locations (e.g. /proc/ /proc2/ + /p/ /tmp/foo/100/p/ ), LSM version of TOMOYO cannot tell that whether the + numeric part in the string returned by __d_path() represents process ID + or not. + + Therefore, to be able to convert from $PID to self no matter where procfs + is mounted, I changed pathname representations for filesystems which do + not support rename() operation (e.g. proc, sysfs, securityfs). + + Now, "/proc/self/mounts" changed to "proc:/self/mounts" and + "/sys/kernel/security/" changed to "sys:/kernel/security/" and + "/dev/pts/0" changed to "devpts:/0". + + @ Add a new keyword "any" for domain transition control. + + To be able to make it easier to apply auto_execute_handler on each + domain, I added "any" keyword to domain transition control keywords. Now, + "initialize_domain /usr/sbin/sshd" changed to + "initialize_domain /usr/sbin/sshd from any" and + "keep_domain /usr/sbin/sshd /bin/bash" changed to + "keep_domain any from /usr/sbin/sshd /bin/bash". + + "keep_domain /path/to/auto_execute_handler from any" will allow you to + apply auto_execute_handler for any domains without creating domains for + auto_execute_handler. + + @ Change buffering mode for reading policy. + + To be able to read() very very long lines correctly, I changed the way + TOMOYO buffers policy for reading. + + @ Introduce "acl_group" keyword. + + Until now, it was possible to specify only "allow_read" and "allow_env" + keywords in the exception policy. + + Since some operations like "file read/write/append /dev/null" and + "network UDP send/recv @DNS_SERVER 53" are very common and should be + permitted to all domains, I introduced "acl_group" keyword for giving + such permissions. + + For example, specify "acl_group 0 file read/write/append /dev/null" in + the exception policy and specify "use_group 0" from the domains in the + domain policy. + + "ignore_global_allow_read" and "ignore_global_allow_env" directives were + removed from domain policy and "use_group" keyword was added. + + @ Remove "if" and "; set" keyword. + + I removed need for specifying these keyword. + You can simply specify like below. + + file read /etc/shadow task.uid=0 + + @ Remove "file_pattern" keyword. + + I removed "file_pattern" keyword because it is impossible to predefine + all possible pathname patterns. Also, learning pathnames using incomplete + patterns makes it difficult to later replace using "path_group" keyword. + + @ Replace verbose= parameter with statistic interface. + + Since it is noisy if a lot of policy violation messages are printed, + I removed printk(). To be able to check whether policy violation occurred + or not, I introduced /proc/ccs/stat interface which counts number of + policy violations occurred. You can firstly check /proc/ccs/stat and then + check /proc/ccs/reject_log . + + @ Remove global preference. + + I removed global preference in order to make code simpler. + + @ Allow controlling generation of access granted logs for per an entry + basis. + + I added per-entry flag which controls generation of grant logs because + Xen and KVM issues ioctl requests so frequently. For example, + + file ioctl /dev/null 0x5401 grant_log=no + + will suppress /proc/ccs/grant_log even if preference says grant_log=yes . + + file ioctl /dev/null 0x5401 grant_log=yes + + will generate /proc/ccs/grant_log even if preference says grant_log=no . + + file ioctl /dev/null 0x5401 + + will generate /proc/ccs/grant_log only if preference says grant_log=yes . + + This flag is intended for frequently accessed resources like + + file read /var/www/html/\{\*\}/\*.html grant_log=no + + . + + @ Automatically create domain by execve() even if enforcing mode. + + Until now, new domains are not created if the domain was not defined and + current domain is enforcing mode ("CONFIG::file::execute=enforcing"). + + To be able to restrict shell session without using "keep_domain", + I changed to create new domains automatically even if current domain is + enforcing mode. + + @ Replace "task.state" with "auto_domain_transition". + + task.state is difficult to use. Thus, I replaced task.state with + auto_domain_transition which performs domain transition instead of + changing current process's state variables. + + If domain transition failed, current process will be killed by SIGKILL + signal. This should not happen in normal circumstances, for you know the + domain to transit to and thereby you will define the domain beforehand + when you use "auto_domain_transition" keyword. + + @ Replace "allow_transit" with "task manual_domain_transition". + + I changed this directive to specify absolute domainname (e.g. + " /usr/sbin/httpd //app=cgi1\040id=10000") rather than virtual + pathname (e.g. "//app=cgi1\040id=10000") because you know the domain to + transit to and thereby you will define the domain beforehand when you use + "task manual_domain_transition" directive. + + This change allows you to jump to arbitrary domain. + + Note that this change also reverts "Change /proc/ccs/info/self_domain ." + made on 2006/10/24. Now, 'cat < /proc/ccs/info/self_domain' will act like + 'cat /proc/ccs/info/self_domain'. Programs depending on old assumption + need to be updated. + + @ Add "task auto_domain_transition". + + This is similar to "task manual_domain_transition", but is automatically + applied whenever conditions are met. For example, + + task auto_domain_transition //./non-root task.uid!=0 + + will automatically jump to " //./non-root" domain if current + process's UID is not 0 whereas + + task manual_domain_transition //./non-root task.uid!=0 + + will jump to " //./non-root" domain if current process's UID is + not 0 and current process wrote " //./non-root" to + /proc/ccs/self_domain interface. + + If domain transition failed, current process will be killed by SIGKILL + signal. + + @ Optimize for object's size. + + I merged similar code in order to reduce object's filesize. + +Version 1.8.0 2010/11/11 Fifth anniversary release. + +Fix 2010/12/01 + + @ Use same interface for audit logs. + + To be able to perform fine grained filtering by /usr/sbin/ccs-auditd , + I merged /proc/ccs/grant_log and /proc/ccs/reject_log as + /proc/ccs/audit and added granted=yes or granted=no to audit logs. + +Fix 2010/12/17 + + @ Split ccs_null_security into ccs_default_security and ccs_oom_security. + + ccs_null_security is used by preserve KABI compatibility option and is + used for providing default values against threads which have not yet + allocated memory for their security contexts. + + If current thread failed to allocate memory for current thread's security + context, current thread uses ccs_null_security. Since current thread is + allowed to modify current thread's security context, current thread might + modify ccs_null_security which should not be modified for any reason. + + Therefore, I split ccs_null_security into ccs_default_security and + ccs_oom_security and use ccs_oom_security when current thread failed to + allocate memory for current thread's security context. + + Threads which do not share ccs_oom_security are not affected by threads + which share ccs_oom_security. Threads which share ccs_oom_security will + experience temporary inconsistency, but such threads are about to be + killed by SIGKILL signal. + +Fix 2011/01/11 + + @ Use filesystem name for unnamed devices when vfsmount is missing. + + "Change pathname for non-rename()able filesystems." changed to use + "$fsname:" if the filesystem does not support rename() operation and + "dev($major,$minor):" otherwise when vfsmount is missing. But it turned + out that it is useless to use "dev($major,$minor):" for unnamed devices + (filesystems with $major == 0). Thus, I changed to use "$fsname:" rather + than "dev($major,$minor):" for filesystems with $major == 0 when vfsmount + is missing. + +Fix 2011/02/07 + + @ Fix infinite loop bug when reading /proc/ccs/audit or /proc/ccs/query . + + In ccs_flush(), head->r.w[0] holds pointer to string data to be printed. + But head->r.w[0] was updated only when the string data was partially + printed (because head->r.w[0] will be updated by head->r.w[1] later if + completely printed). However, regarding /proc/ccs/audit and + /proc/ccs/query , an additional '\0' is printed after the string data was + completely printed. But if free space for read buffer became 0 before + printing the additional '\0', ccs_flush() was returning without updating + head->r.w[0]. As a result, ccs_flush() forever reprints already printed + string data. + +Fix 2011/03/01 + + @ Run garbage collector without waiting for /proc/ccs/ users. + + Currently TOMOYO holds SRCU lock upon open() and releases it upon close() + because list elements stored in the "struct ccs_io_buffer" instances are + accessed until close() is called. However, such SRCU usage causes lockdep + to complain about leaving the kernel with SRCU lock held. Therefore, + I changed to hold/release SRCU upon each read()/write() by selectively + deferring kfree() by keeping track of the "struct ccs_io_buffer" + instances. + +Fix 2011/03/05 + + @ Support built-in policy configuration. + + To be able to start using enforcing mode from the early stage of boot + sequence, I added support for built-in policy configuration and + activating access control without calling external policy loader program. + + This will be useful for systems where operations which can lead to the + hijacking of the boot sequence are needed before loading the policy. + For example, you can activate immediately after loading the fixed part of + policy which will allow only operations needed for mounting a partition + which contains the variant part of policy and verifying (e.g. running GPG + check) and loading the variant part of policy. Since you can start using + enforcing mode from the beginning, you can reduce the possibility of + hijacking the boot sequence. + +Fix 2011/03/10 + + @ Remove /proc/ccs/meminfo interface. + + Please use /proc/ccs/stat interface instead. + +Fix 2011/03/15 + + @ Pack policy when printing via /proc/ccs/ interface. + + The kernel side is ready for accepting packed input like + + file read/write/execute /path/to/file + + but was using unpacked output like + + file read /path/to/file + file write /path/to/file + file execute /path/to/file + + because most of userland tools were not ready for accepting packed input. + + The advantages of using packed policy are that it makes policy files + smaller and it speeds up loading/saving policy files. + + Since most of userland tools are ready for accepting packed input by now, + I changed to use packed policy for both input and output. + +Fix 2011/03/31 + + @ Fix conditional policy parsing. + + Since exec.realpath= and symlink.target= accept path_group, + symlink.target="@foo" was by error parsed as symlink.target=@foo . + + @ Serialize updating profile's comment line. + + We need to serialize when updating COMMENT= line in /proc/ccs/profile .