Vakul Garg
5c1e7e94a7
Prevent overflow of sk_msg in sk_msg_clone()
Fixed function sk_msg_clone() to prevent overflow of 'dst' while adding
pages in scatterlist entries. The overflow of 'dst' causes crash in kernel
tls module while doing record encryption.
Crash fixed by this patch.
[ 78.796119] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000008
[ 78.804900] Mem abort info:
[ 78.807683] ESR = 0x96000004
[ 78.810744] Exception class = DABT (current EL), IL = 32 bits
[ 78.816677] SET = 0, FnV = 0
[ 78.819727] EA = 0, S1PTW = 0
[ 78.822873] Data abort info:
[ 78.825759] ISV = 0, ISS = 0x00000004
[ 78.829600] CM = 0, WnR = 0
[ 78.832576] user pgtable: 4k pages, 48-bit VAs, pgdp = 00000000bf8ee311
[ 78.839195] [0000000000000008] pgd=0000000000000000
[ 78.844081] Internal error: Oops: 96000004 [#1] PREEMPT SMP
[ 78.849642] Modules linked in: tls xt_conntrack ipt_REJECT nf_reject_ipv4 ip6table_filter ip6_tables xt_CHECKSUM cpve cpufreq_conservative lm90 ina2xx crct10dif_ce
[ 78.865377] CPU: 0 PID: 6007 Comm: openssl Not tainted 4.20.0-rc6-01647-g754d5da63145-dirty #107
[ 78.874149] Hardware name: LS1043A RDB Board (DT)
[ 78.878844] pstate: 60000005 (nZCv daif -PAN -UAO)
[ 78.883632] pc : scatterwalk_copychunks+0x164/0x1c8
[ 78.888500] lr : scatterwalk_copychunks+0x160/0x1c8
[ 78.893366] sp : ffff00001d04b600
[ 78.896668] x29: ffff00001d04b600 x28: ffff80006814c680
[ 78.901970] x27: 0000000000000000 x26: ffff80006c8de786
[ 78.907272] x25: ffff00001d04b760 x24: 000000000000001a
[ 78.912573] x23: 0000000000000006 x22: ffff80006814e440
[ 78.917874] x21: 0000000000000100 x20: 0000000000000000
[ 78.923175] x19: 000081ffffffffff x18: 0000000000000400
[ 78.928476] x17: 0000000000000008 x16: 0000000000000000
[ 78.933778] x15: 0000000000000100 x14: 0000000000000001
[ 78.939079] x13: 0000000000001080 x12: 0000000000000020
[ 78.944381] x11: 0000000000001080 x10: 00000000ffff0002
[ 78.949683] x9 : ffff80006814c248 x8 : 00000000ffff0000
[ 78.954985] x7 : ffff80006814c318 x6 : ffff80006c8de786
[ 78.960286] x5 : 0000000000000f80 x4 : ffff80006c8de000
[ 78.965588] x3 : 0000000000000000 x2 : 0000000000001086
[ 78.970889] x1 : ffff7e0001b74e02 x0 : 0000000000000000
[ 78.976192] Process openssl (pid: 6007, stack limit = 0x00000000291367f9)
[ 78.982968] Call trace:
[ 78.985406] scatterwalk_copychunks+0x164/0x1c8
[ 78.989927] skcipher_walk_next+0x28c/0x448
[ 78.994099] skcipher_walk_done+0xfc/0x258
[ 78.998187] gcm_encrypt+0x434/0x4c0
[ 79.001758] tls_push_record+0x354/0xa58 [tls]
[ 79.006194] bpf_exec_tx_verdict+0x1e4/0x3e8 [tls]
[ 79.010978] tls_sw_sendmsg+0x650/0x780 [tls]
[ 79.015326] inet_sendmsg+0x2c/0xf8
[ 79.018806] sock_sendmsg+0x18/0x30
[ 79.022284] __sys_sendto+0x104/0x138
[ 79.025935] __arm64_sys_sendto+0x24/0x30
[ 79.029936] el0_svc_common+0x60/0xe8
[ 79.033588] el0_svc_handler+0x2c/0x80
[ 79.037327] el0_svc+0x8/0xc
[ 79.040200] Code: 6b01005f 54fff788 940169b1 f9000320 (b9400801)
[ 79.046283] ---[ end trace 74db007d069c1cf7 ]---
Fixes: d829e9c4112b ("tls: convert to generic sk_msg interface")
Signed-off-by: Vakul Garg <vakul.garg@nxp.com>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-12-21 09:12:49 -08:00
..
2018-10-24 14:18:16 -07:00
2018-04-19 12:58:20 -04:00
2018-07-24 11:36:15 -07:00
2018-12-05 16:22:05 -08:00
2018-10-12 21:38:46 -07:00
2017-11-21 15:57:07 -08:00
2018-03-05 12:52:45 -05:00
2018-08-03 21:12:12 +02:00
2018-10-19 11:03:06 -07:00
2018-05-28 22:59:54 -04:00
2018-03-29 14:10:30 -04:00
2018-10-08 10:39:05 -07:00
2018-11-30 17:17:38 -08:00
2018-12-07 13:38:29 -08:00
2018-08-11 12:37:10 -07:00
2018-09-28 10:25:11 -07:00
2018-12-19 15:50:02 -08:00
2016-05-25 12:35:09 -07:00
2018-09-19 21:06:46 -07:00
2018-08-07 11:02:05 -07:00
2017-08-07 14:16:22 -07:00
2018-10-15 12:23:19 -07:00
2018-12-19 17:30:47 -08:00
2018-10-08 10:39:05 -07:00
2018-05-16 07:24:30 +02:00
2018-08-09 14:25:06 -07:00
2017-11-02 11:10:55 +01:00
2018-05-24 23:01:15 -04:00
2018-10-23 12:58:17 -07:00
2015-05-31 00:03:21 -07:00
2018-11-05 17:07:10 -08:00
2017-12-13 13:18:46 -05:00
2018-07-19 23:23:01 -07:00
2018-09-13 15:36:41 -07:00
2015-11-03 11:08:22 -05:00
2016-12-29 11:38:31 -05:00
2018-12-04 20:28:22 -08:00
2017-03-02 08:42:29 +01:00
2018-07-11 12:10:19 -06:00
2018-11-21 15:38:52 -08:00
2018-12-21 09:12:49 -08:00
2018-08-14 10:01:24 -07:00
2018-10-20 00:40:45 +02:00
2018-08-11 01:58:46 +02:00
2018-11-05 17:09:19 -08:00
2018-02-11 14:34:03 -08:00
2018-12-11 19:12:21 -08:00
2015-07-09 14:17:15 -07:00
2017-11-02 11:10:55 +01:00
2018-08-04 13:05:39 -07:00
2018-09-01 01:35:53 +02:00