mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-06 03:45:24 -04:00
891,391 commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
be7d8de428 |
UPSTREAM: crypto: arm/blake2s - add ARM scalar optimized BLAKE2s
Add an ARM scalar optimized implementation of BLAKE2s. NEON isn't very useful for BLAKE2s because the BLAKE2s block size is too small for NEON to help. Each NEON instruction would depend on the previous one, resulting in poor performance. With scalar instructions, on the other hand, we can take advantage of ARM's "free" rotations (like I did in chacha-scalar-core.S) to get an implementation get runs much faster than the C implementation. Performance results on Cortex-A7 in cycles per byte using the shash API: 4096-byte messages: blake2s-256-arm: 18.8 blake2s-256-generic: 26.0 500-byte messages: blake2s-256-arm: 20.3 blake2s-256-generic: 27.9 100-byte messages: blake2s-256-arm: 29.7 blake2s-256-generic: 39.2 32-byte messages: blake2s-256-arm: 50.6 blake2s-256-generic: 66.2 Except on very short messages, this is still slower than the NEON implementation of BLAKE2b which I've written; that is 14.0, 16.4, 25.8, and 76.1 cpb on 4096, 500, 100, and 32-byte messages, respectively. However, optimized BLAKE2s is useful for cases where BLAKE2s is used instead of BLAKE2b, such as WireGuard. This new implementation is added in the form of a new module blake2s-arm.ko, which is analogous to blake2s-x86_64.ko in that it provides blake2s_compress_arch() for use by the library API as well as optionally register the algorithms with the shash API. Acked-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Eric Biggers <ebiggers@google.com> Tested-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit 5172d322d34c30fb926b29aeb5a064e1fd8a5e13) Bug: 152722841 Bug: 178411248 Change-Id: I0ba7a0ea53518d512ccbe54a56970d6bbe2a32e0 Signed-off-by: Eric Biggers <ebiggers@google.com> |
||
|
|
d63d7c1ee0 |
UPSTREAM: crypto: blake2s - include <linux/bug.h> instead of <asm/bug.h>
Address the following checkpatch warning: WARNING: Use #include <linux/bug.h> instead of <asm/bug.h> Signed-off-by: Eric Biggers <ebiggers@google.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit bbda6e0f1303953c855ee3669655a81b69fbe899) Bug: 152722841 Bug: 178411248 Change-Id: Ib12103873c97387ba59ff897c44a18e4f1e6da3d Signed-off-by: Eric Biggers <ebiggers@google.com> |
||
|
|
b8de6b8e2c |
UPSTREAM: crypto: blake2s - adjust include guard naming
Use the full path in the include guards for the BLAKE2s headers to avoid ambiguity and to match the convention for most files in include/crypto/. Signed-off-by: Eric Biggers <ebiggers@google.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit 8786841bc2020f7f2513a6c74e64912f07b9c0dc) Bug: 152722841 Bug: 178411248 Change-Id: Iea57edbe14c9083ce3d7a77b2c3bd63cd6650e56 Signed-off-by: Eric Biggers <ebiggers@google.com> |
||
|
|
609d9425fa |
UPSTREAM: crypto: blake2s - add comment for blake2s_state fields
The first three fields of 'struct blake2s_state' are used in assembly code, which isn't immediately obvious, so add a comment to this effect. Signed-off-by: Eric Biggers <ebiggers@google.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit 7d87131fadd53a0401b5c078dd64e58c3ea6994c) Bug: 152722841 Bug: 178411248 Change-Id: Iab85ddd350a2db917b247ba8f6e224eba905b747 Signed-off-by: Eric Biggers <ebiggers@google.com> |
||
|
|
32ac79b096 |
UPSTREAM: crypto: blake2s - optimize blake2s initialization
If no key was provided, then don't waste time initializing the block buffer, as its initial contents won't be used. Also, make crypto_blake2s_init() and blake2s() call a single internal function __blake2s_init() which treats the key as optional, rather than conditionally calling blake2s_init() or blake2s_init_key(). This reduces the compiled code size, as previously both blake2s_init() and blake2s_init_key() were being inlined into these two callers, except when the key size passed to blake2s() was a compile-time constant. These optimizations aren't that significant for BLAKE2s. However, the equivalent optimizations will be more significant for BLAKE2b, as everything is twice as big in BLAKE2b. And it's good to keep things consistent rather than making optimizations for BLAKE2b but not BLAKE2s. Signed-off-by: Eric Biggers <ebiggers@google.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit 42ad8cf821f0d8564c393e9ad7d00a1a271d18ae) Bug: 152722841 Bug: 178411248 Change-Id: Id057e0c8a5f0e432f227dc3deaa8997a7cbc0577 Signed-off-by: Eric Biggers <ebiggers@google.com> |
||
|
|
74c75891bd |
BACKPORT: crypto: blake2s - share the "shash" API boilerplate code
Add helper functions for shash implementations of BLAKE2s to include/crypto/internal/blake2s.h, taking advantage of __blake2s_update() and __blake2s_final() that were added by the previous patch to share more code between the library and shash implementations. crypto_blake2s_setkey() and crypto_blake2s_init() are usable as shash_alg::setkey and shash_alg::init directly, while crypto_blake2s_update() and crypto_blake2s_final() take an extra 'blake2s_compress_t' function pointer parameter. This allows the implementation of the compression function to be overridden, which is the only part that optimized implementations really care about. The new functions are inline functions (similar to those in sha1_base.h, sha256_base.h, and sm3_base.h) because this avoids needing to add a new module blake2s_helpers.ko, they aren't *too* long, and this avoids indirect calls which are expensive these days. Note that they can't go in blake2s_generic.ko, as that would require selecting CRYPTO_BLAKE2S from CRYPTO_BLAKE2S_X86, which would cause a recursive dependency. Finally, use these new helper functions in the x86 implementation of BLAKE2s. (This part should be a separate patch, but unfortunately the x86 implementation used the exact same function names like "crypto_blake2s_update()", so it had to be updated at the same time.) Signed-off-by: Eric Biggers <ebiggers@google.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit 8c4a93a1270ddffc7660ae43fa8030ecfe9c06d9) Conflicts: arch/x86/crypto/blake2s-glue.c crypto/blake2s_generic.c (conflict due to this branch not having commit 674f368a952c, "crypto: remove CRYPTO_TFM_RES_BAD_KEY_LEN") Bug: 152722841 Bug: 178411248 Change-Id: I9d23b1897cee81fb1704b6eea14d3dc9b1c80fe0 Signed-off-by: Eric Biggers <ebiggers@google.com> |
||
|
|
8a14e1d839 |
UPSTREAM: crypto: blake2s - move update and final logic to internal/blake2s.h
Move most of blake2s_update() and blake2s_final() into new inline functions __blake2s_update() and __blake2s_final() in include/crypto/internal/blake2s.h so that this logic can be shared by the shash helper functions. This will avoid duplicating this logic between the library and shash implementations. Signed-off-by: Eric Biggers <ebiggers@google.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit 057edc9c8bb2d5ff5b058b521792c392428a0714) Bug: 152722841 Bug: 178411248 Change-Id: Idedf8147914839d5280e5d8eec9013264fbb45f9 Signed-off-by: Eric Biggers <ebiggers@google.com> |
||
|
|
4c7a6f464d |
UPSTREAM: crypto: blake2s - remove unneeded includes
It doesn't make sense for the generic implementation of BLAKE2s to include <crypto/internal/simd.h> and <linux/jump_label.h>, as these are things that would only be useful in an architecture-specific implementation. Remove these unnecessary includes. Acked-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit df412e7efda1e2c5b5fcb06701bba77434cbd1e8) Bug: 152722841 Bug: 178411248 Change-Id: I8bccb9506d235c2b184b9899ee375fdc12d6b10f Signed-off-by: Eric Biggers <ebiggers@google.com> |
||
|
|
7537c64845 |
UPSTREAM: crypto: x86/blake2s - define shash_alg structs using macros
The shash_alg structs for the four variants of BLAKE2s are identical except for the algorithm name, driver name, and digest size. So, avoid code duplication by using a macro to define these structs. Acked-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit 1aa90f4cf034ed4f016a02330820ac0551a6c13c) Bug: 152722841 Bug: 178411248 Change-Id: Ibba710056182a609defca0a53133387153f0f63d Signed-off-by: Eric Biggers <ebiggers@google.com> |
||
|
|
b54930b350 |
UPSTREAM: crypto: blake2s - define shash_alg structs using macros
The shash_alg structs for the four variants of BLAKE2s are identical except for the algorithm name, driver name, and digest size. So, avoid code duplication by using a macro to define these structs. Acked-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit 0d396058f92ae7e5ac62839fed54bc2bba630ab5) Bug: 152722841 Bug: 178411248 Change-Id: I32b3a6c035b18f063ad0e03c43171091ca1490a8 Signed-off-by: Eric Biggers <ebiggers@google.com> |
||
|
|
05e10b45ed |
UPSTREAM: crypto: lib/blake2s - Move selftest prototype into header file
This patch fixes a missing prototype warning on blake2s_selftest. Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit ce0d5d63e897cc7c3a8fd043c7942fc6a78ec6f4) Bug: 152722841 Change-Id: Ieb19048d60f6c9dc36cefda8b09b3d5c95e9118e Signed-off-by: Eric Biggers <ebiggers@google.com> |
||
|
|
29ab2a5781 |
UPSTREAM: crypto: blake2b - Fix clang optimization for ARMv7-M
When building for ARMv7-M, clang-9 or higher tries to unroll some loops,
which ends up confusing the register allocator to the point of generating
rather bad code and using more than the warning limit for stack frames:
warning: stack frame size of 1200 bytes in function 'blake2b_compress' [-Wframe-larger-than=]
Forcing it to not unroll the final loop avoids this problem.
Fixes: 91d689337fe8 ("crypto: blake2b - add blake2b generic implementation")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
(cherry picked from commit 0c0408e86dbe8f44d4b27bf42130e8ac905361d6)
Bug: 178411248
Change-Id: I71ee6df844bdbace9f06342a61322c7494533564
Signed-off-by: Eric Biggers <ebiggers@google.com>
|
||
|
|
27c00daf70 |
UPSTREAM: crypto: blake2b - rename tfm context and _setkey callback
The TFM context can be renamed to a more appropriate name and the local varaibles as well, using 'tctx' which seems to be more common than 'mctx'. The _setkey callback was the last one without the blake2b_ prefix, rename that too. Signed-off-by: David Sterba <dsterba@suse.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit c433a1a8572eceb7c45dd85d93fec6946b71bb72) Bug: 178411248 Change-Id: I8b7dfa5779ee6f76bb7e21572d29df1310705485 Signed-off-by: Eric Biggers <ebiggers@google.com> |
||
|
|
196f7b5134 |
UPSTREAM: crypto: blake2b - merge _update to api callback
Now that there's only one call to blake2b_update, we can merge it to the callback and simplify. The empty input check is split and the rest of code un-indented. Signed-off-by: David Sterba <dsterba@suse.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit 0b4b5f10ac1ffb7f51db1832d189c33955c0d4c1) Bug: 178411248 Change-Id: Ic260edcee45116ac1a9f03f2792fe577a2c629c6 Signed-off-by: Eric Biggers <ebiggers@google.com> |
||
|
|
a623362717 |
UPSTREAM: crypto: blake2b - open code set last block helper
The helper is trival and called once, inlining makes things simpler. There's a comment to tie it back to the idea behind the code. Signed-off-by: David Sterba <dsterba@suse.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit a2e4bdce0f6e69c6cf9e460c4fe158bcc0db351f) Bug: 178411248 Change-Id: Iba1276dfcdb29240206f66bf98902d0e587a590f Signed-off-by: Eric Biggers <ebiggers@google.com> |
||
|
|
00e77739a2 |
UPSTREAM: crypto: blake2b - delete unused structs or members
All the code for param block has been inlined, last_node and outlen from the state are not used or have become redundant due to other code. Remove it. Signed-off-by: David Sterba <dsterba@suse.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit d063d6327e7de18e16e4742579a0ff759c3889fb) Bug: 178411248 Change-Id: Ia7090fe3162495abae29b86f37e53ebf02414fe2 Signed-off-by: Eric Biggers <ebiggers@google.com> |
||
|
|
f03f8096dc |
UPSTREAM: crypto: blake2b - simplify key init
The keyed init writes the key bytes to the input buffer and does an update. We can do that in two ways: fill the buffer and update immediatelly. This is what current blake2b_init_key does. Any other following _update or _final will continue from the updated state. The other way is to write the key and set the number of bytes to process at the next _update or _final, lazy evaluation. Which leads to the the simplified code in this patch. Signed-off-by: David Sterba <dsterba@suse.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit e87e484d60b0da8302b45f27fe32af1cea02c8d2) Bug: 178411248 Change-Id: I90652bb41d252af9503d5976ce32b93e2610debf Signed-off-by: Eric Biggers <ebiggers@google.com> |
||
|
|
fdb0b24608 |
UPSTREAM: crypto: blake2b - merge blake2 init to api callback
The call chain from blake2b_init can be simplified because the param block is effectively zeros, besides the key. - blake2b_init0 zeroes state and sets IV - blake2b_init sets up param block with defaults (key and some 1s) - init with key, write it to the input buffer and recalculate state So the compact way is to zero out the state and initialize index 0 of the state directly with the non-zero values and the key. Signed-off-by: David Sterba <dsterba@suse.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit e374969565472824eba4669dea4a23ad2edb414f) Bug: 178411248 Change-Id: I797e941bf90262f6cf334c100a91e5b90dc00a2c Signed-off-by: Eric Biggers <ebiggers@google.com> |
||
|
|
75973ecd9d |
UPSTREAM: crypto: blake2b - merge _final implementation to callback
blake2b_final is called only once, merge it to the crypto API callback and simplify. This avoids the temporary buffer and swaps the bytes of internal buffer. Signed-off-by: David Sterba <dsterba@suse.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit 086db43b5a2281f7ce7d8a67a171b91e1e8fe0ec) Bug: 178411248 Change-Id: I7c5e2d9d931d463ada7573e66268f7b93a2d40a4 Signed-off-by: Eric Biggers <ebiggers@google.com> |
||
|
|
fbbe069bbb |
BACKPORT: crypto: testmgr - add test vectors for blake2b
Test vectors for blake2b with various digest sizes. As the algorithm is
the same up to the digest calculation, the key and input data length is
distributed in a way that tests all combinanions of the two over the
digest sizes.
Based on the suggestion from Eric, the following input sizes are tested
[0, 1, 7, 15, 64, 247, 256], where blake2b blocksize is 128, so the
padded and the non-padded input buffers are tested.
blake2b-160 blake2b-256 blake2b-384 blake2b-512
---------------------------------------------------
len=0 | klen=0 klen=1 klen=32 klen=64
len=1 | klen=32 klen=64 klen=0 klen=1
len=7 | klen=64 klen=0 klen=1 klen=32
len=15 | klen=1 klen=32 klen=64 klen=0
len=64 | klen=0 klen=1 klen=32 klen=64
len=247 | klen=32 klen=64 klen=0 klen=1
len=256 | klen=64 klen=0 klen=1 klen=32
Where key:
- klen=0: empty key
- klen=1: 1 byte value 0x42, 'B'
- klen=32: first 32 bytes of the default key, sequence 00..1f
- klen=64: default key, sequence 00..3f
The unkeyed vectors are ordered before keyed, as this is required by
testmgr.
CC: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
(cherry picked from commit a1afe27492a408d45421a1812064235691303fa1)
Conflicts:
crypto/testmgr.c
crypto/testmgr.h
(resolved conflicts due to blake2s having been backported already)
Bug: 178411248
Change-Id: I5d6e1c16b7be981f4912264cd67dc1dad20b6bec
Signed-off-by: Eric Biggers <ebiggers@google.com>
|
||
|
|
9cd856934e |
BACKPORT: crypto: blake2b - add blake2b generic implementation
The patch brings support of several BLAKE2 variants (2b with various digest lengths). The keyed digest is supported, using tfm->setkey call. The in-tree user will be btrfs (for checksumming), we're going to use the BLAKE2b-256 variant. The code is reference implementation taken from the official sources and modified in terms of kernel coding style (whitespace, comments, uintXX_t -> uXX types, removed unused prototypes and #ifdefs, removed testing code, changed secure_zero_memory -> memzero_explicit, used own helpers for unaligned reads/writes and rotations). Further changes removed sanity checks of key length or output size, these values are verified in the crypto API callbacks or hardcoded in shash_alg and not exposed to users. Signed-off-by: David Sterba <dsterba@suse.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit 91d689337fe8b7703608a2ec39aae700b99f3933) Conflicts: crypto/Kconfig crypto/Makefile (trivial conflicts due to blake2s having been backported already) Bug: 178411248 Change-Id: Ic4c2314b146434a5842facf56e58d3602bacc7d5 Signed-off-by: Eric Biggers <ebiggers@google.com> |
||
|
|
3e82f8af26 |
UPSTREAM: crypto: blake2s - x86_64 SIMD implementation
These implementations from Samuel Neves support AVX and AVX-512VL. Originally this used AVX-512F, but Skylake thermal throttling made AVX-512VL more attractive and possible to do with negligable difference. Bug: 152722841 Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: Samuel Neves <sneves@dei.uc.pt> Co-developed-by: Samuel Neves <sneves@dei.uc.pt> [ardb: move to arch/x86/crypto, wire into lib/crypto framework] Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: I25f5770976a2681e24a1e762360c2a9900e9a62c |
||
|
|
22bff7a3f6 |
UPSTREAM: crypto: blake2s - implement generic shash driver
Wire up our newly added Blake2s implementation via the shash API. Bug: 152722841 Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: I115c2963e90a1a1d2734865d8a2c2e6df5008537 |
||
|
|
43ec9b95a3 |
UPSTREAM: crypto: testmgr - add test cases for Blake2s
As suggested by Eric for the Blake2b implementation contributed by
David, introduce a set of test vectors for Blake2s covering different
digest and key sizes.
blake2s-128 blake2s-160 blake2s-224 blake2s-256
---------------------------------------------------
len=0 | klen=0 klen=1 klen=16 klen=32
len=1 | klen=16 klen=32 klen=0 klen=1
len=7 | klen=32 klen=0 klen=1 klen=16
len=15 | klen=1 klen=16 klen=32 klen=0
len=64 | klen=0 klen=1 klen=16 klen=32
len=247 | klen=16 klen=32 klen=0 klen=1
len=256 | klen=32 klen=0 klen=1 klen=16
Bug: 152722841
Cc: David Sterba <dsterba@suse.com>
Cc: Eric Biggers <ebiggers@google.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I3476494a9cd5a37a1c539704fa23cf3bb61b444c
|
||
|
|
192edcb3df |
UPSTREAM: crypto: blake2s - generic C library implementation and selftest
The C implementation was originally based on Samuel Neves' public domain reference implementation but has since been heavily modified for the kernel. We're able to do compile-time optimizations by moving some scaffolding around the final function into the header file. Information: https://blake2.net/ Bug: 152722841 Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: Samuel Neves <sneves@dei.uc.pt> Co-developed-by: Samuel Neves <sneves@dei.uc.pt> [ardb: - move from lib/zinc to lib/crypto - remove simd handling - rewrote selftest for better coverage - use fixed digest length for blake2s_hmac() and rename to blake2s256_hmac() ] Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: I009a9fb70d34dcff777e7d21882a59819e2bd137 |
||
|
|
078cebb3f5 |
UPSTREAM: crypto: lib - tidy up lib/crypto Kconfig and Makefile
In preparation of introducing a set of crypto library interfaces, tidy up the Makefile and split off the Kconfig symbols into a separate file. Bug: 152722841 Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit 746b2e024c67aa605ac12d135cd7085a49cf9dc4) Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: Idc1e996e91db5909dd8f1d2d52c1727c2de2b1f6 |
||
|
|
160ab93103 |
ANDROID: ion heap: init ion heaps in subsys_initcall
Some built-in modules will failed to use ion heap to allocate memory if the ion heap drivers are too late to be initialized. To fix this issue, move initialization of ion heap drivers in subsys_initcall() which is more earlier to be called. Bug: 203487618 Signed-off-by: Shuosheng Huang <huangshuosheng@allwinnertech.com> Change-Id: If120225fd6c3b665053857cc9345db4521e76cf8 (cherry picked from commit eb4a5a5dbd5bcc33db06d4515653b7f67a2e927e) |
||
|
|
3dbc1d366e |
UPSTREAM: ovl: simplify file splice
commit 82a763e61e2b601309d696d4fa514c77d64ee1be upstream.
generic_file_splice_read() and iter_file_splice_write() will call back into
f_op->iter_read() and f_op->iter_write() respectively. These already do
the real file lookup and cred override. So the code in ovl_splice_read()
and ovl_splice_write() is redundant.
In addition the ovl_file_accessed() call in ovl_splice_write() is
incorrect, though probably harmless.
Fix by calling generic_file_splice_read() and iter_file_splice_write()
directly.
Bug: 203035944
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
[reported to resolve issues with 1a980b8cbf00 ("ovl: add splice file read write helper")]
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Change-Id: I1b3c7610b27faad8eefa91dead167ceaeb4ff0d8
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
|
||
|
|
5b84549191 |
Merge tag 'android11-5.4.147_r00' android11-5.4
This is the merge of the upstream LTS release of 5.4.147 into the android11-5.4 branch. It contains the following commits: |
||
|
|
0dedfe3f54 |
ANDROID: ABI: update allowed list for galaxy
Leaf changes summary: 1 artifact changed Changed leaf types summary: 0 leaf type changed Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 1 Added function Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable 1 Added function: [A] 'function int regulatory_set_wiphy_regd_sync_rtnl(wiphy*, ieee80211_regdomain*)' Bug: 203121344 Signed-off-by: Mincheol Jeong <mc0115.jeong@samsung.corp-partner.google.com> Change-Id: I5f5c4d14eebbfb5393bce35484ece9c863850ff1 |
||
|
|
008930a84e |
ANDROID: ABI: Update allowed list for QCOM
Leaf changes summary: 1 artifact changed Changed leaf types summary: 0 leaf type changed Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 1 Added function Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable 1 Added function: [A] 'function void __sdhci_set_timeout(sdhci_host*, mmc_command*)' Bug: 203221370 Change-Id: I8ccdd4ceb851675f65a9428f62f563c8905631d0 Signed-off-by: Srinivasarao P <quic_spathi@quicinc.com> |
||
|
|
05cd3c592d |
ANDROID: distribute Module.symvers
Module.symvers contains the exported symbols with additional metadata, which can be used to build kernel modules that use/need them. Bug: 202914651 Signed-off-by: Isaac Chen <ycchen@google.com> Change-Id: Ife00f368723f08bfdbe56cb1737ee328e2749d00 |
||
|
|
6eea8a6d1d |
UPSTREAM: usb: max-3421: Prevent corruption of freed memory
commit b5fdf5c6e6bee35837e160c00ac89327bdad031b upstream.
The MAX-3421 USB driver remembers the state of the USB toggles for a
device/endpoint. To save SPI writes, this was only done when a new
device/endpoint was being used. Unfortunately, if the old device was
removed, this would cause writes to freed memory.
To fix this, a simpler scheme is used. The toggles are read from
hardware when a URB is completed, and the toggles are always written to
hardware when any URB transaction is started. This will cause a few more
SPI transactions, but no causes kernel panics.
Fixes:
|
||
|
|
f625f1b305 |
ANDROID: ABI: Update allowed list for QCOM
Update the android/abi_gki_aarch64_qcom with core API's required by mailbox driver. Bug: 202098265 Change-Id: Id68553d58a8e826d2bb4e129db3dbd81e19050bc Signed-off-by: Venkata Rao Kakani <quic_vkakani@quicinc.com> |
||
|
|
d7aa701af5 |
UPSTREAM: driver core: Prevent warning when removing a device link from unregistered consumer
sysfs_remove_link() causes a warning if the parent directory does not
exist. That can happen if the device link consumer has not been registered.
So do not attempt sysfs_remove_link() in that case.
Fixes: 287905e68dd29 ("driver core: Expose device link details in sysfs")
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: stable@vger.kernel.org # 5.9+
Reviewed-by: Rafael J. Wysocki <rafael@kernel.org>
Link: https://lore.kernel.org/r/20210716114408.17320-2-adrian.hunter@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit e64daad660a0c9ace3acdc57099fffe5ed83f977)
Bug: 187129171
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: Idfa829a1a16960fd4ffd1c2733ae9f11f9123d09
|
||
|
|
2e30052a73 |
UPSTREAM: udp: properly flush normal packet at GRO time
If an UDP packet enters the GRO engine but is not eligible
for aggregation and is not targeting an UDP tunnel,
udp_gro_receive() will not set the flush bit, and packet
could delayed till the next napi flush.
Fix the issue ensuring non GROed packets traverse
skb_gro_flush_final().
Reported-and-tested-by: Matthias Treydte <mt@waldheinz.de>
Fixes: 18f25dc39990 ("udp: skip L4 aggregation for UDP tunnel packets")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit b43c8909be52f2baca8884f967b418a88424494a)
Bug: 187129171
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: Ic240b52b00c04621d0f523c1540e6d4b587ad1cd
|
||
|
|
833c1e231c |
UPSTREAM: net/xfrm/compat: Copy xfrm_spdattr_type_t atributes
The attribute-translator has to take in mind maxtype, that is xfrm_link::nla_max. When it is set, attributes are not of xfrm_attr_type_t. Currently, they can be only XFRMA_SPD_MAX (message XFRM_MSG_NEWSPDINFO), their UABI is the same for 64/32-bit, so just copy them. Thanks to YueHaibing for reporting this: In xfrm_user_rcv_msg_compat() if maxtype is not zero and less than XFRMA_MAX, nlmsg_parse_deprecated() do not initialize attrs array fully. xfrm_xlate32() will access uninit 'attrs[i]' while iterating all attrs array. KASAN: probably user-memory-access in range [0x0000000041b58ab0-0x0000000041b58ab7] CPU: 0 PID: 15799 Comm: syz-executor.2 Tainted: G W 5.14.0-rc1-syzkaller #0 RIP: 0010:nla_type include/net/netlink.h:1130 [inline] RIP: 0010:xfrm_xlate32_attr net/xfrm/xfrm_compat.c:410 [inline] RIP: 0010:xfrm_xlate32 net/xfrm/xfrm_compat.c:532 [inline] RIP: 0010:xfrm_user_rcv_msg_compat+0x5e5/0x1070 net/xfrm/xfrm_compat.c:577 [...] Call Trace: xfrm_user_rcv_msg+0x556/0x8b0 net/xfrm/xfrm_user.c:2774 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2504 xfrm_netlink_rcv+0x6b/0x90 net/xfrm/xfrm_user.c:2824 netlink_unicast_kernel net/netlink/af_netlink.c:1314 [inline] netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1340 netlink_sendmsg+0x86d/0xdb0 net/netlink/af_netlink.c:1929 sock_sendmsg_nosec net/socket.c:702 [inline] Fixes: 5106f4a8acff ("xfrm/compat: Add 32=>64-bit messages translator") Cc: <stable@kernel.org> Reported-by: YueHaibing <yuehaibing@huawei.com> Signed-off-by: Dmitry Safonov <dima@arista.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> (cherry picked from commit 4e9505064f58d1252805952f8547a5b7dbc5c111) Bug: 187129171 Signed-off-by: Connor O'Brien <connoro@google.com> Change-Id: I7a1bb8cd01a518c372f4b17b2363a0c3ce7cd9b4 |
||
|
|
a95d35ae26 |
UPSTREAM: f2fs: Advertise encrypted casefolding in sysfs
Older kernels don't support encryption with casefolding. This adds
the sysfs entry encrypted_casefold to show support for those combined
features. Support for this feature was originally added by
commit 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
Fixes: 7ad08a58bf67 ("f2fs: Handle casefolding with Encryption")
Cc: stable@vger.kernel.org # v5.11+
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Reviewed-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit 4c039d5452691fe80260e4c3dd7b629a095bd0a7)
Bug: 187129171
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: Icc037e5f1b2d14e704c823e73d896cdc0944d100
|
||
|
|
8557d5a891 |
UPSTREAM: loop: Fix missing discard support when using LOOP_CONFIGURE
Without calling loop_config_discard() the discard flag and parameters
aren't set/updated for the loop device and worst-case they could
indicate discard support when it isn't the case (ex: if the
LOOP_SET_STATUS ioctl was used with a different file prior to
LOOP_CONFIGURE).
Cc: <stable@vger.kernel.org> # 5.8.x-
Fixes: 3448914e8cc5 ("loop: Add LOOP_CONFIGURE ioctl")
Signed-off-by: Kristian Klausen <kristian@klausen.dk>
Link: https://lore.kernel.org/r/20210618115157.31452-1-kristian@klausen.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
(cherry picked from commit 2b9ac22b12a266eb4fec246a07b504dd4983b16b)
Bug: 187129171
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: I5dca23cbb70d4951101589efb5384444e443817f
|
||
|
|
d0cca8a1ea |
UPSTREAM: thermal/drivers/sprd: Add missing MODULE_DEVICE_TABLE
MODULE_DEVICE_TABLE is used to extract the device information out of the
driver and builds a table when being compiled. If using this macro,
kernel can find the driver if available when the device is plugged in,
and then loads that driver and initializes the device.
Fixes: 554fdbaf19b18 ("thermal: sprd: Add Spreadtrum thermal driver support")
Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20210512093752.243168-1-zhang.lyra@gmail.com
(cherry picked from commit 4d57fd9aeaa013a245bf1fade81e2c30a5efd491)
Bug: 187129171
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: I4fe064ac629b39494c2d1d99bc9dbf42bdcf6ca6
|
||
|
|
ba83fe23f6 |
UPSTREAM: nvmem: sprd: Fix an error message
'ret' is known to be 0 here.
The expected error status is stored in 'status', so use it instead.
Also change %d in %u, because status is an u32, not a int.
Fixes: 096030e7f449 ("nvmem: sprd: Add Spreadtrum SoCs eFuse support")
Acked-by: Chunyan Zhang <zhang.lyra@gmail.com>
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/5bc44aace2fe7e1c91d8b35c8fe31e7134ceab2c.1620406852.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 20be064ec864086bca7a4eb62c772a397b44afb7)
Bug: 187129171
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: Ia63e64c36f925ecd550fa043f33c36f7ca1fbd27
|
||
|
|
98e9d16b6b |
UPSTREAM: usb: musb: Fix an error message
'ret' is known to be 0 here.
Initialize 'ret' with the expected error code before using it.
Fixes: 0990366bab3c ("usb: musb: Add support for MediaTek musb controller")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/69f514dc7134e3c917cad208e73cc650cb9e2bd6.1620159879.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit d9ff1096a840dddea3d5cfa2149ff7da9f499fb2)
Bug: 187129171
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: I3298b32087ae9e9d40ebc225bae54120b1339a92
|
||
|
|
ace71bcb51 |
UPSTREAM: scsi: ufs: core: Cancel rpm_dev_flush_recheck_work during system suspend
During ufs system suspend, leaving rpm_dev_flush_recheck_work running or pending is risky because concurrency may happen between system suspend/resume and runtime resume routine. Fix this by cancelling rpm_dev_flush_recheck_work synchronously during system suspend. Link: https://lore.kernel.org/r/1619408921-30426-3-git-send-email-cang@codeaurora.org Fixes: 51dd905bd2f6 ("scsi: ufs: Fix WriteBooster flush during runtime suspend") Reviewed-by: Daejun Park <daejun7.park@samsung.com> Signed-off-by: Can Guo <cang@codeaurora.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> (cherry picked from commit 637822e63b79ee8a729f7ba2645a26cf5a524ee4) Bug: 187129171 Signed-off-by: Connor O'Brien <connoro@google.com> Change-Id: Ib808d3d52921fa36142e39a05710d85fec9be053 |
||
|
|
dc5ccc2d9c |
UPSTREAM: scsi: ufs: core: Do not put UFS power into LPM if link is broken
During resume, if link is broken due to AH8 failure, make sure ufshcd_resume() does not put UFS power back into LPM. Link: https://lore.kernel.org/r/1619408921-30426-2-git-send-email-cang@codeaurora.org Fixes: 4db7a2360597 ("scsi: ufs: Fix concurrency of error handler and other error recovery paths") Reviewed-by: Daejun Park <daejun7.park@samsung.com> Signed-off-by: Can Guo <cang@codeaurora.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> (cherry picked from commit 23043dd87b153d02eaf676e752d32429be5e5126) Bug: 187129171 Signed-off-by: Connor O'Brien <connoro@google.com> Change-Id: I4a278b53ca70a5a55a410b1552e7e05751df847c |
||
|
|
5576e5e477 |
UPSTREAM: selinux: add proper NULL termination to the secclass_map permissions
This patch adds the missing NULL termination to the "bpf" and
"perf_event" object class permission lists.
This missing NULL termination should really only affect the tools
under scripts/selinux, with the most important being genheaders.c,
although in practice this has not been an issue on any of my dev/test
systems. If the problem were to manifest itself it would likely
result in bogus permissions added to the end of the object class;
thankfully with no access control checks using these bogus
permissions and no policies defining these permissions the impact
would likely be limited to some noise about undefined permissions
during policy load.
Cc: stable@vger.kernel.org
Fixes:
|
||
|
|
f87a97cd71 |
UPSTREAM: of: property: fw_devlink: do not link ".*,nr-gpios"
[<vendor>,]nr-gpios property is used by some GPIO drivers[0] to indicate
the number of GPIOs present on a system, not define a GPIO. nr-gpios is
not configured by #gpio-cells and can't be parsed along with other
"*-gpios" properties.
nr-gpios without the "<vendor>," prefix is not allowed by the DT
spec[1], so only add exception for the ",nr-gpios" suffix and let the
error message continue being printed for non-compliant implementations.
[0] nr-gpios is referenced in Documentation/devicetree/bindings/gpio:
- gpio-adnp.txt
- gpio-xgene-sb.txt
- gpio-xlp.txt
- snps,dw-apb-gpio.yaml
[1] Link:
|
||
|
|
751aaf9f30 |
UPSTREAM: udp: never accept GSO_FRAGLIST packets
Currently the UDP protocol delivers GSO_FRAGLIST packets to
the sockets without the expected segmentation.
This change addresses the issue introducing and maintaining
a couple of new fields to explicitly accept SKB_GSO_UDP_L4
or GSO_FRAGLIST packets. Additionally updates udp_unexpected_gso()
accordingly.
UDP sockets enabling UDP_GRO stil keep accept_udp_fraglist
zeroed.
v1 -> v2:
- use 2 bits instead of a whole GSO bitmask (Willem)
Fixes: 9fd1ff5d2ac7 ("udp: Support UDP fraglist GRO/GSO.")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 78352f73dc5047f3f744764cc45912498c52f3c9)
Bug: 187129171
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: I79d90f403c10f83f21e3f99554b6fdbfc2cc60b0
|
||
|
|
01228292a6 |
UPSTREAM: udp: skip L4 aggregation for UDP tunnel packets
If NETIF_F_GRO_FRAGLIST or NETIF_F_GRO_UDP_FWD are enabled, and there
are UDP tunnels available in the system, udp_gro_receive() could end-up
doing L4 aggregation (either SKB_GSO_UDP_L4 or SKB_GSO_FRAGLIST) at
the outer UDP tunnel level for packets effectively carrying and UDP
tunnel header.
That could cause inner protocol corruption. If e.g. the relevant
packets carry a vxlan header, different vxlan ids will be ignored/
aggregated to the same GSO packet. Inner headers will be ignored, too,
so that e.g. TCP over vxlan push packets will be held in the GRO
engine till the next flush, etc.
Just skip the SKB_GSO_UDP_L4 and SKB_GSO_FRAGLIST code path if the
current packet could land in a UDP tunnel, and let udp_gro_receive()
do GRO via udp_sk(sk)->gro_receive.
The check implemented in this patch is broader than what is strictly
needed, as the existing UDP tunnel could be e.g. configured on top of
a different device: we could end-up skipping GRO at-all for some packets.
Anyhow, that is a very thin corner case and covering it will add quite
a bit of complexity.
v1 -> v2:
- hopefully clarify the commit message
Fixes: 9fd1ff5d2ac7 ("udp: Support UDP fraglist GRO/GSO.")
Fixes: 36707061d6ba ("udp: allow forwarding of plain (non-fraglisted) UDP GRO packets")
Reviewed-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 18f25dc399901426dff61e676ba603ff52c666f7)
Bug: 187129171
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: If48b1d56009edac9710a100889696d75965eb764
|
||
|
|
13ab504be3 |
UPSTREAM: xfrm/compat: Cleanup WARN()s that can be user-triggered
Replace WARN_ONCE() that can be triggered from userspace with pr_warn_once(). Those still give user a hint what's the issue. I've left WARN()s that are not possible to trigger with current code-base and that would mean that the code has issues: - relying on current compat_msg_min[type] <= xfrm_msg_min[type] - expected 4-byte padding size difference between compat_msg_min[type] and xfrm_msg_min[type] - compat_policy[type].len <= xfrma_policy[type].len (for every type) Reported-by: syzbot+834ffd1afc7212eb8147@syzkaller.appspotmail.com Fixes: 5f3eea6b7e8f ("xfrm/compat: Attach xfrm dumps to 64=>32 bit translator") Cc: "David S. Miller" <davem@davemloft.net> Cc: Eric Dumazet <eric.dumazet@gmail.com> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: Jakub Kicinski <kuba@kernel.org> Cc: Steffen Klassert <steffen.klassert@secunet.com> Cc: netdev@vger.kernel.org Cc: stable@vger.kernel.org Signed-off-by: Dmitry Safonov <dima@arista.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> (cherry picked from commit ef19e111337f6c3dca7019a8bad5fbc6fb18d635) Bug: 187129171 Signed-off-by: Connor O'Brien <connoro@google.com> Change-Id: I9576dc6fd1be792674b2e4e844769b8b7659c151 |
||
|
|
236d41699d |
UPSTREAM: pinctrl: sunxi: fix irq bank map for the Allwinner A100 pin controller
A100's pin starts with PB, so it should start with 1.
Fixes: 473436e7647d6 ("pinctrl: sunxi: add support for the Allwinner A100 pin controller")
Signed-off-by: Yangtao Li <frank@allwinnertech.com>
Link: https://lore.kernel.org/r/9db51667bf9065be55beafd56e5c319e3bbe8310.1604988979.git.frank@allwinnertech.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
(cherry picked from commit 6de7ed693c631d4689acfe90c434147598d75543)
Bug: 187129171
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: I0bb4a3f8e522e4a1ee77aed4566cb66adde612e0
|