diff options
author | He Zhe <zhe.he@windriver.com> | 2017-01-18 09:34:09 +0800 |
---|---|---|
committer | Joe MacDonald <joe_macdonald@mentor.com> | 2017-02-22 08:31:58 -0500 |
commit | c48160ed079fd9764e51b616953baac12f60938e (patch) | |
tree | 553f11cfe5c5a3b3612582c90a40a0708f0ac2cc | |
parent | 681df62a30e53e1681fdb2bf6be0fa6276496e50 (diff) | |
download | meta-openembedded-c48160ed079fd9764e51b616953baac12f60938e.tar.gz |
iscsitarget: Fix call trace of ahash API calling
The previous build_with_updated_interfaces_of_linux_v4.8_and_above.patch
does not alloc struct ahash_request before using it. This will cause the
kernel call trace below when calling gen_scsiid on kernel 4.8 or later
version.
This patch normalizes the calling of ahash API according to the example
in kernel doc Documentation/crypto/api-intro.txt.
BUG: unable to handle kernel NULL pointer dereference at 0000000000000020
IP: [<ffffffffa0008d45>] volume_add+0x625/0x7f0 [iscsi_trgt]
PGD dd77067 PUD dd7c067 PMD 0
Oops: 0000 [#1] PREEMPT SMP
Modules linked in: iscsi_trgt(O)
CPU: 0 PID: 350 Comm: ietd Tainted: G O 4.8.12-yocto-standard #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.3-0-ge2fc41e-prebuilt.qemu-project.org 04/01/2014
task: ffff88000dfe2c00 task.stack: ffff88000de88000
RIP: 0010:[<ffffffffa0008d45>] [<ffffffffa0008d45>] volume_add+0x625/0x7f0 [iscsi_trgt]
RSP: 0018:ffff88000de8bd90 EFLAGS: 00000206
RAX: 000000000000ddfa RBX: ffff88000ddd1d78 RCX: ffffea0000000000
RDX: 0000000000000600 RSI: 0000000000000000 RDI: ffff88000ddd1c14
RBP: ffff88000de8be38 R08: ffff88000de44180 R09: ffff88000de8bdd0
R10: 000000000000002c R11: 0000000000000000 R12: ffff88000ddfa600
R13: 0000000000000000 R14: 0000000000000000 R15: ffff88000de92200
FS: 00007f767548b700(0000) GS:ffff88000fc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000020 CR3: 000000000dd2d000 CR4: 00000000000006f0
Stack:
ffff88000de8bdd0 ffff88000dc1b3d0 ffff88000ddfa650 ffff88000ddfa660
ffff88000df8f000 ffff88000ddd1c00 ffff88000de44180 0000000000000000
ffffea0000377440 0000000f00000c14 0000000000000000 0000000000000000
Call Trace:
[<ffffffffa0006547>] ioctl+0x217/0x390 [iscsi_trgt]
[<ffffffff81192574>] do_vfs_ioctl+0x94/0x5c0
[<ffffffff8117ff73>] ? vfs_read+0xf3/0x120
[<ffffffff81192b19>] SyS_ioctl+0x79/0x90
[<ffffffff8191a45b>] entry_SYSCALL_64_fastpath+0x13/0x8f
Code: 4c 01 e0 0f 82 a2 01 00 00 48 b9 00 00 00 80 ff 77 00 00 48 01
c8 45 31 f6 48 b9 00 00 00 00 00 ea ff ff 89 54 24 68 48 c1 e8 0c <49>
8b 56 20 4c 89 44 24 20 4c 89 f7 48 c1 e0 06 c7 44 24 6c 04
RIP [<ffffffffa0008d45>] volume_add+0x625/0x7f0 [iscsi_trgt]
RSP <ffff88000de8bd90>
CR2: 0000000000000020
end trace cd2016297df21635 ]
ietd_response_recv 200 0 -5
Input/output error.
Signed-off-by: He Zhe <zhe.he@windriver.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
-rw-r--r-- | meta-networking/recipes-extended/iscsitarget/files/fix-call-trace-of-ahash-API-calling.patch | 85 | ||||
-rw-r--r-- | meta-networking/recipes-extended/iscsitarget/iscsitarget_1.4.20.3+svn502.bb | 3 |
2 files changed, 87 insertions, 1 deletions
diff --git a/meta-networking/recipes-extended/iscsitarget/files/fix-call-trace-of-ahash-API-calling.patch b/meta-networking/recipes-extended/iscsitarget/files/fix-call-trace-of-ahash-API-calling.patch new file mode 100644 index 000000000..c99683478 --- /dev/null +++ b/meta-networking/recipes-extended/iscsitarget/files/fix-call-trace-of-ahash-API-calling.patch | |||
@@ -0,0 +1,85 @@ | |||
1 | The previous build_with_updated_interfaces_of_linux_v4.8_and_above.patch | ||
2 | does not alloc struct ahash_request before using it. This will cause the | ||
3 | kernel call trace below when calling gen_scsiid on kernel 4.8 or later | ||
4 | version. | ||
5 | |||
6 | This patch normalizes the calling of ahash API according to the example | ||
7 | in kernel doc Documentation/crypto/api-intro.txt. | ||
8 | |||
9 | BUG: unable to handle kernel NULL pointer dereference at 0000000000000020 | ||
10 | IP: [<ffffffffa0008d45>] volume_add+0x625/0x7f0 [iscsi_trgt] | ||
11 | PGD dd77067 PUD dd7c067 PMD 0 | ||
12 | Oops: 0000 [#1] PREEMPT SMP | ||
13 | Modules linked in: iscsi_trgt(O) | ||
14 | CPU: 0 PID: 350 Comm: ietd Tainted: G O 4.8.12-yocto-standard #1 | ||
15 | Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.3-0-ge2fc41e-prebuilt.qemu-project.org 04/01/2014 | ||
16 | task: ffff88000dfe2c00 task.stack: ffff88000de88000 | ||
17 | RIP: 0010:[<ffffffffa0008d45>] [<ffffffffa0008d45>] volume_add+0x625/0x7f0 [iscsi_trgt] | ||
18 | RSP: 0018:ffff88000de8bd90 EFLAGS: 00000206 | ||
19 | RAX: 000000000000ddfa RBX: ffff88000ddd1d78 RCX: ffffea0000000000 | ||
20 | RDX: 0000000000000600 RSI: 0000000000000000 RDI: ffff88000ddd1c14 | ||
21 | RBP: ffff88000de8be38 R08: ffff88000de44180 R09: ffff88000de8bdd0 | ||
22 | R10: 000000000000002c R11: 0000000000000000 R12: ffff88000ddfa600 | ||
23 | R13: 0000000000000000 R14: 0000000000000000 R15: ffff88000de92200 | ||
24 | FS: 00007f767548b700(0000) GS:ffff88000fc00000(0000) knlGS:0000000000000000 | ||
25 | CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 | ||
26 | CR2: 0000000000000020 CR3: 000000000dd2d000 CR4: 00000000000006f0 | ||
27 | Stack: | ||
28 | ffff88000de8bdd0 ffff88000dc1b3d0 ffff88000ddfa650 ffff88000ddfa660 | ||
29 | ffff88000df8f000 ffff88000ddd1c00 ffff88000de44180 0000000000000000 | ||
30 | ffffea0000377440 0000000f00000c14 0000000000000000 0000000000000000 | ||
31 | Call Trace: | ||
32 | [<ffffffffa0006547>] ioctl+0x217/0x390 [iscsi_trgt] | ||
33 | [<ffffffff81192574>] do_vfs_ioctl+0x94/0x5c0 | ||
34 | [<ffffffff8117ff73>] ? vfs_read+0xf3/0x120 | ||
35 | [<ffffffff81192b19>] SyS_ioctl+0x79/0x90 | ||
36 | [<ffffffff8191a45b>] entry_SYSCALL_64_fastpath+0x13/0x8f | ||
37 | Code: 4c 01 e0 0f 82 a2 01 00 00 48 b9 00 00 00 80 ff 77 00 00 48 01 | ||
38 | c8 45 31 f6 48 b9 00 00 00 00 00 ea ff ff 89 54 24 68 48 c1 e8 0c <49> | ||
39 | 8b 56 20 4c 89 44 24 20 4c 89 f7 48 c1 e0 06 c7 44 24 6c 04 | ||
40 | RIP [<ffffffffa0008d45>] volume_add+0x625/0x7f0 [iscsi_trgt] | ||
41 | RSP <ffff88000de8bd90> | ||
42 | CR2: 0000000000000020 | ||
43 | end trace cd2016297df21635 ] | ||
44 | ietd_response_recv 200 0 -5 | ||
45 | Input/output error. | ||
46 | |||
47 | Upstream-Status: Pending [This patch is based on the previous one which | ||
48 | has not been merged upstream.] | ||
49 | |||
50 | Signed-off-by: Zhe He <zhe.he@windriver.com> | ||
51 | |||
52 | --- iscsitarget-1.4.20.3+svn502_orig/kernel/volume.c 2017-01-18 08:57:56.752187402 +0800 | ||
53 | +++ iscsitarget-1.4.20.3+svn502/kernel/volume.c 2017-01-18 09:02:44.164195234 +0800 | ||
54 | @@ -93,13 +93,14 @@ static void gen_scsiid(struct iet_volume | ||
55 | |||
56 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) | ||
57 | tfm = crypto_alloc_ahash("md5", 0, CRYPTO_ALG_ASYNC); | ||
58 | + hash = ahash_request_alloc(tfm, GFP_ATOMIC); | ||
59 | #else | ||
60 | hash.tfm = crypto_alloc_hash("md5", 0, CRYPTO_ALG_ASYNC); | ||
61 | hash.flags = 0; | ||
62 | #endif | ||
63 | |||
64 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) | ||
65 | - if (!IS_ERR(tfm)) { | ||
66 | + if (tfm && !IS_ERR(tfm)) { | ||
67 | #else | ||
68 | if (!IS_ERR(hash.tfm)) { | ||
69 | #endif | ||
70 | @@ -116,10 +117,13 @@ static void gen_scsiid(struct iet_volume | ||
71 | nbytes += sizeof(volume->lun); | ||
72 | |||
73 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) | ||
74 | - crypto_ahash_init(hash); | ||
75 | + ahash_request_set_callback(hash, 0, NULL, NULL); | ||
76 | ahash_request_set_crypt(hash, sg, volume->scsi_id, nbytes); | ||
77 | - crypto_ahash_update(hash); | ||
78 | crypto_ahash_digest(hash); | ||
79 | + crypto_ahash_init(hash); | ||
80 | + crypto_ahash_update(hash); | ||
81 | + crypto_ahash_final(hash); | ||
82 | + ahash_request_free(hash); | ||
83 | crypto_free_ahash(tfm); | ||
84 | #else | ||
85 | crypto_hash_init(&hash); | ||
diff --git a/meta-networking/recipes-extended/iscsitarget/iscsitarget_1.4.20.3+svn502.bb b/meta-networking/recipes-extended/iscsitarget/iscsitarget_1.4.20.3+svn502.bb index 7279bc637..5c1e38e17 100644 --- a/meta-networking/recipes-extended/iscsitarget/iscsitarget_1.4.20.3+svn502.bb +++ b/meta-networking/recipes-extended/iscsitarget/iscsitarget_1.4.20.3+svn502.bb | |||
@@ -13,7 +13,8 @@ SRC_URI = "http://ftp.heanet.ie/mirrors/ubuntu/pool/universe/i/${BPN}/${BPN}_${P | |||
13 | file://fix-errors-observed-with-linux-3.19-and-greater.patch \ | 13 | file://fix-errors-observed-with-linux-3.19-and-greater.patch \ |
14 | file://access-sk_v6_daddr-iff-IPV6-defined.patch \ | 14 | file://access-sk_v6_daddr-iff-IPV6-defined.patch \ |
15 | file://build_with_updated_bio_struct_of_linux_v4.3_and_above.patch \ | 15 | file://build_with_updated_bio_struct_of_linux_v4.3_and_above.patch \ |
16 | file://build_with_updated_interfaces_of_linux_v4.8_and_above.patch" | 16 | file://build_with_updated_interfaces_of_linux_v4.8_and_above.patch \ |
17 | file://fix-call-trace-of-ahash-API-calling.patch" | ||
17 | 18 | ||
18 | SRC_URI[md5sum] = "ef9bc823bbabd3c772208c00d5f2d089" | 19 | SRC_URI[md5sum] = "ef9bc823bbabd3c772208c00d5f2d089" |
19 | SRC_URI[sha256sum] = "d3196ccb78a43266dce28587bfe30d8ab4db7566d7bce96057dfbb84100babb5" | 20 | SRC_URI[sha256sum] = "d3196ccb78a43266dce28587bfe30d8ab4db7566d7bce96057dfbb84100babb5" |