Skip to content

Commit 7a1e8b8

Browse files
committed
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
Pull security subsystem updates from James Morris: "Highlights: - TPM core and driver updates/fixes - IPv6 security labeling (CALIPSO) - Lots of Apparmor fixes - Seccomp: remove 2-phase API, close hole where ptrace can change syscall #" * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (156 commits) apparmor: fix SECURITY_APPARMOR_HASH_DEFAULT parameter handling tpm: Add TPM 2.0 support to the Nuvoton i2c driver (NPCT6xx family) tpm: Factor out common startup code tpm: use devm_add_action_or_reset tpm2_i2c_nuvoton: add irq validity check tpm: read burstcount from TPM_STS in one 32-bit transaction tpm: fix byte-order for the value read by tpm2_get_tpm_pt tpm_tis_core: convert max timeouts from msec to jiffies apparmor: fix arg_size computation for when setprocattr is null terminated apparmor: fix oops, validate buffer size in apparmor_setprocattr() apparmor: do not expose kernel stack apparmor: fix module parameters can be changed after policy is locked apparmor: fix oops in profile_unpack() when policy_db is not present apparmor: don't check for vmalloc_addr if kvzalloc() failed apparmor: add missing id bounds check on dfa verification apparmor: allow SYS_CAP_RESOURCE to be sufficient to prlimit another task apparmor: use list_next_entry instead of list_entry_next apparmor: fix refcount race when finding a child profile apparmor: fix ref count leak when profile sha1 hash is read apparmor: check that xindex is in trans_table bounds ...
2 parents a867d73 + 7616ac7 commit 7a1e8b8

126 files changed

Lines changed: 7281 additions & 2131 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Documentation/devicetree/bindings/i2c/trivial-devices.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ national,lm80 Serial Interface ACPI-Compatible Microprocessor System Hardware M
126126
national,lm85 Temperature sensor with integrated fan control
127127
national,lm92 ±0.33°C Accurate, 12-Bit + Sign Temperature Sensor and Thermal Window Comparator with Two-Wire Interface
128128
nuvoton,npct501 i2c trusted platform module (TPM)
129+
nuvoton,npct601 i2c trusted platform module (TPM2)
129130
nxp,pca9556 Octal SMBus and I2C registered interface
130131
nxp,pca9557 8-bit I2C-bus and SMBus I/O port with reset
131132
nxp,pcf8563 Real-time clock/calendar
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Required properties:
2+
- compatible: should be one of the following
3+
"st,st33htpm-spi"
4+
"infineon,slb9670"
5+
"tcg,tpm_tis-spi"
6+
- spi-max-frequency: Maximum SPI frequency (depends on TPMs).
7+
8+
Optional SoC Specific Properties:
9+
- pinctrl-names: Contains only one value - "default".
10+
- pintctrl-0: Specifies the pin control groups used for this controller.
11+
12+
Example (for ARM-based BeagleBoard xM with TPM_TIS on SPI4):
13+
14+
&mcspi4 {
15+
16+
status = "okay";
17+
18+
tpm_tis@0 {
19+
20+
compatible = "tcg,tpm_tis-spi";
21+
22+
spi-max-frequency = <10000000>;
23+
};
24+
};

‎Documentation/devicetree/bindings/vendor-prefixes.txt‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ idt Integrated Device Technologies, Inc.
128128
ifi Ingenieurburo Fur Ic-Technologie (I/F/I)
129129
iom Iomega Corporation
130130
img Imagination Technologies Ltd.
131+
infineon Infineon Technologies
131132
inforce Inforce Computing
132133
ingenic Ingenic Semiconductor
133134
innolux Innolux Corporation
@@ -255,6 +256,7 @@ syna Synaptics Inc.
255256
synology Synology, Inc.
256257
SUNW Sun Microsystems, Inc
257258
tbs TBS Technologies
259+
tcg Trusted Computing Group
258260
tcl Toby Churchill Ltd.
259261
technexion TechNexion
260262
technologic Technologic Systems

