<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/security/smack, branch v3.18.62</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v3.18.62</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v3.18.62'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2016-04-14T00:44:38+00:00</updated>
<entry>
<title>security: let security modules use PTRACE_MODE_* with bitmasks</title>
<updated>2016-04-14T00:44:38+00:00</updated>
<author>
<name>Jann Horn</name>
<email>jann@thejh.net</email>
</author>
<published>2016-01-20T23:00:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6050b33fcc3538549cd59a19eb17a4a5fb1e6134'/>
<id>urn:sha1:6050b33fcc3538549cd59a19eb17a4a5fb1e6134</id>
<content type='text'>
[ Upstream commit 3dfb7d8cdbc7ea0c2970450e60818bb3eefbad69 ]

It looks like smack and yama weren't aware that the ptrace mode
can have flags ORed into it - PTRACE_MODE_NOAUDIT until now, but
only for /proc/$pid/stat, and with the PTRACE_MODE_*CREDS patch,
all modes have flags ORed into them.

Signed-off-by: Jann Horn &lt;jann@thejh.net&gt;
Acked-by: Kees Cook &lt;keescook@chromium.org&gt;
Acked-by: Casey Schaufler &lt;casey@schaufler-ca.com&gt;
Cc: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: James Morris &lt;james.l.morris@oracle.com&gt;
Cc: "Serge E. Hallyn" &lt;serge.hallyn@ubuntu.com&gt;
Cc: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
Cc: Andy Lutomirski &lt;luto@kernel.org&gt;
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Cc: Willy Tarreau &lt;w@1wt.eu&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
</content>
</entry>
<entry>
<title>smack: fix possible use after frees in task_security() callers</title>
<updated>2015-03-06T22:52:59+00:00</updated>
<author>
<name>Andrey Ryabinin</name>
<email>a.ryabinin@samsung.com</email>
</author>
<published>2015-01-13T15:52:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3ddf67db2e23d693c506b34fe7d81c7655cf5fcc'/>
<id>urn:sha1:3ddf67db2e23d693c506b34fe7d81c7655cf5fcc</id>
<content type='text'>
commit 6d1cff2a885850b78b40c34777b46cf5da5d1050 upstream.

We hit use after free on dereferncing pointer to task_smack struct in
smk_of_task() called from smack_task_to_inode().

task_security() macro uses task_cred_xxx() to get pointer to the task_smack.
task_cred_xxx() could be used only for non-pointer members of task's
credentials. It cannot be used for pointer members since what they point
to may disapper after dropping RCU read lock.

Mainly task_security() used this way:
	smk_of_task(task_security(p))

Intead of this introduce function smk_of_task_struct() which
takes task_struct as argument and returns pointer to smk_known struct
and do this under RCU read lock.
Bogus task_security() macro is not used anymore, so remove it.

