Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
arm64: bti: fix BTI to handle local indirect branches
The AES code uses a 'br x7' as part of a function called by a macro, that ends up needing a BTI_J as a target. Lets define SYN_CODE_START_LOCAL() for this and replace the SYM_FUNC_START_LOCAL with a SYM_FUNC_CODE_LOCAL in the AES block. Without this kernels compiled with the aes_neon_bs will OOPS at boot. Bad mode in Synchronous Abort handler detected on CPU1, code 0x34000003 -- BTI CPU: 1 PID: 265 Comm: cryptomgr_test Not tainted 5.8.11-300.fc33.aarch64 #1 pstate: 20400c05 (nzCv daif +PAN -UAO BTYPE=j-) pc : aesbs_encrypt8+0x0/0x5f0 [aes_neon_bs] lr : aesbs_xts_encrypt+0x48/0xe0 [aes_neon_bs] sp : ffff80001052b730 x29: ffff80001052b730 x28: 0000000000000001 x27: ffff0001ec8f4000 x26: ffff0001ec5d27b0 x25: ffff0001ec8f4000 x24: ffff80001052bc00 x23: 0000000000000018 x22: 000000000000000a x21: ffff0001ec5d2100 x20: ffff0001ec8f4080 x19: ffff0001ec8f4000 x18: 0000000000000004 x17: 0000000000000000 x16: ffffadb4db85d310 x15: 0000000000000200 x14: 0000000000000010 x13: 0000000000000200 x12: ffff0001ec5d2100 x11: 000000000000000a x10: 0000020000200000 x9 : ffffadb4db7e7488 x8 : 0000000000000000 x7 : ffffadb4614fb110 x6 : 0000000000000000 x5 : ffff80001052bc00 x4 : 0000000000000020 x3 : 000000000000000a x2 : ffff0001ec5d2100 x1 : ffff0001ec8f4000 x0 : ffff0001ec8f4000 Kernel panic - not syncing: bad mode CPU: 1 PID: 265 Comm: cryptomgr_test Not tainted 5.8.11-300.fc33.aarch64 #1 Call trace: dump_backtrace+0x0/0x1c0 show_stack+0x24/0x30 dump_stack+0xc0/0x118 panic+0x144/0x358 arm64_serror_panic+0x0/0x98 el1_sync_handler+0x60/0x110 el1_sync+0xb4/0x180 aesbs_encrypt8+0x0/0x5f0 [aes_neon_bs] __xts_crypt+0xb0/0x2dc [aes_neon_bs] xts_encrypt+0x28/0x3c [aes_neon_bs] crypto_skcipher_encrypt+0x50/0x84 simd_skcipher_encrypt+0xc8/0xe0 crypto_skcipher_encrypt+0x50/0x84 test_skcipher_vec_cfg+0x224/0x5f0 test_skcipher+0xbc/0x120 alg_test_skcipher+0xa0/0x1b0 alg_test+0x3dc/0x47c cryptomgr_test+0x38/0x60 kthread+0x11c/0x120 ret_from_fork+0x10/0x18 SMP: stopping secondary CPUs Kernel Offset: 0x2db4cb7e0000 from 0xffff800010000000 PHYS_OFFSET: 0xffffcf2440000000 CPU features: 0x7e0152,20c02020 Memory Limit: none ---[ end Kernel panic - not syncing: bad mode ]--- Fixes: commit 0e89640 ("crypto: arm64 - Use modern annotations for assembly functions") Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
- Loading branch information