‎Documentation/ioctl/ioctl-number.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ Code Seq#(hex) Include File Comments
303303
<mailto:buk@buks.ipn.de>
304304
0xA0 all linux/sdp/sdp.h Industrial Device Project
305305
<mailto:kenji@bitgate.com>
306+
0xA1 0 linux/vtpm_proxy.h TPM Emulator Proxy Driver
306307
0xA2 00-0F arch/tile/include/asm/hardwall.h
307308
0xA3 80-8F Port ACL in development:
308309
<mailto:tlewis@mindspring.com>
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
Virtual TPM Proxy Driver for Linux Containers
2+
3+
Authors: Stefan Berger (IBM)
4+
5+
This document describes the virtual Trusted Platform Module (vTPM)
6+
proxy device driver for Linux containers.
7+
8+
INTRODUCTION
9+
------------
10+
11+
The goal of this work is to provide TPM functionality to each Linux
12+
container. This allows programs to interact with a TPM in a container
13+
the same way they interact with a TPM on the physical system. Each
14+
container gets its own unique, emulated, software TPM.
15+
16+
17+
DESIGN
18+
------
19+
20+
To make an emulated software TPM available to each container, the container
21+
management stack needs to create a device pair consisting of a client TPM
22+
character device /dev/tpmX (with X=0,1,2...) and a 'server side' file
23+
descriptor. The former is moved into the container by creating a character
24+
device with the appropriate major and minor numbers while the file descriptor
25+
is passed to the TPM emulator. Software inside the container can then send
26+
TPM commands using the character device and the emulator will receive the
27+
commands via the file descriptor and use it for sending back responses.
28+
29+
To support this, the virtual TPM proxy driver provides a device /dev/vtpmx
30+
that is used to create device pairs using an ioctl. The ioctl takes as
31+
an input flags for configuring the device. The flags for example indicate
32+
whether TPM 1.2 or TPM 2 functionality is supported by the TPM emulator.
33+
The result of the ioctl are the file descriptor for the 'server side'
34+
as well as the major and minor numbers of the character device that was created.
35+
Besides that the number of the TPM character device is return. If for
36+
example /dev/tpm10 was created, the number (dev_num) 10 is returned.
37+
38+
The following is the data structure of the TPM_PROXY_IOC_NEW_DEV ioctl:
39+
40+
struct vtpm_proxy_new_dev {
41+
__u32 flags; /* input */
42+
__u32 tpm_num; /* output */
43+
__u32 fd; /* output */
44+
__u32 major; /* output */
45+
__u32 minor; /* output */
46+
};
47+
48+
Note that if unsupported flags are passed to the device driver, the ioctl will
49+
fail and errno will be set to EOPNOTSUPP. Similarly, if an unsupported ioctl is
50+
called on the device driver, the ioctl will fail and errno will be set to
51+
ENOTTY.
52+
53+
See /usr/include/linux/vtpm_proxy.h for definitions related to the public interface
54+
of this vTPM device driver.
55+
56+
Once the device has been created, the driver will immediately try to talk
57+
to the TPM. All commands from the driver can be read from the file descriptor
58+
returned by the ioctl. The commands should be responded to immediately.
59+
60+
Depending on the version of TPM the following commands will be sent by the
61+
driver:
62+
63+
- TPM 1.2:
64+
- the driver will send a TPM_Startup command to the TPM emulator
65+
- the driver will send commands to read the command durations and
66+
interface timeouts from the TPM emulator
67+
- TPM 2:
68+
- the driver will send a TPM2_Startup command to the TPM emulator
69+
70+
The TPM device /dev/tpmX will only appear if all of the relevant commands
71+
were responded to properly.

‎MAINTAINERS‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2837,7 +2837,7 @@ F: include/uapi/linux/can/error.h
28372837
F: include/uapi/linux/can/netlink.h
28382838