KASan's report for this:

	AddressSanitizer: use after free in smack_task_to_inode+0x50/0x70 at addr c4635600
	=============================================================================
	BUG kmalloc-64 (Tainted: PO): kasan error
	-----------------------------------------------------------------------------

	Disabling lock debugging due to kernel taint
	INFO: Allocated in new_task_smack+0x44/0xd8 age=39 cpu=0 pid=1866
		kmem_cache_alloc_trace+0x88/0x1bc
		new_task_smack+0x44/0xd8
		smack_cred_prepare+0x48/0x21c
		security_prepare_creds+0x44/0x4c
		prepare_creds+0xdc/0x110
		smack_setprocattr+0x104/0x150
		security_setprocattr+0x4c/0x54
		proc_pid_attr_write+0x12c/0x194
		vfs_write+0x1b0/0x370
		SyS_write+0x5c/0x94
		ret_fast_syscall+0x0/0x48
	INFO: Freed in smack_cred_free+0xc4/0xd0 age=27 cpu=0 pid=1564
		kfree+0x270/0x290
		smack_cred_free+0xc4/0xd0
		security_cred_free+0x34/0x3c
		put_cred_rcu+0x58/0xcc
		rcu_process_callbacks+0x738/0x998
		__do_softirq+0x264/0x4cc
		do_softirq+0x94/0xf4
		irq_exit+0xbc/0x120
		handle_IRQ+0x104/0x134
		gic_handle_irq+0x70/0xac
		__irq_svc+0x44/0x78
		_raw_spin_unlock+0x18/0x48
		sync_inodes_sb+0x17c/0x1d8
		sync_filesystem+0xac/0xfc
		vdfs_file_fsync+0x90/0xc0
		vfs_fsync_range+0x74/0x7c
	INFO: Slab 0xd3b23f50 objects=32 used=31 fp=0xc4635600 flags=0x4080
	INFO: Object 0xc4635600 @offset=5632 fp=0x  (null)

	Bytes b4 c46355f0: 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a  ZZZZZZZZZZZZZZZZ
	Object c4635600: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
	Object c4635610: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
	Object c4635620: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
	Object c4635630: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b a5  kkkkkkkkkkkkkkk.
	Redzone c4635640: bb bb bb bb                                      ....
	Padding c46356e8: 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a  ZZZZZZZZZZZZZZZZ
	Padding c46356f8: 5a 5a 5a 5a 5a 5a 5a 5a                          ZZZZZZZZ
	CPU: 5 PID: 834 Comm: launchpad_prelo Tainted: PBO 3.10.30 #1
	Backtrace:
	[&lt;c00233a4&gt;] (dump_backtrace+0x0/0x158) from [&lt;c0023dec&gt;] (show_stack+0x20/0x24)
	 r7:c4634010 r6:d3b23f50 r5:c4635600 r4:d1002140
	[&lt;c0023dcc&gt;] (show_stack+0x0/0x24) from [&lt;c06d6d7c&gt;] (dump_stack+0x20/0x28)
	[&lt;c06d6d5c&gt;] (dump_stack+0x0/0x28) from [&lt;c01c1d50&gt;] (print_trailer+0x124/0x144)
	[&lt;c01c1c2c&gt;] (print_trailer+0x0/0x144) from [&lt;c01c1e88&gt;] (object_err+0x3c/0x44)
	 r7:c4635600 r6:d1002140 r5:d3b23f50 r4:c4635600
	[&lt;c01c1e4c&gt;] (object_err+0x0/0x44) from [&lt;c01cac18&gt;] (kasan_report_error+0x2b8/0x538)
	 r6:d1002140 r5:d3b23f50 r4:c6429cf8 r3:c09e1aa7
	[&lt;c01ca960&gt;] (kasan_report_error+0x0/0x538) from [&lt;c01c9430&gt;] (__asan_load4+0xd4/0xf8)
	[&lt;c01c935c&gt;] (__asan_load4+0x0/0xf8) from [&lt;c031e168&gt;] (smack_task_to_inode+0x50/0x70)
	 r5:c4635600 r4:ca9da000
	[&lt;c031e118&gt;] (smack_task_to_inode+0x0/0x70) from [&lt;c031af64&gt;] (security_task_to_inode+0x3c/0x44)
	 r5:cca25e80 r4:c0ba9780
	[&lt;c031af28&gt;] (security_task_to_inode+0x0/0x44) from [&lt;c023d614&gt;] (pid_revalidate+0x124/0x178)
	 r6:00000000 r5:cca25e80 r4:cbabe3c0 r3:00008124
	[&lt;c023d4f0&gt;] (pid_revalidate+0x0/0x178) from [&lt;c01db98c&gt;] (lookup_fast+0x35c/0x43y4)
	 r9:c6429efc r8:00000101 r7:c079d940 r6:c6429e90 r5:c6429ed8 r4:c83c4148
	[&lt;c01db630&gt;] (lookup_fast+0x0/0x434) from [&lt;c01deec8&gt;] (do_last.isra.24+0x1c0/0x1108)
	[&lt;c01ded08&gt;] (do_last.isra.24+0x0/0x1108) from [&lt;c01dff04&gt;] (path_openat.isra.25+0xf4/0x648)
	[&lt;c01dfe10&gt;] (path_openat.isra.25+0x0/0x648) from [&lt;c01e1458&gt;] (do_filp_open+0x3c/0x88)
	[&lt;c01e141c&gt;] (do_filp_open+0x0/0x88) from [&lt;c01ccb28&gt;] (do_sys_open+0xf0/0x198)
	 r7:00000001 r6:c0ea2180 r5:0000000b r4:00000000
	[&lt;c01cca38&gt;] (do_sys_open+0x0/0x198) from [&lt;c01ccc00&gt;] (SyS_open+0x30/0x34)
	[&lt;c01ccbd0&gt;] (SyS_open+0x0/0x34) from [&lt;c001db80&gt;] (ret_fast_syscall+0x0/0x48)
	Read of size 4 by thread T834:
	Memory state around the buggy address:
	 c4635380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
	 c4635400: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
	 c4635480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
	 c4635500: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc
	 c4635580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
	&gt;c4635600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
	           ^
	 c4635680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
	 c4635700: 00 00 00 00 04 fc fc fc fc fc fc fc fc fc fc fc
	 c4635780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
	 c4635800: 00 00 00 00 00 00 04 fc fc fc fc fc fc fc fc fc
	 c4635880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
	==================================================================

