aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* crypto: crc32 - Add ARM64 CRC32 hw accelerated moduleYazen Ghannam2017-12-213-0/+282
| | | | | | | | | | | | | | | | This module registers a crc32 algorithm and a crc32c algorithm that use the optional CRC32 and CRC32C instructions in ARMv8. Tested on AMD Seattle. Improvement compared to crc32c-generic algorithm: TCRYPT CRC32C speed test shows ~450% speedup. Simple dd write tests to btrfs filesystem show ~30% speedup. Signed-off-by: Yazen Ghannam <yazen.ghannam@linaro.org> Acked-by: Steve Capper <steve.capper@linaro.org> Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* ANDROID: binder: Remove obsolete proc waitqueue.Martijn Coenen2017-12-211-3/+0
| | | | | | | It was no longer being used. Change-Id: I7fc42b76f688a459ad990f59fbd7006b96bb91a6 Signed-off-by: Martijn Coenen <maco@android.com>
* defconfig: regenMister Oyster2017-12-191-4/+3
|
* UPSTREAM: fscrypt: lock mutex before checking for bounce page poolEric Biggers2017-12-192-10/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fscrypt_initialize(), which allocates the global bounce page pool when an encrypted file is first accessed, uses "double-checked locking" to try to avoid locking fscrypt_init_mutex. However, it doesn't use any memory barriers, so it's theoretically possible for a thread to observe a bounce page pool which has not been fully initialized. This is a classic bug with "double-checked locking". While "only a theoretical issue" in the latest kernel, in pre-4.8 kernels the pointer that was checked was not even the last to be initialized, so it was easily possible for a crash (NULL pointer dereference) to happen. This was changed only incidentally by the large refactor to use fs/crypto/. Solve both problems in a trivial way that can easily be backported: just always take the mutex. It's theoretically less efficient, but it shouldn't be noticeable in practice as the mutex is only acquired very briefly once per encrypted file. Later I'd like to make this use a helper macro like DO_ONCE(). However, DO_ONCE() runs in atomic context, so we'd need to add a new macro that allows blocking. Cc: stable@vger.kernel.org # v4.1+ Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> (cherry-picked from commit a0b3bc855374c50b5ea85273553485af48caf2f7 and fixed up for android-3.18) Change-Id: I18c7231af7de2319883934d2e36ea54e1eb44466 Signed-off-by: Eric Biggers <ebiggers@google.com>
* defconfig: enable CGROUP_FREEZERMister Oyster2017-12-191-1/+1
|
* firmware_class: Tie exporting caching routines with CONFIG_CACHE_FWAjay Dudani2017-12-191-0/+2
| | | | | | | | | | ARCH=um kernels seems to be stricter about this than ARCH=arm64 kernels, export cache_firmware & uncache_firmware routines only when CONFIG_CACHE_FW is enabled. Bug: 38289596 Change-Id: Ib3bd9b0ede9b6f1a08b5e0e51d117cc43153795f Signed-off-by: Ajay Dudani <adudani@google.com>
* firmware_class: make firmware caching configurableAjay Dudani2017-12-192-5/+12
| | | | | | | | | | Because firmware caching generates uevent messages that are sent over a netlink socket, it can prevent suspend on many platforms. It's also not always useful, so make it a configurable option. Bug: 38289596 Change-Id: I1c62227129590f564b127de6dbcaf0001b2c22ad Signed-off-by: Ajay Dudani <adudani@google.com>
* mtk: videox&systracker: fix memset-transposed-args warningsMister Oyster2017-12-182-3/+3
|
* log: Initial dmesg pruningNathan Chancellor2017-12-188-9/+9
| | | | | | | | | These are all of the annoying messages on just the stock kernel... More to follow in future patches! Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Mister Oyster <oysterized@gmail.com>
* Makefile: Enable ld fix for cortex-a53 errata 843419Rohit Vaswani2017-12-181-0/+3
| | | | | | | | Enable the linker flag --fix-cortex-a53-843419 for ARM Cortex-A53 Errata 843419 Change-Id: I03e7be05eb96c4708c9791b4efbb7d4831ef5704 Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
* compiler.h: add support for malloc attributeRasmus Villemoes2017-12-182-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gcc as far back as at least 3.04 documents the function attribute __malloc__. Add a shorthand for attaching that to a function declaration. This was also suggested by Andi Kleen way back in 2002 [1], but didn't get applied, perhaps because gcc at that time generated the exact same code with and without this attribute. This attribute tells the compiler that the return value (if non-NULL) can be assumed not to alias any other valid pointers at the time of the call. Please note that the documentation for a range of gcc versions (starting from around 4.7) contained a somewhat confusing and self-contradicting text: The malloc attribute is used to tell the compiler that a function may be treated as if any non-NULL pointer it returns cannot alias any other pointer valid when the function returns and *that the memory has undefined content*. [...] Standard functions with this property include malloc and *calloc*. (emphasis mine). The intended meaning has later been clarified [2]: This tells the compiler that a function is malloc-like, i.e., that the pointer P returned by the function cannot alias any other pointer valid when the function returns, and moreover no pointers to valid objects occur in any storage addressed by P. What this means is that we can apply the attribute to kmalloc and friends, and it is ok for the returned memory to have well-defined contents (__GFP_ZERO). But it is not ok to apply it to kmemdup(), nor to other functions which both allocate and possibly initialize the memory with existing pointers. So unless someone is doing something pretty perverted kstrdup() should also be a fine candidate. [1] http://thread.gmane.org/gmane.linux.kernel/57172 [2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56955 Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Cc: Christoph Lameter <cl@linux.com> Cc: Pekka Enberg <penberg@kernel.org> Cc: David Rientjes <rientjes@google.com> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> Cc: Andi Kleen <ak@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* compiler-gcc: disable -ftracer for __noclone functionsPaolo Bonzini2017-12-181-1/+1
| | | | | | | | | | | | | | | | | | | | -ftracer can duplicate asm blocks causing compilation to fail in noclone functions. For example, KVM declares a global variable in an asm like asm("2: ... \n .pushsection data \n .global vmx_return \n vmx_return: .long 2b"); and -ftracer causes a double declaration. Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Michal Marek <mmarek@suse.cz> Cc: stable@vger.kernel.org Cc: kvm@vger.kernel.org Reported-by: Linda Walsh <lkml@tlinx.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* mm: page_alloc: add kasan hooks on alloc and free pathsAndrey Ryabinin2017-12-186-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add kernel address sanitizer hooks to mark allocated page's addresses as accessible in corresponding shadow region. Mark freed pages as inaccessible. Signed-off-by: Andrey Ryabinin <a.ryabinin@samsung.com> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: Konstantin Serebryany <kcc@google.com> Cc: Dmitry Chernenkov <dmitryc@google.com> Signed-off-by: Andrey Konovalov <adech.fo@gmail.com> Cc: Yuri Gribov <tetra2005@gmail.com> Cc: Konstantin Khlebnikov <koct9i@gmail.com> Cc: Sasha Levin <sasha.levin@oracle.com> Cc: Christoph Lameter <cl@linux.com> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> Cc: Dave Hansen <dave.hansen@intel.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: Ingo Molnar <mingo@elte.hu> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Christoph Lameter <cl@linux.com> Cc: Pekka Enberg <penberg@kernel.org> Cc: David Rientjes <rientjes@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* compiler-gcc.h: use "proved" instead of "proofed"Benjamin Peterson2017-12-181-1/+1
| | | | | | | Link: http://lkml.kernel.org/r/1477894241.1103202.772260161.1B0A5995@webmail.messagingengine.com Signed-off-by: Benjamin Peterson <bp@benjamin.pe> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* compiler-gcc.h: neateningJoe Perches2017-12-181-40/+45
| | | | | | | | | | | | | | | | | | | | | | - Move the inline and noinline blocks together - Comment neatening - Alignment of __attribute__ uses - Consistent naming of __must_be_array macro argument - Multiline macro neatening Signed-off-by: Joe Perches <joe@perches.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: Michal Marek <mmarek@suse.cz> Cc: Segher Boessenkool <segher@kernel.crashing.org> Cc: Sasha Levin <levinsasha928@gmail.com> Cc: Anton Blanchard <anton@samba.org> Cc: Alan Modra <amodra@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* compiler: introduce __alias(symbol) shortcutAndrey Ryabinin2017-12-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | To be consistent with other compiler attributes introduce __alias(symbol) macro expanding into __attribute__((alias(#symbol))) Signed-off-by: Andrey Ryabinin <a.ryabinin@samsung.com> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: Konstantin Serebryany <kcc@google.com> Cc: Dmitry Chernenkov <dmitryc@google.com> Signed-off-by: Andrey Konovalov <adech.fo@gmail.com> Cc: Yuri Gribov <tetra2005@gmail.com> Cc: Konstantin Khlebnikov <koct9i@gmail.com> Cc: Sasha Levin <sasha.levin@oracle.com> Cc: Christoph Lameter <cl@linux.com> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> Cc: Dave Hansen <dave.hansen@intel.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: Ingo Molnar <mingo@elte.hu> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Christoph Lameter <cl@linux.com> Cc: Pekka Enberg <penberg@kernel.org> Cc: David Rientjes <rientjes@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* lib: make memzero_explicit more robust against dead store eliminationDaniel Borkmann2017-12-184-2/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In commit 0b053c951829 ("lib: memzero_explicit: use barrier instead of OPTIMIZER_HIDE_VAR"), we made memzero_explicit() more robust in case LTO would decide to inline memzero_explicit() and eventually find out it could be elimiated as dead store. While using barrier() works well for the case of gcc, recent efforts from LLVMLinux people suggest to use llvm as an alternative to gcc, and there, Stephan found in a simple stand-alone user space example that llvm could nevertheless optimize and thus elimitate the memset(). A similar issue has been observed in the referenced llvm bug report, which is regarded as not-a-bug. Based on some experiments, icc is a bit special on its own, while it doesn't seem to eliminate the memset(), it could do so with an own implementation, and then result in similar findings as with llvm. The fix in this patch now works for all three compilers (also tested with more aggressive optimization levels). Arguably, in the current kernel tree it's more of a theoretical issue, but imho, it's better to be pedantic about it. It's clearly visible with gcc/llvm though, with the below code: if we would have used barrier() only here, llvm would have omitted clearing, not so with barrier_data() variant: static inline void memzero_explicit(void *s, size_t count) { memset(s, 0, count); barrier_data(s); } int main(void) { char buff[20]; memzero_explicit(buff, sizeof(buff)); return 0; } $ gcc -O2 test.c $ gdb a.out (gdb) disassemble main Dump of assembler code for function main: 0x0000000000400400 <+0>: lea -0x28(%rsp),%rax 0x0000000000400405 <+5>: movq $0x0,-0x28(%rsp) 0x000000000040040e <+14>: movq $0x0,-0x20(%rsp) 0x0000000000400417 <+23>: movl $0x0,-0x18(%rsp) 0x000000000040041f <+31>: xor %eax,%eax 0x0000000000400421 <+33>: retq End of assembler dump. $ clang -O2 test.c $ gdb a.out (gdb) disassemble main Dump of assembler code for function main: 0x00000000004004f0 <+0>: xorps %xmm0,%xmm0 0x00000000004004f3 <+3>: movaps %xmm0,-0x18(%rsp) 0x00000000004004f8 <+8>: movl $0x0,-0x8(%rsp) 0x0000000000400500 <+16>: lea -0x18(%rsp),%rax 0x0000000000400505 <+21>: xor %eax,%eax 0x0000000000400507 <+23>: retq End of assembler dump. As gcc, clang, but also icc defines __GNUC__, it's sufficient to define this in compiler-gcc.h only to be picked up. For a fallback or otherwise unsupported compiler, we define it as a barrier. Similarly, for ecc which does not support gcc inline asm. Reference: https://llvm.org/bugs/show_bug.cgi?id=15495 Reported-by: Stephan Mueller <smueller@chronox.de> Tested-by: Stephan Mueller <smueller@chronox.de> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Cc: Theodore Ts'o <tytso@mit.edu> Cc: Stephan Mueller <smueller@chronox.de> Cc: Hannes Frederic Sowa <hannes@stressinduktion.org> Cc: mancha security <mancha1@zoho.com> Cc: Mark Charlebois <charlebm@gmail.com> Cc: Behan Webster <behanw@converseincode.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* Makefile: Fix device not booting with GCC 7.x and aboveZaneZam2017-12-181-0/+3
| | | | | | | | | | | | | | | | | | | | @nathanchance: Filtered from the original commit (https://github.com/zanezam/boeffla-kernel-cm-n51x0/commit/228cc26b4b66ce3c9232eb00faaf95c3b1b3ae3c) I tested all of the flags in the above commit and this is the only one that prevented the phone from booting, with -Os, -O2, and -O3. Without this, the phone will boot to the Google logo, hang for a few seconds, then reboot, and repeat the process. This flag can be read about below. This issue can also be resolved (supposedly) with the -mstrict-align flag, leading me to believe it is something with memory access. I believe this is a better solution though given that ARM handles unaligned access perfectly fine. https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-fstore-merging https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html#index-mstrict-align Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
* Makefile: Disable "unused-constant-variable" warning globallyNathan Chancellor2017-12-181-0/+3
| | | | Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
* Makefile: Disable "format-truncation" warning globallyNathan Chancellor2017-12-181-0/+3
| | | | | | | | | | | This was introduced in GCC 7.x: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wformat-truncation This warning doesn't really make sense in the context of the kernel because there is no way for the values it complains about to be cut off. For example, it complains about a cpu int getting truncated, when in reality it will never be over 7 for this device (octacore). Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
* UPSTREAM: include/linux/mm.h: add PAGE_ALIGNED() helperAndrew Morton2017-12-181-0/+3
| | | | | | | | | | | | | To test whether an address is aligned to PAGE_SIZE. Cc: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com>, Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> (cherry picked from commit 0fa73b86ef0797ca4fde5334117ca0b330f08030) Bug: 36007193 Change-Id: I7e912bb0dbd8c9737fb13c5b48acb54ee39dd5fc
* BACKPORT: arm64: cpuinfo: Missing NULL terminator in compat_hwcap_strJulien Grall2017-12-181-1/+2
| | | | | | | | | | | | | | | | | | | | | | | The loop that browses the array compat_hwcap_str will stop when a NULL is encountered, however NULL is missing at the end of array. This will lead to overrun until a NULL is found somewhere in the following memory. In reality, this works out because the compat_hwcap2_str array tends to follow immediately in memory, and that *is* terminated correctly. Furthermore, the unsigned int compat_elf_hwcap is checked before printing each capability, so we end up doing the right thing because the size of the two arrays is less than 32. Still, this is an obvious mistake and should be fixed. Note for backporting: commit 12d11817eaafa414 ("arm64: Move /proc/cpuinfo handling code") moved this code in v4.4. Prior to that commit, the same change should be made in arch/arm64/kernel/setup.c. Bug: 37430238 Fixes: 44b82b7700d0 "arm64: Fix up /proc/cpuinfo" Cc: <stable@vger.kernel.org> # v3.19+ (but see note above prior to v4.4) Signed-off-by: Julien Grall <julien.grall@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: David Lin <dtwlin@google.com>
* UPSTREAM: USB: iowarrior: fix oops with malicious USB descriptorsBadhri Jagan Sridharan2017-12-181-0/+6
| | | | | | | | | | | | | | | | | | | | commit 4ec0ef3a82125efc36173062a50624550a900ae0 upstream. The iowarrior driver expects at least one valid endpoint. If given malicious descriptors that specify 0 for the number of endpoints, it will crash in the probe function. Ensure there is at least one endpoint on the interface before using it. The full report of this issue can be found here: http://seclists.org/bugtraq/2016/Mar/87 BUG: 28242610 Reported-by: Ralf Spenneberg <ralf@spenneberg.net> Signed-off-by: Josh Boyer <jwboyer@fedoraproject.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com> Change-Id: If5161c23928e9ef77cb3359cba9b36622b1908df
* block: fix wrong error return in elevator_init()Sudip Mukherjee2017-12-181-1/+3
| | | | | | | | | | | | | | | | while compiling integer err was showing as a set but unused variable. elevator_init_fn can be either cfq_init_queue or deadline_init_queue or noop_init_queue. all three of these functions are returning -ENOMEM if they fail to allocate the queue. so we should actually be returning the error code rather than returning 0 always. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Jens Axboe <axboe@fb.com> Signed-off-by: mydongistiny <jaysonedson@gmail.com> Signed-off-by: Harshit Jain <harshitjain6751@gmail.com> Signed-off-by: dev-harsh1998 <harshitjain6751@gmail.com>
* arch/arm64: skip randomization within stackYi-wei Zhao2017-12-181-2/+0
| | | | | | | | | | | | | | It's a WA to make 32-bit dhrystone generate consistent scores during "sustained peformance mode" cts test. Change-Id: Ib146224ff0701899640cbaba649227aba85534a0 Signed-off-by: Yi-wei Zhao <gbjc64@motorola.com> Reviewed-on: https://gerrit.mot.com/902751 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver <sltawvr@motorola.com> Tested-by: Jira Key <jirakey@motorola.com> Reviewed-by: Igor Kovalenko <igork@motorola.com> Submit-Approved: Jira Key <jirakey@motorola.com>
* include/linux/compiler-gcc.h: improve __visible documentationAndrew Morton2017-12-181-1/+4
| | | | | | | Cc: Andi Kleen <andi@firstfloor.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
* include/linux/compiler-gcc.h: hide assume_aligned attribute from sparseRasmus Villemoes2017-12-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | The patch "slab.h: sprinkle __assume_aligned attributes" causes *tons* of whinges if you do 'make C=2' with sparse 0.5.0: CHECK drivers/media/usb/pwc/pwc-if.c include/linux/slab.h:307:43: error: attribute '__assume_aligned__': unknown attribute include/linux/slab.h:308:58: error: attribute '__assume_aligned__': unknown attribute include/linux/slab.h:337:73: error: attribute '__assume_aligned__': unknown attribute include/linux/slab.h:375:74: error: attribute '__assume_aligned__': unknown attribute include/linux/slab.h:378:80: error: attribute '__assume_aligned__': unknown attribute sparse apparently pretends to be gcc >= 4.9, yet isn't prepared to handle all the function attributes supported by those gccs and complains loudly. So hide the definition of __assume_aligned from it (so that the generic one in compiler.h gets used). Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Reported-by: Valdis Kletnieks <Valdis.Kletnieks@vt.edu> Tested-By: Valdis Kletnieks <valdis.kletnieks@vt.edu> Cc: Christopher Li <sparse@chrisli.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
* compiler.h: add support for function attribute assume_alignedRasmus Villemoes2017-12-182-0/+25
| | | | | | | | | | | | | | | | gcc 4.9 added the function attribute assume_aligned, indicating to the caller that the returned pointer may be assumed to have a certain minimal alignment. This is useful if, for example, the return value is passed to memset(). Add a shorthand macro for that. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Cc: Christoph Lameter <cl@linux.com> Cc: David Rientjes <rientjes@google.com> Cc: Pekka Enberg <penberg@kernel.org> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
* compiler-gcc: integrate the various compiler-gcc[34567].h filesJoe Perches2017-12-182-65/+11
| | | | | | | | | | | | | | | | | | | | As gcc major version numbers are going to advance rather rapidly in the future, there's no real value in separate files for each compiler version. Deduplicate some of the macros #defined in each file too. Neaten comments using normal kernel commenting style. Signed-off-by: Joe Perches <joe@perches.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: Michal Marek <mmarek@suse.cz> Cc: Segher Boessenkool <segher@kernel.crashing.org> Cc: Sasha Levin <levinsasha928@gmail.com> Cc: Anton Blanchard <anton@samba.org> Cc: Alan Modra <amodra@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* exfat: do error check for d_splice_alias returnMin Shi2017-12-181-1/+1
| | | | | | | | | | | | | This patch adds error check in case a defect exFAT SD cards is inserted. Change-Id: I3e1e92b168730a947d93f594d9555cfaceef2b6f Signed-off-by: Min Shi <e13386@motorola.com> Reviewed-on: https://gerrit.mot.com/927026 SLTApproved: Slta Waiver <sltawvr@motorola.com> SME-Granted: SME Approvals Granted Reviewed-by: Russell Knize <rknize@motorola.com> Tested-by: Jira Key <jirakey@motorola.com> Submit-Approved: Jira Key <jirakey@motorola.com>
* tune core online/offline statagewangwang12017-12-181-3/+3
| | | | | Change-Id: I3b69e1de05c4f1035c3c47e1075185795fd2ac24 Signed-off-by: Mister Oyster <oysterized@gmail.com>
* met: cleanup remnants of met debug functionsMoyster2017-12-171-328/+0
|
* v4l2: Refactor, fix security bug in compat ioctl32Daniel Mentz2017-12-141-224/+373
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 32-bit compat v4l2 ioctl is implemented based on its 64-bit equivalent. It converts 32-bit data structures into its 64-bit equivalents and needs to provide the data to the 64-bit ioctl in user space memory which is commonly allocated using compat_alloc_user_space(). However, due to how that function is implemented, it can only be called a single time for every syscall invocation. Supposedly to avoid this limitation, the existing code uses a mix of memory from the kernel stack and memory allocated through compat_alloc_user_space(). Under normal circumstances, this would not work, because the 64-bit ioctl expects all pointers to point to user space memory. As a workaround, set_fs(KERNEL_DS) is called to temporarily disable this extra safety check and allow kernel pointers. However, this might introduce a security vulnerability: The result of the 32-bit to 64-bit conversion is writeable by user space because the output buffer has been allocated via compat_alloc_user_space(). A malicious user space process could then manipulate pointers inside this output buffer, and due to the previous set_fs(KERNEL_DS) call, functions like get_user() or put_user() no longer prevent kernel memory access. The new approach is to pre-calculate the total amount of user space memory that is needed, allocate it using compat_alloc_user_space() and then divide up the allocated memory to accommodate all data structures that need to be converted. An alternative approach would have been to retain the union type karg that they allocated on the kernel stack in do_video_ioctl(), copy all data from user space into karg and then back to user space. However, we decided against this approach because it does not align with other compat syscall implementations. Instead, we tried to replicate the get_user/put_user pairs as found in other places in the kernel: if (get_user(clipcount, &up->clipcount) || put_user(clipcount, &kp->clipcount)) return -EFAULT; BUG: 34624167 Change-Id: Ica92695d8ddf60c0a067ea2f833f22a71710932e Signed-off-by: Daniel Mentz <danielmentz@google.com> Reported-by: C0RE Team Signed-off-by: Mister Oyster <oysterized@gmail.com>
* v4l2-compat-ioctl32: Add support for private buffersSatish Kodishala2017-12-142-0/+19
| | | | | | | | Add support for copying length and userptr fields from user space private buffers to kernel space and vice versa. Change-Id: Ia7d41aa312544bb0960670af58623b0dc0435a8a Signed-off-by: Satish Kodishala <skodisha@codeaurora.org>
* UPSTREAM: arm64: compat: Remove leftover variable declarationKevin Brodsky2017-12-141-2/+0
| | | | | | | | | | | | | | | | | | (cherry picked from commit 82d24d114f249d919b918ff8eefde4117db8f088) Commit a1d5ebaf8ccd ("arm64: big-endian: don't treat code as data when copying sigret code") moved the 32-bit sigreturn trampoline code from the aarch32_sigret_code array to kuser32.S. The commit removed the array definition from signal32.c, but not its declaration in signal32.h. Remove the leftover declaration. Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com> Signed-off-by: Mark Salyzyn <salyzyn@android.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Bug: 20045882 Bug: 63737556 Change-Id: Ic8a5f0e367f0ecd5c5ddd9e3885d0285f91cf89e Signed-off-by: Mister Oyster <oysterized@gmail.com>
* arm64: big-endian: don't treat code as data when copying sigret codeMatthew Leach2017-12-144-30/+45
| | | | | | | | | | | | | | | Currently the sigreturn compat code is copied to an offset in the vectors table. When using a BE kernel this data will be stored in the wrong endianess so when returning from a signal on a 32-bit BE system, arbitrary code will be executed. Instead of declaring the code inside a struct and copying that, use the assembler's .byte directives to store the code in the correct endianess regardless of platform endianess. Acked-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Matthew Leach <matthew.leach@arm.com> Signed-off-by: Mister Oyster <oysterized@gmail.com>
* FROMLIST: arm64: Avoid aligning normal memory pointers in __memcpy_{to,from}ioMark Salyzyn2017-12-141-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | (cherry picked from arm64/for-next/core commit 9ca255bf041ddc7698b6906dbd846c0ba64b1fe1) __memcpy_{to,from}io fall back to byte-at-a-time copying if both the source and destination pointers are not 8-byte aligned. Since one of the pointers always points at normal memory, this is unnecessary and detrimental to performance, so only do byte copying until we hit an 8-byte boundary for the device pointer. This change was motivated by performance issues in the pstore driver. On a test platform, measuring probe time for pstore, console buffer size of 1/4MB and pmsg of 1/2MB, was in the 90-107ms region. Change managed to reduce it to 10-25ms, an improvement in boot time. Cc: Kees Cook <keescook@chromium.org> Cc: Anton Vorontsov <anton@enomsg.org> Cc: Tony Luck <tony.luck@intel.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will.deacon@arm.com> Cc: Anton Vorontsov <anton@enomsg.org> Cc: Robin Murphy <robin.murphy@arm.com> Signed-off-by: Mark Salyzyn <salyzyn@android.com> Signed-off-by: Will Deacon <will.deacon@arm.com> Bug: 63716230 Change-Id: I245545e8243a54b44d30fbb0d0c71a9b8a77ef63
* UPSTREAM: arm64: optimize memcpy_{from,to}io() and memset_io()Joonwoo Park2017-12-141-10/+56
| | | | | | | | | | | | | | | | | | (cherry picked from commit 70ddb63a88bfd45eb6abe36e2bf4f8f351a447d7) Optimize memcpy_{from,to}io() and memset_io() by transferring in 64 bit as much as possible with minimized barrier usage. This simplest optimization brings faster throughput compare to current byte-by-byte read and write with barrier in the loop. Code's skeleton is taken from the powerpc. Link: http://lkml.kernel.org/p/20141020133304.GH23751@e104818-lin.cambridge.arm.com Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Reviewed-by: Trilok Soni <tsoni@codeaurora.org> Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org> Signed-off-by: Will Deacon <will.deacon@arm.com> Bug: 63716230 Change-Id: I27a3ecfcdb8d1e80ceac5eb5f71609283e0c901b
* UPSTREAM: arm64: vdso: fix clock_getres for 4GiB-aligned resMark Rutland2017-12-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | (cherry pick from commit c80ed088a519da53f27b798a69748eaabc66aadf) The vdso tries to check for a NULL res pointer in __kernel_clock_getres, but only checks the lower 32 bits as is uses CBZ on the W register the res pointer is held in. Thus, if the res pointer happened to be aligned to a 4GiB boundary, we'd spuriously skip storing the timespec to it, while returning a zero error code to the caller. Prevent this by checking the whole pointer, using CBZ on the X register the res pointer is held in. Fixes: 9031fefde6f2ac1d ("arm64: VDSO support") Signed-off-by: Mark Rutland <mark.rutland@arm.com> Reported-by: Andrew Pinski <apinski@cavium.com> Reported-by: Mark Salyzyn <salyzyn@android.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will.deacon@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com> Bug: 20045882 Bug: 63737556 Change-Id: Iab5449d8515f9d655e792e3d7ce43a8f016fa2a0
* UPSTREAM: arm64: vdso: minor ABI fix for clock_getresNathan Lynch2017-12-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | (cherry picked from commit e1b6b6ce55a0a25c8aa8af019095253b2133a41a) The vdso implementation of clock_getres currently returns 0 (success) whenever a null timespec is provided by the caller, regardless of the clock id supplied. This behavior is incorrect. It should fall back to syscall when an unrecognized clock id is passed, even when the timespec argument is null. This ensures that clock_getres always returns an error for invalid clock ids. Signed-off-by: Nathan Lynch <nathan_lynch@mentor.com> Acked-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Bug: 20045882 Bug: 63737556 Bug: 69626243 Change-Id: I93caac645d807403cab85245a33faf6439c6f3c1 Signed-off-by: Mister Oyster <oysterized@gmail.com>
* arm: don't force DMA_API_DEBUG on arm/arm64Mister Oyster2017-12-142-2/+0
|
* arm: don't force IRQ_DOMAIN_DEBUG on mt67xx archMister Oyster2017-12-143-12/+2
|
* UPSTREAM: crypto: testmgr - fix overlap in chunked tests againArd Biesheuvel2017-12-141-1/+1
| | | | | | | | | | | | | | | | | | | Commit 7e4c7f17cde2 ("crypto: testmgr - avoid overlap in chunked tests") attempted to address a problem in the crypto testmgr code where chunked test cases are copied to memory in a way that results in overlap. However, the fix recreated the exact same issue for other chunked tests, by putting IDX3 within 492 bytes of IDX1, which causes overlap if the first chunk exceeds 492 bytes, which is the case for at least one of the xts(aes) test cases. So increase IDX3 by another 1000 bytes. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit 04b46fbdea5e31ffd745a34fa61269a69ba9f47a) Change-Id: I3c94c77f17c2012400fce9b6d703ec7fda5987c6 Signed-off-by: Eric Biggers <ebiggers@google.com>
* UPSTREAM: crypto: testmgr - avoid overlap in chunked testsArd Biesheuvel2017-12-141-1/+1
| | | | | | | | | | | | The IDXn offsets are chosen such that tap values (which may go up to 255) end up overlapping in the xbuf allocation. In particular, IDX1 and IDX3 are too close together, so update IDX3 to avoid this issue. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit 7e4c7f17cde280079db731636175b1732be7188c) Change-Id: If4a9904d92508a9d97c1faaeef5d31988812ddb8 Signed-off-by: Eric Biggers <ebiggers@google.com>
* UPSTREAM: crypto: testmgr - add chunked test cases for chacha20Ard Biesheuvel2017-12-141-0/+7
| | | | | | | | | | | | We failed to catch a bug in the chacha20 code after porting it to the skcipher API. We would have caught it if any chunked tests had been defined, so define some now so we will catch future regressions. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit 549f64153c354e69fc19534f7d7e867de1992f95) Change-Id: Ic4ebc0feb0c26a1fb06cba49ecbab97a9edb995f Signed-off-by: Eric Biggers <ebiggers@google.com>
* UPSTREAM: crypto: testmgr - Add a longer ChaCha20 test vectorMartin Willi2017-12-141-1/+333
| | | | | | | | | | | | | The AVX2 variant of ChaCha20 is used only for messages with >= 512 bytes length. With the existing test vectors, the implementation could not be tested. Due that lack of such a long official test vector, this one is self-generated using chacha20-generic. Signed-off-by: Martin Willi <martin@strongswan.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit 6692cbc28e88b4cbffaab84b82bfff888c03ed3a) Change-Id: Ibf4d4cb73c25d75177be6c409e6099065ba84796 Signed-off-by: Eric Biggers <ebiggers@google.com>
* UPSTREAM: crypto: testmgr - Add ChaCha20 test vectors from RFC7539Martin Willi2017-12-142-0/+192
| | | | | | | | | | | | | We explicitly set the Initial block Counter by prepending it to the nonce in Little Endian. The same test vector is used for both encryption and decryption, ChaCha20 is a cipher XORing a keystream. Signed-off-by: Martin Willi <martin@strongswan.org> Acked-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit 3590ebf2b4c40aa4b663c4f2b9dfeb0a1e0b8f32) Change-Id: I42d7cf3d01c3fdf94e40132ebbfc2579a547df9c Signed-off-by: Eric Biggers <ebiggers@google.com>
* defconfig: add chacha20_neonMister Oyster2017-12-141-0/+1
|
* UPSTREAM: crypto: arm/chacha20 - implement NEON version based on SSE3 codeArd Biesheuvel2017-12-144-0/+667
| | | | | | | | | | | | This is a straight port to ARM/NEON of the x86 SSE3 implementation of the ChaCha20 stream cipher. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit 8096667273477e735b0072b11a6d617ccee45e5f, fixed merge conflicts in Kconfig and Makefile) Change-Id: Id5d32a41a3ec036b9cffe0b739321eede4c92d0a Signed-off-by: Eric Biggers <ebiggers@google.com>
* BACKPORT: crypto: chacha20 - Export common ChaCha20 helpersMartin Willi2017-12-142-16/+37
| | | | | | | | | | | | | As architecture specific drivers need a software fallback, export a ChaCha20 en-/decryption function together with some helpers in a header file. Signed-off-by: Martin Willi <martin@strongswan.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit 31d7247da57226e847f0f102a10c27c0722c429b, omitted chacha20poly1305.c changes) Change-Id: I044f18bf5b01f10da47ce17d58c3ecd4da941dba Signed-off-by: Eric Biggers <ebiggers@google.com>