From cdfae559ea2a797d56c2dbe2c669cd9a65ef1982 Mon Sep 17 00:00:00 2001 From: Kevin Mihelich Date: Sun, 28 May 2017 03:42:47 +0000 Subject: [PATCH] core/linux-veyron to 3.14.0-25 --- .../0001-use-chromiumos-mwifiex-drivers.patch | 6 +- ...reate-AP-and-P2P-interfaces-upon-dri.patch | 6 +- ...kchip-add-handler-for-usb-uart-funct.patch | 6 +- ...fix-brcmfmac-oops-and-race-condition.patch | 6 +- ...-random-simplify-loop-in-random_read.patch | 98 ++++++ ...om-introduce-getrandom-2-system-call.patch | 330 ++++++++++++++++++ .../0007-ARM-wire-up-getrandom-syscall.patch | 54 +++ ...ll-getrandom-2-callers-when-pool-is-.patch | 33 ++ core/linux-veyron/PKGBUILD | 28 +- core/linux-veyron/config | 5 +- 10 files changed, 551 insertions(+), 21 deletions(-) create mode 100644 core/linux-veyron/0005-random-simplify-loop-in-random_read.patch create mode 100644 core/linux-veyron/0006-random-introduce-getrandom-2-system-call.patch create mode 100644 core/linux-veyron/0007-ARM-wire-up-getrandom-syscall.patch create mode 100644 core/linux-veyron/0008-random-Wake-up-all-getrandom-2-callers-when-pool-is-.patch diff --git a/core/linux-veyron/0001-use-chromiumos-mwifiex-drivers.patch b/core/linux-veyron/0001-use-chromiumos-mwifiex-drivers.patch index 96855fd36..789ae9b98 100644 --- a/core/linux-veyron/0001-use-chromiumos-mwifiex-drivers.patch +++ b/core/linux-veyron/0001-use-chromiumos-mwifiex-drivers.patch @@ -1,7 +1,7 @@ -From 478d6783c5483f4d2201bc0a91f92e7880df11cc Mon Sep 17 00:00:00 2001 +From 10831906a80232a8796cf055518e3b35f558d8a4 Mon Sep 17 00:00:00 2001 From: Kevin Mihelich Date: Thu, 25 Jun 2015 20:35:06 -0600 -Subject: [PATCH 1/4] use chromiumos mwifiex drivers +Subject: [PATCH 1/8] use chromiumos mwifiex drivers Signed-off-by: Kevin Mihelich --- @@ -26,5 +26,5 @@ index f9ee413f6e71..9686025923c5 100644 #define BLOCK_MODE 1 -- -2.11.0 +2.13.0 diff --git a/core/linux-veyron/0002-mwifiex-do-not-create-AP-and-P2P-interfaces-upon-dri.patch b/core/linux-veyron/0002-mwifiex-do-not-create-AP-and-P2P-interfaces-upon-dri.patch index fee1a4e49..590c0d3d8 100644 --- a/core/linux-veyron/0002-mwifiex-do-not-create-AP-and-P2P-interfaces-upon-dri.patch +++ b/core/linux-veyron/0002-mwifiex-do-not-create-AP-and-P2P-interfaces-upon-dri.patch @@ -1,7 +1,7 @@ -From 4cc0eec56f57f137ac6ae3b91dbafa5541811644 Mon Sep 17 00:00:00 2001 +From 41ebe011fa78d21a9984d13609cc0144d6b5d76d Mon Sep 17 00:00:00 2001 From: Bing Zhao Date: Mon, 19 Aug 2013 16:10:21 -0700 -Subject: [PATCH 2/4] mwifiex: do not create AP and P2P interfaces upon driver +Subject: [PATCH 2/8] mwifiex: do not create AP and P2P interfaces upon driver loading Bug 60747 - 1286:2044 [Microsoft Surface Pro] @@ -62,5 +62,5 @@ index e43afc127119..587f4ae4818d 100644 mwifiex_drv_get_driver_version(adapter, fmt, sizeof(fmt) - 1); -- -2.11.0 +2.13.0 diff --git a/core/linux-veyron/0003-UPSTREAM-soc-rockchip-add-handler-for-usb-uart-funct.patch b/core/linux-veyron/0003-UPSTREAM-soc-rockchip-add-handler-for-usb-uart-funct.patch index 673814bb1..b280be3de 100644 --- a/core/linux-veyron/0003-UPSTREAM-soc-rockchip-add-handler-for-usb-uart-funct.patch +++ b/core/linux-veyron/0003-UPSTREAM-soc-rockchip-add-handler-for-usb-uart-funct.patch @@ -1,7 +1,7 @@ -From b4ba27c1b3ba7e1405b9e3a12ff29f01f2e6d4ff Mon Sep 17 00:00:00 2001 +From 3ee1dc42158527bd04c4ec455dde2803521ab870 Mon Sep 17 00:00:00 2001 From: Heiko Stuebner Date: Mon, 25 May 2015 16:38:07 +0200 -Subject: [PATCH 3/4] UPSTREAM: soc/rockchip: add handler for usb-uart +Subject: [PATCH 3/8] UPSTREAM: soc/rockchip: add handler for usb-uart functionality Some Rockchip SoCs provide the possibility to use a usb-phy as passthru for @@ -302,5 +302,5 @@ index 000000000000..97754f9fc7f2 +} +early_param("rockchip.usb_uart", rockchip_usb_uart); -- -2.11.0 +2.13.0 diff --git a/core/linux-veyron/0004-fix-brcmfmac-oops-and-race-condition.patch b/core/linux-veyron/0004-fix-brcmfmac-oops-and-race-condition.patch index 74e941001..3eebdb6a6 100644 --- a/core/linux-veyron/0004-fix-brcmfmac-oops-and-race-condition.patch +++ b/core/linux-veyron/0004-fix-brcmfmac-oops-and-race-condition.patch @@ -1,7 +1,7 @@ -From e9d25d3d9e86de0ff89e9d9f9d32f97205e2afab Mon Sep 17 00:00:00 2001 +From fcb6c288ea38ea7ee02b9b33b02d45a55017ac18 Mon Sep 17 00:00:00 2001 From: Kevin Mihelich Date: Thu, 2 Jul 2015 17:48:41 -0600 -Subject: [PATCH 4/4] fix brcmfmac oops and race condition +Subject: [PATCH 4/8] fix brcmfmac oops and race condition This fixes a potential null pointer dereference by checking if null before freeing the vif struct. @@ -89,5 +89,5 @@ index 05d40426b85b..7006d19fb8d1 100644 /* -- -2.11.0 +2.13.0 diff --git a/core/linux-veyron/0005-random-simplify-loop-in-random_read.patch b/core/linux-veyron/0005-random-simplify-loop-in-random_read.patch new file mode 100644 index 000000000..9938212e5 --- /dev/null +++ b/core/linux-veyron/0005-random-simplify-loop-in-random_read.patch @@ -0,0 +1,98 @@ +From d9b2000fed21f7ed990ffe7dc0b26834242e6fce Mon Sep 17 00:00:00 2001 +From: Greg Price +Date: Fri, 29 Nov 2013 15:02:33 -0500 +Subject: [PATCH 5/8] random: simplify loop in random_read + +The loop condition never changes until just before a break, so we +might as well write it as a constant. Also since a996996dd75a +("random: drop weird m_time/a_time manipulation") we don't do anything +after the loop finishes, so the 'break's might as well return +directly. Some other simplifications. + +There should be no change in behavior introduced by this commit. + +Signed-off-by: Greg Price +Signed-off-by: "Theodore Ts'o" +--- + drivers/char/random.c | 57 ++++++++++++++++----------------------------------- + 1 file changed, 18 insertions(+), 39 deletions(-) + +diff --git a/drivers/char/random.c b/drivers/char/random.c +index 8757d727116f..d9e8504894ee 100644 +--- a/drivers/char/random.c ++++ b/drivers/char/random.c +@@ -1287,53 +1287,32 @@ void rand_initialize_disk(struct gendisk *disk) + static ssize_t + random_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) + { +- ssize_t n, retval = 0, count = 0; ++ ssize_t n; + + if (nbytes == 0) + return 0; + +- while (nbytes > 0) { +- n = nbytes; +- if (n > SEC_XFER_SIZE) +- n = SEC_XFER_SIZE; +- +- n = extract_entropy_user(&blocking_pool, buf, n); +- +- if (n < 0) { +- retval = n; +- break; +- } +- ++ nbytes = min_t(size_t, nbytes, SEC_XFER_SIZE); ++ while (1) { ++ n = extract_entropy_user(&blocking_pool, buf, nbytes); ++ if (n < 0) ++ return n; + trace_random_read(n*8, (nbytes-n)*8, + ENTROPY_BITS(&blocking_pool), + ENTROPY_BITS(&input_pool)); +- +- if (n == 0) { +- if (file->f_flags & O_NONBLOCK) { +- retval = -EAGAIN; +- break; +- } +- +- wait_event_interruptible(random_read_wait, +- ENTROPY_BITS(&input_pool) >= +- random_read_wakeup_thresh); +- +- if (signal_pending(current)) { +- retval = -ERESTARTSYS; +- break; +- } +- +- continue; +- } +- +- count += n; +- buf += n; +- nbytes -= n; +- break; /* This break makes the device work */ +- /* like a named pipe */ ++ if (n > 0) ++ return n; ++ /* Pool is (near) empty. Maybe wait and retry. */ ++ ++ if (file->f_flags & O_NONBLOCK) ++ return -EAGAIN; ++ ++ wait_event_interruptible(random_read_wait, ++ ENTROPY_BITS(&input_pool) >= ++ random_read_wakeup_thresh); ++ if (signal_pending(current)) ++ return -ERESTARTSYS; + } +- +- return (count ? count : retval); + } + + static ssize_t +-- +2.13.0 + diff --git a/core/linux-veyron/0006-random-introduce-getrandom-2-system-call.patch b/core/linux-veyron/0006-random-introduce-getrandom-2-system-call.patch new file mode 100644 index 000000000..0d607f6a2 --- /dev/null +++ b/core/linux-veyron/0006-random-introduce-getrandom-2-system-call.patch @@ -0,0 +1,330 @@ +From 8edd5ca21ae45a59021a259932dd22a4281e155e Mon Sep 17 00:00:00 2001 +From: Theodore Ts'o +Date: Thu, 17 Jul 2014 04:13:05 -0400 +Subject: [PATCH 6/8] random: introduce getrandom(2) system call + +The getrandom(2) system call was requested by the LibreSSL Portable +developers. It is analoguous to the getentropy(2) system call in +OpenBSD. + +The rationale of this system call is to provide resiliance against +file descriptor exhaustion attacks, where the attacker consumes all +available file descriptors, forcing the use of the fallback code where +/dev/[u]random is not available. Since the fallback code is often not +well-tested, it is better to eliminate this potential failure mode +entirely. + +The other feature provided by this new system call is the ability to +request randomness from the /dev/urandom entropy pool, but to block +until at least 128 bits of entropy has been accumulated in the +/dev/urandom entropy pool. Historically, the emphasis in the +/dev/urandom development has been to ensure that urandom pool is +initialized as quickly as possible after system boot, and preferably +before the init scripts start execution. + +This is because changing /dev/urandom reads to block represents an +interface change that could potentially break userspace which is not +acceptable. In practice, on most x86 desktop and server systems, in +general the entropy pool can be initialized before it is needed (and +in modern kernels, we will printk a warning message if not). However, +on an embedded system, this may not be the case. And so with this new +interface, we can provide the functionality of blocking until the +urandom pool has been initialized. Any userspace program which uses +this new functionality must take care to assure that if it is used +during the boot process, that it will not cause the init scripts or +other portions of the system startup to hang indefinitely. + +SYNOPSIS + #include + + int getrandom(void *buf, size_t buflen, unsigned int flags); + +DESCRIPTION + The system call getrandom() fills the buffer pointed to by buf + with up to buflen random bytes which can be used to seed user + space random number generators (i.e., DRBG's) or for other + cryptographic uses. It should not be used for Monte Carlo + simulations or other programs/algorithms which are doing + probabilistic sampling. + + If the GRND_RANDOM flags bit is set, then draw from the + /dev/random pool instead of the /dev/urandom pool. The + /dev/random pool is limited based on the entropy that can be + obtained from environmental noise, so if there is insufficient + entropy, the requested number of bytes may not be returned. + If there is no entropy available at all, getrandom(2) will + either block, or return an error with errno set to EAGAIN if + the GRND_NONBLOCK bit is set in flags. + + If the GRND_RANDOM bit is not set, then the /dev/urandom pool + will be used. Unlike using read(2) to fetch data from + /dev/urandom, if the urandom pool has not been sufficiently + initialized, getrandom(2) will block (or return -1 with the + errno set to EAGAIN if the GRND_NONBLOCK bit is set in flags). + + The getentropy(2) system call in OpenBSD can be emulated using + the following function: + + int getentropy(void *buf, size_t buflen) + { + int ret; + + if (buflen > 256) + goto failure; + ret = getrandom(buf, buflen, 0); + if (ret < 0) + return ret; + if (ret == buflen) + return 0; + failure: + errno = EIO; + return -1; + } + +RETURN VALUE + On success, the number of bytes that was filled in the buf is + returned. This may not be all the bytes requested by the + caller via buflen if insufficient entropy was present in the + /dev/random pool, or if the system call was interrupted by a + signal. + + On error, -1 is returned, and errno is set appropriately. + +ERRORS + EINVAL An invalid flag was passed to getrandom(2) + + EFAULT buf is outside the accessible address space. + + EAGAIN The requested entropy was not available, and + getentropy(2) would have blocked if the + GRND_NONBLOCK flag was not set. + + EINTR While blocked waiting for entropy, the call was + interrupted by a signal handler; see the description + of how interrupted read(2) calls on "slow" devices + are handled with and without the SA_RESTART flag + in the signal(7) man page. + +NOTES + For small requests (buflen <= 256) getrandom(2) will not + return EINTR when reading from the urandom pool once the + entropy pool has been initialized, and it will return all of + the bytes that have been requested. This is the recommended + way to use getrandom(2), and is designed for compatibility + with OpenBSD's getentropy() system call. + + However, if you are using GRND_RANDOM, then getrandom(2) may + block until the entropy accounting determines that sufficient + environmental noise has been gathered such that getrandom(2) + will be operating as a NRBG instead of a DRBG for those people + who are working in the NIST SP 800-90 regime. Since it may + block for a long time, these guarantees do *not* apply. The + user may want to interrupt a hanging process using a signal, + so blocking until all of the requested bytes are returned + would be unfriendly. + + For this reason, the user of getrandom(2) MUST always check + the return value, in case it returns some error, or if fewer + bytes than requested was returned. In the case of + !GRND_RANDOM and small request, the latter should never + happen, but the careful userspace code (and all crypto code + should be careful) should check for this anyway! + + Finally, unless you are doing long-term key generation (and + perhaps not even then), you probably shouldn't be using + GRND_RANDOM. The cryptographic algorithms used for + /dev/urandom are quite conservative, and so should be + sufficient for all purposes. The disadvantage of GRND_RANDOM + is that it can block, and the increased complexity required to + deal with partially fulfilled getrandom(2) requests. + +Signed-off-by: Theodore Ts'o +Reviewed-by: Zach Brown +--- + arch/x86/syscalls/syscall_32.tbl | 1 + + arch/x86/syscalls/syscall_64.tbl | 1 + + drivers/char/random.c | 40 ++++++++++++++++++++++++++++++++++++--- + include/linux/syscalls.h | 3 +++ + include/uapi/asm-generic/unistd.h | 4 +++- + include/uapi/linux/random.h | 9 +++++++++ + 6 files changed, 54 insertions(+), 4 deletions(-) + +diff --git a/arch/x86/syscalls/syscall_32.tbl b/arch/x86/syscalls/syscall_32.tbl +index 3934f1ed30ac..7af3997e33de 100644 +--- a/arch/x86/syscalls/syscall_32.tbl ++++ b/arch/x86/syscalls/syscall_32.tbl +@@ -361,3 +361,4 @@ + 352 i386 sched_getattr sys_sched_getattr + 353 i386 renameat2 + 354 i386 seccomp sys_seccomp ++355 i386 getrandom sys_getrandom +diff --git a/arch/x86/syscalls/syscall_64.tbl b/arch/x86/syscalls/syscall_64.tbl +index a1e46ce5cacf..0251a2c7486b 100644 +--- a/arch/x86/syscalls/syscall_64.tbl ++++ b/arch/x86/syscalls/syscall_64.tbl +@@ -324,6 +324,7 @@ + 315 common sched_getattr sys_sched_getattr + 316 common renameat2 + 317 common seccomp sys_seccomp ++318 common getrandom sys_getrandom + + # + # x32-specific system call numbers start at 512 to avoid cache impact +diff --git a/drivers/char/random.c b/drivers/char/random.c +index d9e8504894ee..08279b68375a 100644 +--- a/drivers/char/random.c ++++ b/drivers/char/random.c +@@ -257,6 +257,8 @@ + #include + #include + #include ++#include ++#include + + #include + #include +@@ -401,6 +403,7 @@ static struct poolinfo { + */ + static DECLARE_WAIT_QUEUE_HEAD(random_read_wait); + static DECLARE_WAIT_QUEUE_HEAD(random_write_wait); ++static DECLARE_WAIT_QUEUE_HEAD(urandom_init_wait); + static struct fasync_struct *fasync; + + /********************************************************************** +@@ -657,6 +660,7 @@ retry: + r->entropy_total = 0; + if (r == &nonblocking_pool) { + prandom_reseed_late(); ++ wake_up_interruptible(&urandom_init_wait); + pr_notice("random: %s pool is initialized\n", r->name); + } + } +@@ -1137,13 +1141,14 @@ static ssize_t extract_entropy_user(struct entropy_store *r, void __user *buf, + { + ssize_t ret = 0, i; + __u8 tmp[EXTRACT_SIZE]; ++ int large_request = (nbytes > 256); + + trace_extract_entropy_user(r->name, nbytes, ENTROPY_BITS(r), _RET_IP_); + xfer_secondary_pool(r, nbytes); + nbytes = account(r, nbytes, 0, 0); + + while (nbytes) { +- if (need_resched()) { ++ if (large_request && need_resched()) { + if (signal_pending(current)) { + if (ret == 0) + ret = -ERESTARTSYS; +@@ -1285,7 +1290,7 @@ void rand_initialize_disk(struct gendisk *disk) + #endif + + static ssize_t +-random_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) ++_random_read(int nonblock, char __user *buf, size_t nbytes) + { + ssize_t n; + +@@ -1304,7 +1309,7 @@ random_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) + return n; + /* Pool is (near) empty. Maybe wait and retry. */ + +- if (file->f_flags & O_NONBLOCK) ++ if (nonblock) + return -EAGAIN; + + wait_event_interruptible(random_read_wait, +@@ -1316,6 +1321,12 @@ random_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) + } + + static ssize_t ++random_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) ++{ ++ return _random_read(file->f_flags & O_NONBLOCK, buf, nbytes); ++} ++ ++static ssize_t + urandom_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) + { + int ret; +@@ -1456,6 +1467,29 @@ const struct file_operations urandom_fops = { + .llseek = noop_llseek, + }; + ++SYSCALL_DEFINE3(getrandom, char __user *, buf, size_t, count, ++ unsigned int, flags) ++{ ++ if (flags & ~(GRND_NONBLOCK|GRND_RANDOM)) ++ return -EINVAL; ++ ++ if (count > INT_MAX) ++ count = INT_MAX; ++ ++ if (flags & GRND_RANDOM) ++ return _random_read(flags & GRND_NONBLOCK, buf, count); ++ ++ if (unlikely(nonblocking_pool.initialized == 0)) { ++ if (flags & GRND_NONBLOCK) ++ return -EAGAIN; ++ wait_event_interruptible(urandom_init_wait, ++ nonblocking_pool.initialized); ++ if (signal_pending(current)) ++ return -ERESTARTSYS; ++ } ++ return urandom_read(NULL, buf, count, NULL); ++} ++ + /*************************************************************** + * Random UUID interface + * +diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h +index 029b012aa075..07f6e749fef6 100644 +--- a/include/linux/syscalls.h ++++ b/include/linux/syscalls.h +@@ -855,6 +855,9 @@ asmlinkage long sys_process_vm_writev(pid_t pid, + asmlinkage long sys_kcmp(pid_t pid1, pid_t pid2, int type, + unsigned long idx1, unsigned long idx2); + asmlinkage long sys_finit_module(int fd, const char __user *uargs, int flags); ++asmlinkage long sys_getrandom(char __user *buf, size_t count, ++ unsigned int flags); ++ + asmlinkage long sys_seccomp(unsigned int op, unsigned int flags, + const char __user *uargs); + #endif +diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h +index de5ce24594dd..fb7247c39241 100644 +--- a/include/uapi/asm-generic/unistd.h ++++ b/include/uapi/asm-generic/unistd.h +@@ -703,9 +703,11 @@ __SYSCALL(__NR_seccomp, sys_seccomp) + + #define __NR_seccomp 277 + __SYSCALL(__NR_seccomp, sys_seccomp) ++#define __NR_getrandom 278 ++__SYSCALL(__NR_getrandom, sys_getrandom) + + #undef __NR_syscalls +-#define __NR_syscalls 278 ++#define __NR_syscalls 279 + + /* + * All syscalls below here should go away really, +diff --git a/include/uapi/linux/random.h b/include/uapi/linux/random.h +index fff3528a078f..3f93d1695e7f 100644 +--- a/include/uapi/linux/random.h ++++ b/include/uapi/linux/random.h +@@ -40,4 +40,13 @@ struct rand_pool_info { + __u32 buf[0]; + }; + ++/* ++ * Flags for getrandom(2) ++ * ++ * GRND_NONBLOCK Don't block and return EAGAIN instead ++ * GRND_RANDOM Use the /dev/random pool instead of /dev/urandom ++ */ ++#define GRND_NONBLOCK 0x0001 ++#define GRND_RANDOM 0x0002 ++ + #endif /* _UAPI_LINUX_RANDOM_H */ +-- +2.13.0 + diff --git a/core/linux-veyron/0007-ARM-wire-up-getrandom-syscall.patch b/core/linux-veyron/0007-ARM-wire-up-getrandom-syscall.patch new file mode 100644 index 000000000..a2a50f56a --- /dev/null +++ b/core/linux-veyron/0007-ARM-wire-up-getrandom-syscall.patch @@ -0,0 +1,54 @@ +From 46b29aab711516c739cdc549a044649e13a940f3 Mon Sep 17 00:00:00 2001 +From: Russell King +Date: Fri, 8 Aug 2014 10:56:34 +0100 +Subject: [PATCH 7/8] ARM: wire up getrandom syscall + +Add the new getrandom syscall for ARM. + +Signed-off-by: Russell King +--- + arch/arm/include/asm/unistd.h | 2 +- + arch/arm/include/uapi/asm/unistd.h | 1 + + arch/arm/kernel/calls.S | 1 + + 3 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h +index acabef1a75df..fb77fcd2690b 100644 +--- a/arch/arm/include/asm/unistd.h ++++ b/arch/arm/include/asm/unistd.h +@@ -15,7 +15,7 @@ + + #include + +-#define __NR_syscalls (384) ++#define __NR_syscalls (388) + #define __ARM_NR_cmpxchg (__ARM_NR_BASE+0x00fff0) + + #define __ARCH_WANT_STAT64 +diff --git a/arch/arm/include/uapi/asm/unistd.h b/arch/arm/include/uapi/asm/unistd.h +index 86f5789d23c8..ea9d2ff2befc 100644 +--- a/arch/arm/include/uapi/asm/unistd.h ++++ b/arch/arm/include/uapi/asm/unistd.h +@@ -412,6 +412,7 @@ + #define __NR_renameat2 (__NR_SYSCALL_BASE+382) + */ + #define __NR_seccomp (__NR_SYSCALL_BASE+383) ++#define __NR_getrandom (__NR_SYSCALL_BASE+384) + + /* + * This may need to be greater than __NR_last_syscall+1 in order to +diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S +index e40999adf68b..078929db42f2 100644 +--- a/arch/arm/kernel/calls.S ++++ b/arch/arm/kernel/calls.S +@@ -393,6 +393,7 @@ + CALL(sys_sched_getattr) + CALL(sys_ni_syscall) /* sys_renameat2 */ + CALL(sys_seccomp) ++ CALL(sys_getrandom) + #ifndef syscalls_counted + .equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls + #define syscalls_counted +-- +2.13.0 + diff --git a/core/linux-veyron/0008-random-Wake-up-all-getrandom-2-callers-when-pool-is-.patch b/core/linux-veyron/0008-random-Wake-up-all-getrandom-2-callers-when-pool-is-.patch new file mode 100644 index 000000000..1d9353440 --- /dev/null +++ b/core/linux-veyron/0008-random-Wake-up-all-getrandom-2-callers-when-pool-is-.patch @@ -0,0 +1,33 @@ +From 453c642ae1fb71de220b25b6289d58a4730038a1 Mon Sep 17 00:00:00 2001 +From: Herbert Xu +Date: Thu, 21 May 2015 16:19:54 +0800 +Subject: [PATCH 8/8] random: Wake up all getrandom(2) callers when pool is + ready + +If more than one application invokes getrandom(2) before the pool +is ready, then all bar one will be stuck forever because we use +wake_up_interruptible which wakes up a single task. + +This patch replaces it with wake_up_all. + +Signed-off-by: Herbert Xu +--- + drivers/char/random.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/char/random.c b/drivers/char/random.c +index 08279b68375a..b907271d68e1 100644 +--- a/drivers/char/random.c ++++ b/drivers/char/random.c +@@ -660,7 +660,7 @@ retry: + r->entropy_total = 0; + if (r == &nonblocking_pool) { + prandom_reseed_late(); +- wake_up_interruptible(&urandom_init_wait); ++ wake_up_all(&urandom_init_wait); + pr_notice("random: %s pool is initialized\n", r->name); + } + } +-- +2.13.0 + diff --git a/core/linux-veyron/PKGBUILD b/core/linux-veyron/PKGBUILD index 4dafd718c..6ac9087de 100644 --- a/core/linux-veyron/PKGBUILD +++ b/core/linux-veyron/PKGBUILD @@ -7,8 +7,8 @@ pkgbase=linux-veyron _kernelname=${pkgbase#linux} _desc="Veyron Chromebooks" pkgver=3.14.0 -pkgrel=24 -_commit=b093583dda7e0be315bbf9aea4a697d1e20cd58e +pkgrel=25 +_commit=6eea2a7519579f14f1837e977068ea28ad98fd77 arch=('armv7h') url="https://chromium.googlesource.com/chromiumos/third_party/kernel/+/chromeos-3.14" license=('GPL2') @@ -21,6 +21,10 @@ source=("https://chromium.googlesource.com/chromiumos/third_party/kernel/+archiv '0002-mwifiex-do-not-create-AP-and-P2P-interfaces-upon-dri.patch' '0003-UPSTREAM-soc-rockchip-add-handler-for-usb-uart-funct.patch' '0004-fix-brcmfmac-oops-and-race-condition.patch' + '0005-random-simplify-loop-in-random_read.patch' + '0006-random-introduce-getrandom-2-system-call.patch' + '0007-ARM-wire-up-getrandom-syscall.patch' + '0008-random-Wake-up-all-getrandom-2-callers-when-pool-is-.patch' 'config' 'kernel.its' 'kernel.keyblock' @@ -28,16 +32,20 @@ source=("https://chromium.googlesource.com/chromiumos/third_party/kernel/+archiv 'cmdline' 'brcmfmac4354-sdio.txt' '99-veyron-brcm.rules') -md5sums=('8f71593561163c049a487751fab6dc8e' +md5sums=('224c737defe8db8a21c303c9633d6412' 'bda543cb5943eac34e16d12911f3ee99' '5e2d7cd74de07d13052de99411c13a2f' '1534c1dbfe5df35a5634072f7b912840' '20f8931f3795e5226829d48c3d470334' - '3ac01cf94902936a732bf3f0df79eb43' - '2e3d4a2634a76ff37f3dae94a7ced6a3' - '8aaa2709e1c9466c71c6646643eb4edf' - '40351745df5a762edd50a50386df71ee' - 'f1860967a80286449b23439ad51dc7b0' + '7457f68b1ed40592f0057a9e3d5e546c' + '78efe11e59a48fe1576f195e9fe27e92' + '0a6e16818f4f1294b4d7bebad952c46f' + 'f4e19254d5d8e4b427134e535c728186' + '997b5f5e7cafc3547888fc82b40d5d01' + '7c5c670779e324f1ce9286f7cd605160' + '21cde62bbc6dc0e9dd1b3f6771a1438d' + '605c38eb7c016d8283db3d3801067202' + '9aac49e2baa96444f9314d02035a90a7' '761d2e8cef38584b9e2f478e8096e458' '61c5ff73c136ed07a7aadbf58db3d96a' '584777ae88bce2c5659960151b64c7d8' @@ -50,6 +58,10 @@ prepare() { git apply 0002-mwifiex-do-not-create-AP-and-P2P-interfaces-upon-dri.patch git apply 0003-UPSTREAM-soc-rockchip-add-handler-for-usb-uart-funct.patch git apply 0004-fix-brcmfmac-oops-and-race-condition.patch + git apply 0005-random-simplify-loop-in-random_read.patch + git apply 0006-random-introduce-getrandom-2-system-call.patch + git apply 0007-ARM-wire-up-getrandom-syscall.patch + git apply 0008-random-Wake-up-all-getrandom-2-callers-when-pool-is-.patch cp config .config diff --git a/core/linux-veyron/config b/core/linux-veyron/config index 831406edb..fea95593c 100644 --- a/core/linux-veyron/config +++ b/core/linux-veyron/config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 3.14.0-24 Kernel Configuration +# Linux/arm 3.14.0-25 Kernel Configuration # CONFIG_ARM=y CONFIG_ARM_HAS_SG_CHAIN=y @@ -1138,6 +1138,8 @@ CONFIG_BT_HCIUART_3WIRE=y # CONFIG_BT_HCIUART_INTEL is not set # CONFIG_BT_HCIUART_BCM is not set # CONFIG_BT_HCIUART_QCA is not set +# CONFIG_BT_HCIUART_AG6XX is not set +# CONFIG_BT_HCIUART_MRVL is not set CONFIG_BT_HCIBCM203X=m CONFIG_BT_HCIBPA10X=m CONFIG_BT_HCIBFUSB=m @@ -4311,6 +4313,7 @@ CONFIG_SECURITY_PATH=y # CONFIG_SECURITY_APPARMOR is not set # CONFIG_SECURITY_YAMA is not set # CONFIG_SECURITY_CHROMIUMOS is not set +# CONFIG_SECURITY_CHROMIUMOS_DEVICE_JAIL is not set # CONFIG_IMA is not set # CONFIG_EVM is not set CONFIG_DEFAULT_SECURITY_DAC=y