Signed-off-by: Andrey Ryabinin &lt;a.ryabinin@samsung.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security</title>
<updated>2014-10-12T14:13:55+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2014-10-12T14:13:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5e40d331bd72447197f26525f21711c4a265b6a6'/>
<id>urn:sha1:5e40d331bd72447197f26525f21711c4a265b6a6</id>
<content type='text'>
Pull security subsystem updates from James Morris.

Mostly ima, selinux, smack and key handling updates.

* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (65 commits)
  integrity: do zero padding of the key id
  KEYS: output last portion of fingerprint in /proc/keys
  KEYS: strip 'id:' from ca_keyid
  KEYS: use swapped SKID for performing partial matching
  KEYS: Restore partial ID matching functionality for asymmetric keys
  X.509: If available, use the raw subjKeyId to form the key description
  KEYS: handle error code encoded in pointer
  selinux: normalize audit log formatting
  selinux: cleanup error reporting in selinux_nlmsg_perm()
  KEYS: Check hex2bin()'s return when generating an asymmetric key ID
  ima: detect violations for mmaped files
  ima: fix race condition on ima_rdwr_violation_check and process_measurement
  ima: added ima_policy_flag variable
  ima: return an error code from ima_add_boot_aggregate()
  ima: provide 'ima_appraise=log' kernel option
  ima: move keyring initialization to ima_init()
  PKCS#7: Handle PKCS#7 messages that contain no X.509 certs
  PKCS#7: Better handling of unsupported crypto
  KEYS: Overhaul key identification when searching for asymmetric keys
  KEYS: Implement binary asymmetric key ID handling
  ...
</content>
</entry>
<entry>
<title>security: make security_file_set_fowner, f_setown and __f_setown void return</title>
<updated>2014-09-09T20:01:36+00:00</updated>
<author>
<name>Jeff Layton</name>
<email>jlayton@primarydata.com</email>
</author>
<published>2014-08-22T15:27:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e0b93eddfe17dcb7d644eb5d6ad02a86fc41a977'/>
<id>urn:sha1:e0b93eddfe17dcb7d644eb5d6ad02a86fc41a977</id>
<content type='text'>
security_file_set_fowner always returns 0, so make it f_setown and
__f_setown void return functions and fix up the error handling in the
callers.

Cc: linux-security-module@vger.kernel.org
Signed-off-by: Jeff Layton &lt;jlayton@primarydata.com&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>Make Smack operate on smack_known struct where it still used char*</title>
<updated>2014-08-29T17:10:55+00:00</updated>
<author>
<name>Lukasz Pawelczyk</name>
<email>l.pawelczyk@samsung.com</email>
</author>
<published>2014-08-29T15:02:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=21c7eae21a2100a89cfb8cebaf7b770271f32c6e'/>
<id>urn:sha1:21c7eae21a2100a89cfb8cebaf7b770271f32c6e</id>
<content type='text'>
Smack used to use a mix of smack_known struct and char* throughout its
APIs and implementation. This patch unifies the behaviour and makes it
store and operate exclusively on smack_known struct pointers when managing
labels.

Signed-off-by: Lukasz Pawelczyk &lt;l.pawelczyk@samsung.com&gt;

Conflicts:
	security/smack/smack_access.c
	security/smack/smack_lsm.c
</content>
</entry>
<entry>
<title>Fix a bidirectional UDS connect check typo</title>
<updated>2014-08-29T17:10:47+00:00</updated>
<author>
<name>Lukasz Pawelczyk</name>
<email>l.pawelczyk@samsung.com</email>
</author>
<published>2014-08-29T15:02:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d01757904d9deb619e23c9450218829943a46822'/>
<id>urn:sha1:d01757904d9deb619e23c9450218829943a46822</id>
<content type='text'>
The 54e70ec5eb090193b03e69d551fa6771a5a217c4 commit introduced a
bidirectional check that should have checked for mutual WRITE access
between two labels. Due to a typo the second check was incorrect.

