diff options
| author | Florian Kreutzer <florian.kreutzer.oss@rohde-schwarz.com> | 2024-11-26 17:45:04 +0100 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2024-12-06 05:50:25 -0800 |
| commit | 04886dab5eacde4178a97bb6cab03cb0a153483b (patch) | |
| tree | 14d976b9a60d93a2f0442b3874bd66066dbef2c7 | |
| parent | 4509002b442b1acb771996081947a899e519e7ce (diff) | |
| download | poky-04886dab5eacde4178a97bb6cab03cb0a153483b.tar.gz | |
dropbear: backport fix for concurrent channel open/close
Prevents sporadic crashes of dropbear server when multiple channels are
active at the same time.
Upstream discussion:
https://github.com/mkj/dropbear/pull/326/commits
https://github.com/mkj/dropbear/issues/321
Issue was introduced in dropbear-2022.83 and fixed in v2024.86.
(From OE-Core rev: 808972c0418a64fbed2134b55f25fb90e5d498e9)
Signed-off-by: Florian Kreutzer <florian.kreutzer.oss@rohde-schwarz.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
| -rw-r--r-- | meta/recipes-core/dropbear/dropbear/0007-Don-t-close-channels-when-a-PID-hasn-t-started.patch | 45 | ||||
| -rw-r--r-- | meta/recipes-core/dropbear/dropbear_2022.83.bb | 1 |
2 files changed, 46 insertions, 0 deletions
diff --git a/meta/recipes-core/dropbear/dropbear/0007-Don-t-close-channels-when-a-PID-hasn-t-started.patch b/meta/recipes-core/dropbear/dropbear/0007-Don-t-close-channels-when-a-PID-hasn-t-started.patch new file mode 100644 index 0000000000..dff6534027 --- /dev/null +++ b/meta/recipes-core/dropbear/dropbear/0007-Don-t-close-channels-when-a-PID-hasn-t-started.patch | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | From 5c34e70b80e5fc539f96e029b56b95cdee556010 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Matt Johnston <matt@ucc.asn.au> | ||
| 3 | Date: Sun, 8 Sep 2024 11:07:41 +0200 | ||
| 4 | Subject: Don't close channels when a PID hasn't started | ||
| 5 | |||
| 6 | If check_close() ran prior to a server channel exec/shell | ||
| 7 | request, it would send a close immediately. | ||
| 8 | This fix changes it to exclude write_fd==FD_UNINIT from | ||
| 9 | being closed there. | ||
| 10 | |||
| 11 | When a channel was closed by the time shell/exec request | ||
| 12 | was received, then data sent hits an assertion. | ||
| 13 | This fixes #321 on Github. | ||
| 14 | |||
| 15 | The "pid == 0" check was initially added to avoid waiting | ||
| 16 | to close a channel when a process has never been launched | ||
| 17 | (which is correct), but that isn't correct in the case | ||
| 18 | of the closed-fd test. | ||
| 19 | |||
| 20 | Fixes: 8e6f73e879ca ("- Remove "flushing" handling for exited processes) | ||
| 21 | |||
| 22 | Upstream-Status: Backport [https://github.com/mkj/dropbear/commit/71521d1b78706a70d3570b860e65234cefdc8c81] | ||
| 23 | |||
| 24 | Signed-off-by: Florian Kreutzer <florian.kreutzer.oss@rohde-schwarz.com> | ||
| 25 | --- | ||
| 26 | common-channel.c | 3 ++- | ||
| 27 | 1 file changed, 2 insertions(+), 1 deletion(-) | ||
| 28 | |||
| 29 | diff --git a/common-channel.c b/common-channel.c | ||
| 30 | index be5b57f..9926972 100644 | ||
| 31 | --- a/common-channel.c | ||
| 32 | +++ b/common-channel.c | ||
| 33 | @@ -317,7 +317,8 @@ static void check_close(struct Channel *channel) { | ||
| 34 | |||
| 35 | if ((channel->recv_eof && !write_pending(channel)) | ||
| 36 | /* have a server "session" and child has exited */ | ||
| 37 | - || (channel->type->check_close && close_allowed)) { | ||
| 38 | + || (channel->writefd != FD_UNINIT | ||
| 39 | + && channel->type->check_close && close_allowed)) { | ||
| 40 | close_chan_fd(channel, channel->writefd, SHUT_WR); | ||
| 41 | } | ||
| 42 | |||
| 43 | -- | ||
| 44 | 2.34.1 | ||
| 45 | |||
diff --git a/meta/recipes-core/dropbear/dropbear_2022.83.bb b/meta/recipes-core/dropbear/dropbear_2022.83.bb index 686cb8a809..772e08eaed 100644 --- a/meta/recipes-core/dropbear/dropbear_2022.83.bb +++ b/meta/recipes-core/dropbear/dropbear_2022.83.bb | |||
| @@ -14,6 +14,7 @@ RCONFLICTS:${PN} = "openssh-sshd openssh" | |||
| 14 | 14 | ||
| 15 | SRC_URI = "http://matt.ucc.asn.au/dropbear/releases/dropbear-${PV}.tar.bz2 \ | 15 | SRC_URI = "http://matt.ucc.asn.au/dropbear/releases/dropbear-${PV}.tar.bz2 \ |
| 16 | file://0001-urandom-xauth-changes-to-options.h.patch \ | 16 | file://0001-urandom-xauth-changes-to-options.h.patch \ |
| 17 | file://0007-Don-t-close-channels-when-a-PID-hasn-t-started.patch \ | ||
| 17 | file://init \ | 18 | file://init \ |
| 18 | file://dropbearkey.service \ | 19 | file://dropbearkey.service \ |
| 19 | file://dropbear@.service \ | 20 | file://dropbear@.service \ |
