Bug 213479 - Fix ggatec; Return EOPNOTSUPP for operations other than BIO_READ / BIO_WRITE
Summary: Fix ggatec; Return EOPNOTSUPP for operations other than BIO_READ / BIO_WRITE
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-geom (Nobody)
Keywords: needs-qa, patch
Depends on:
Reported: 2016-10-14 15:56 UTC by kikuchan98
Modified: 2021-08-27 20:53 UTC (History)
2 users (show)

See Also:

a workaround for the problem (399 bytes, patch)
2016-10-14 15:56 UTC, kikuchan98
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description kikuchan98 2016-10-14 15:56:55 UTC
Created attachment 175746 [details]
a workaround for the problem

When G_GATE_CMD_START ioctl require some operations other than BIO_READ / BIO_WRITE, current implementation of ggatec sometimes stops working because it uses uninitialized hdr.gh_cmd variable confuses ggated.

A patch try to solve this situation by returning EOPNOTSUPP, like ggatel does.

Maybe BIO_FLUSH and BIO_DELETE should be supported on ggate protocol by assigning GGATE_CMD_FLUSH and GGATE_CMD_DELETE commands respectively, in the future.
Comment 1 jo 2021-07-27 01:03:46 UTC
Your patch inspired mine: https://reviews.freebsd.org/D31318
Comment 3 commit-hook freebsd_committer 2021-08-27 20:53:11 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=f5c6c43d4c3910d5f8d61c0fae4582d863baa066

commit f5c6c43d4c3910d5f8d61c0fae4582d863baa066
Author:     Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2021-08-27 20:40:05 +0000
Commit:     Alan Somers <asomers@FreeBSD.org>
CommitDate: 2021-08-27 20:52:45 +0000

    Add a regression test for ggatec remote code execution

    Tests that ggatec appropriately handles unsupported BIO operations,
    rather than overflowing a buffer.

    Submitted by:   Johannes Bruelltuete <johannes@jo-t.de>
    PR:             213479
    Reviewed by:    asomers
    Differential Revision: https://reviews.freebsd.org/D31318

 tests/sys/geom/class/gate/ggate_test.sh | 34 +++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)