Signed-off-by: Lukasz Pawelczyk &lt;l.pawelczyk@samsung.com&gt;
</content>
</entry>
<entry>
<title>Small fixes in comments describing function parameters</title>
<updated>2014-08-29T17:10:36+00:00</updated>
<author>
<name>Lukasz Pawelczyk</name>
<email>l.pawelczyk@samsung.com</email>
</author>
<published>2014-08-29T15:02:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e95ef49b7f8f497bdb529f4cb1fe228e986b3255'/>
<id>urn:sha1:e95ef49b7f8f497bdb529f4cb1fe228e986b3255</id>
<content type='text'>
Signed-off-by: Lukasz Pawelczyk &lt;l.pawelczyk@samsung.com&gt;
</content>
</entry>
<entry>
<title>Smack: Bring-up access mode</title>
<updated>2014-08-28T20:11:56+00:00</updated>
<author>
<name>Casey Schaufler</name>
<email>casey@schaufler-ca.com</email>
</author>
<published>2014-08-27T21:51:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d166c8024d620d654b12834fac354fb4203c6c22'/>
<id>urn:sha1:d166c8024d620d654b12834fac354fb4203c6c22</id>
<content type='text'>
People keep asking me for permissive mode, and I keep saying "no".

Permissive mode is wrong for more reasons than I can enumerate,
but the compelling one is that it's once on, never off.

Nonetheless, there is an argument to be made for running a
process with lots of permissions, logging which are required,
and then locking the process down. There wasn't a way to do
that with Smack, but this provides it.

The notion is that you start out by giving the process an
appropriate Smack label, such as "ATBirds". You create rules
with a wide range of access and the "b" mode. On Tizen it
might be:

	ATBirds	System	rwxalb
	ATBirds	User	rwxalb
	ATBirds	_	rwxalb
	User	ATBirds	wb
	System	ATBirds	wb

Accesses that fail will generate audit records. Accesses
that succeed because of rules marked with a "b" generate
log messages identifying the rule, the program and as much
object information as is convenient.

When the system is properly configured and the programs
brought in line with the labeling scheme the "b" mode can
be removed from the rules. When the system is ready for
production the facility can be configured out.

This provides the developer the convenience of permissive
mode without creating a system that looks like it is
enforcing a policy while it is not.

Signed-off-by: Casey Schaufler &lt;casey@schaufler-ca.com&gt;
</content>
</entry>
<entry>
<title>Smack: Fix setting label on successful file open</title>
<updated>2014-08-25T21:27:28+00:00</updated>
<author>
<name>Marcin Niesluchowski</name>
<email>m.niesluchow@samsung.com</email>
</author>
<published>2014-08-19T12:26:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d83d2c26461d661384676a4eed935d925b0fcc34'/>
<id>urn:sha1:d83d2c26461d661384676a4eed935d925b0fcc34</id>
<content type='text'>
While opening with CAP_MAC_OVERRIDE file label is not set.
Other calls may access it after CAP_MAC_OVERRIDE is dropped from process.

Signed-off-by: Marcin Niesluchowski &lt;m.niesluchow@samsung.com&gt;
</content>
</entry>
<entry>
<title>Smack: remove unneeded NULL-termination from securtity label</title>
<updated>2014-08-08T21:51:19+00:00</updated>
<author>
<name>Konstantin Khlebnikov</name>
<email>k.khlebnikov@samsung.com</email>
</author>
<published>2014-08-07T16:52:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=da1b63566c469bf3e2b24182114422e16b1aa34c'/>
<id>urn:sha1:da1b63566c469bf3e2b24182114422e16b1aa34c</id>
<content type='text'>
Values of extended attributes are stored as binary blobs. NULL-termination
of them isn't required. It just wastes disk space and confuses command-line
tools like getfattr because they have to print that zero byte at the end.

This patch removes terminating zero byte from initial security label in
smack_inode_init_security and cuts it out in function smack_inode_getsecurity
which is used by syscall getxattr. This change seems completely safe, because
function smk_parse_smack ignores everything after first zero byte.

Signed-off-by: Konstantin Khlebnikov &lt;k.khlebnikov@samsung.com&gt;
</content>
</entry>
</feed>
