Skip to contentSkip to conversation

block/ssh: fix possible segmentation fault when .desc is not null-terminated

PATCH Applied Murilo Opsfelder Araujo 3 participants 5 messages Jan 5, 2018 – Feb 15, 2018 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block/ssh: fix possible segmentation fault when .desc is not null-terminated

This patch prevents a possible segmentation fault when .desc members are checked against NULL.

The ssh_runtime_opts was added by commit 8a6a80896d6af03b8ee0c17cdf37219eca2588a7 ("block/ssh: Use QemuOpts for runtime options").

This fix was inspired by
http://lists.nongnu.org/archive/html/qemu-devel/2018-01/msg00883.html.

Fixes 8a6a80896d6af03b8ee0c17cdf37219eca2588a7 ("block/ssh: Use QemuOpts for runtime options")
Cc Max Reitz <[email protected]>
Cc Eric Blake <[email protected]>
---
 block/ssh.c | 1 +
 1 file changed, 1 insertion(+)
block/ssh.c +1 -0
index b049a16eb9..8890a0c4ba 100644
@@ -556,6 +556,7 @@ static QemuOptsList ssh_runtime_opts = {
             .type = QEMU_OPT_STRING,
             .help = "Defines how and what to check the host key against",
         },
+        { /* end of list */ }
     },
 };
 
Signature · 1 line
2.14.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Murilo Opsfelder Araujo

This patch prevents a possible segmentation fault when .desc members are checked against NULL.

The ssh_runtime_opts was added by commit 8a6a80896d6af03b8ee0c17cdf37219eca2588a7 ("block/ssh: Use QemuOpts for runtime options").

This fix was inspired by
http://lists.nongnu.org/archive/html/qemu-devel/2018-01/msg00883.html.

Fixes 8a6a80896d6af03b8ee0c17cdf37219eca2588a7 ("block/ssh: Use QemuOpts for runtime options")

present since 2.7.0, so we've gotten lucky that no one has actually encountered a crash (but I didn't try hard to see if one was possible)

Quoted 6 lines
---
 block/ssh.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 14 lines
block/ssh.c +1 -0
index b049a16eb9..8890a0c4ba 100644
@@ -556,6 +556,7 @@ static QemuOptsList ssh_runtime_opts = {
             .type = QEMU_OPT_STRING,
             .help = "Defines how and what to check the host key against",
         },
+        { /* end of list */ }
     },
 };
 
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#2 lore raw
Quoted 23 lines · Eric Blake
Quoted 11 lines · Murilo Opsfelder Araujo

This patch prevents a possible segmentation fault when .desc members are checked against NULL.

The ssh_runtime_opts was added by commit 8a6a80896d6af03b8ee0c17cdf37219eca2588a7 ("block/ssh: Use QemuOpts for runtime options").

This fix was inspired by
http://lists.nongnu.org/archive/html/qemu-devel/2018-01/msg00883.html.

Fixes 8a6a80896d6af03b8ee0c17cdf37219eca2588a7 ("block/ssh: Use QemuOpts for runtime options")

present since 2.7.0, so we've gotten lucky that no one has actually encountered a crash (but I didn't try hard to see if one was possible)

Quoted 6 lines
---
 block/ssh.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 2 lines

Hi, Eric.

Was this supposed to land stable-2.11 branch?

Cheers
Murilo

#3 lore raw
Quoted 13 lines · Murilo Opsfelder Araujo
Quoted 12 lines · Eric Blake
Quoted 10 lines · Murilo Opsfelder Araujo

This patch prevents a possible segmentation fault when .desc members are checked against NULL.

---
  block/ssh.c | 1 +
  1 file changed, 1 insertion(+)
Quoted 6 lines
Quoted 2 lines

Hi, Eric.

Was this supposed to land stable-2.11 branch?

Oh well, it missed 2.11.1. I don't think it's too much of a show-stopper. If we have a 2.11.2, hopefully it gets in then; otherwise, waiting for 2.12 will be sufficient.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
Applied
#4 lore raw
In reply to Murilo Opsfelder Araujo
Quoted 33 lines · Murilo Opsfelder Araujo

This patch prevents a possible segmentation fault when .desc members are checked against NULL.

The ssh_runtime_opts was added by commit 8a6a80896d6af03b8ee0c17cdf37219eca2588a7 ("block/ssh: Use QemuOpts for runtime options").

This fix was inspired by
http://lists.nongnu.org/archive/html/qemu-devel/2018-01/msg00883.html.

Fixes 8a6a80896d6af03b8ee0c17cdf37219eca2588a7 ("block/ssh: Use QemuOpts for runtime options")
Cc Max Reitz <[email protected]>
Cc Eric Blake <[email protected]>
---
 block/ssh.c | 1 +
 1 file changed, 1 insertion(+)
block/ssh.c +1 -0
index b049a16eb9..8890a0c4ba 100644
@@ -556,6 +556,7 @@ static QemuOptsList ssh_runtime_opts = {
             .type = QEMU_OPT_STRING,
             .help = "Defines how and what to check the host key against",
         },
+        { /* end of list */ }
     },
 };
 
Signature · 1 line
2.14.3

Thanks,

Applied to my block branch:

git://github.com/codyprime/qemu-kvm-jtc block

-Jeff