28392839
CAPABILITIES
2840-
M: Serge Hallyn <serge.hallyn@canonical.com>
2840+
M: Serge Hallyn <serge@hallyn.com>
28412841
L: linux-security-module@vger.kernel.org
28422842
S: Supported
28432843
F: include/linux/capability.h
@@ -10675,7 +10675,7 @@ SMACK SECURITY MODULE
1067510675
M: Casey Schaufler <casey@schaufler-ca.com>
1067610676
L: linux-security-module@vger.kernel.org
1067710677
W: http://schaufler-ca.com
10678-
T: git git://git.gitorious.org/smack-next/kernel.git
10678+
T: git git://github.com/cschaufler/smack-next
1067910679
S: Maintained
1068010680
F: Documentation/security/Smack.txt
1068110681
F: security/smack/

‎arch/arm/kernel/ptrace.c‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -932,18 +932,19 @@ asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno)
932932
{
933933
current_thread_info()->syscall = scno;
934934

935-
/* Do the secure computing check first; failures should be fast. */
935+
if (test_thread_flag(TIF_SYSCALL_TRACE))
936+
tracehook_report_syscall(regs, PTRACE_SYSCALL_ENTER);
937+
938+
/* Do seccomp after ptrace; syscall may have changed. */
936939
#ifdef CONFIG_HAVE_ARCH_SECCOMP_FILTER
937-
if (secure_computing() == -1)
940+
if (secure_computing(NULL) == -1)
938941
return -1;
939942
#else
940943
/* XXX: remove this once OABI gets fixed */
941-
secure_computing_strict(scno);
944+
secure_computing_strict(current_thread_info()->syscall);
942945
#endif
943946

944-
if (test_thread_flag(TIF_SYSCALL_TRACE))
945-
tracehook_report_syscall(regs, PTRACE_SYSCALL_ENTER);
946-
947+
/* Tracer or seccomp may have changed syscall. */
947948
scno = current_thread_info()->syscall;
948949

949950
if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))

‎arch/arm64/kernel/ptrace.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,13 +1347,13 @@ static void tracehook_report_syscall(struct pt_regs *regs,
13471347

13481348
asmlinkage int syscall_trace_enter(struct pt_regs *regs)
13491349
{
1350-
/* Do the secure computing check first; failures should be fast. */
1351-
if (secure_computing() == -1)
1352-
return -1;
1353-
13541350
if (test_thread_flag(TIF_SYSCALL_TRACE))
13551351
tracehook_report_syscall(regs, PTRACE_SYSCALL_ENTER);
13561352

1353+
/* Do the secure computing after ptrace; failures should be fast. */
1354+
if (secure_computing(NULL) == -1)
1355+
return -1;
1356+
13571357
if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
13581358
trace_sys_enter(regs, regs->syscallno);
13591359

‎arch/mips/kernel/ptrace.c‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -888,17 +888,16 @@ long arch_ptrace(struct task_struct *child, long request,
888888
*/
889889
asmlinkage long syscall_trace_enter(struct pt_regs *regs, long syscall)
890890
{
891-
long ret = 0;
892891
user_exit();
893892

894893
current_thread_info()->syscall = syscall;
895894

896-
if (secure_computing() == -1)
897-
return -1;
898-
899895
if (test_thread_flag(TIF_SYSCALL_TRACE) &&
900896
tracehook_report_syscall_entry(regs))
901-
ret = -1;
897+
return -1;
898+
899+
if (secure_computing(NULL) == -1)
900+
return -1;
902901

903902
if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
904903
trace_sys_enter(regs, regs->regs[2]);

‎arch/parisc/kernel/ptrace.c‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,10 +311,6 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
311311

312312
long do_syscall_trace_enter(struct pt_regs *regs)
313313
{
314-
/* Do the secure computing check first. */
315-
if (secure_computing() == -1)
316-
return -1;
317-
318314
if (test_thread_flag(TIF_SYSCALL_TRACE) &&
319315
tracehook_report_syscall_entry(regs)) {
320316
/*
@@ -325,6 +321,11 @@ long do_syscall_trace_enter(struct pt_regs *regs)
325321
regs->gr[20] = -1UL;
326322
goto out;
327323
}
324+
325+
/* Do the secure computing check after ptrace. */
326+
if (secure_computing(NULL) == -1)
327+
return -1;
328+
328329
#ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS
329330
if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
330331
trace_sys_enter(regs, regs->gr[20]);

0 commit comments

Comments
 (0)