Skip to content

Fix the bug which make SSL channel raise false buffer overflow alert. - #62

Merged
kidkun merged 1 commit into
linkedin:2.3-lifrom
kidkun:ssl_overflow
Jan 17, 2020
Merged

Fix the bug which make SSL channel raise false buffer overflow alert.#62
kidkun merged 1 commit into
linkedin:2.3-lifrom
kidkun:ssl_overflow

Conversation

@kidkun

@kidkun kidkun commented Dec 11, 2019

Copy link
Copy Markdown

Observed following exception in broker logs

java.lang.IllegalStateException: Buffer overflow when available data size (16384) >= application buffer size (16384)
at org.apache.kafka.common.network.SslTransportLayer.read(SslTransportLayer.java:551) ~[kafka-clients-2.3.0.11.jar:?]
...

This is from Kafka's SslTransportLayer's handling logic of BUFFER_OVERFLOW returned from SslEnigne.unwrap(), which potentially expand the buffer size and then check buffer.position()
is less than buffer.capacity(), otherwise throws an Exception.

The sanity check here checks is too strict since the invariant Buffer provides is

0 <= mark <= position <= limit <= capacity

So position == capacity just means the buffer is full not overflow.

@andrewchoi5 andrewchoi5 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm.

@xiowu0 xiowu0 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kidkun
kidkun merged commit 4a0ec76 into linkedin:2.3-li Jan 17, 2020
gitlw pushed a commit that referenced this pull request Jun 1, 2020
)

    TICKET =
    LI_DESCRIPTION = SslTransportLayer takes netBuffer/appBuffer full as buffer overflow and close the connection unnecessarily.
    
    EXIT_CRITERIA = MANUAL [""]
gitlw pushed a commit that referenced this pull request Jun 12, 2020
)

    TICKET =
    LI_DESCRIPTION = SslTransportLayer takes netBuffer/appBuffer full as buffer overflow and close the connection unnecessarily.
    
    EXIT_CRITERIA = MANUAL [""]
gitlw pushed a commit that referenced this pull request Jun 13, 2020
)

    TICKET =
    LI_DESCRIPTION = SslTransportLayer takes netBuffer/appBuffer full as buffer overflow and close the connection unnecessarily.
    
    EXIT_CRITERIA = MANUAL [""]
wyuka added a commit that referenced this pull request Mar 10, 2022
* [LI-HOTFIX] Add support to use BoringSSL for SSL/TLS.

TICKET = KAFKA-2561
LI_DESCRIPTION =
Make Kafka capable of using BoringSSL for encryption.
EXIT_CRITERIA = TICKET [KAFKA-2561]

* Removed unused imports

* [LI-HOTFIX] Fix SSL channel close on fake buffer overflow/underflow (#62)

    TICKET =
    LI_DESCRIPTION = SslTransportLayer takes netBuffer/appBuffer full as buffer overflow and close the connection unnecessarily.

    EXIT_CRITERIA = MANUAL [""]

* Fix failing unit tests.

Co-authored-by: kun du <kdu@linkedin.com>
lmr3796 pushed a commit to lmr3796/kafka that referenced this pull request Mar 25, 2022
Cherry picked commit:
* [LI-HOTFIX] Add support to use BoringSSL for SSL/TLS.

TICKET = KAFKA-2561
LI_DESCRIPTION =
Make Kafka capable of using BoringSSL for encryption.
EXIT_CRITERIA = TICKET [KAFKA-2561]

* Removed unused imports

* [LI-HOTFIX] Fix SSL channel close on fake buffer overflow/underflow (linkedin#62)

    TICKET =
    LI_DESCRIPTION = SslTransportLayer takes netBuffer/appBuffer full as buffer overflow and close the connection unnecessarily.

    EXIT_CRITERIA = MANUAL [""]

* Fix failing unit tests.

Co-authored-by: kun du <kdu@linkedin.com>
lmr3796 pushed a commit to lmr3796/kafka that referenced this pull request Jun 2, 2022
Cherry picked commit:
* [LI-HOTFIX] Add support to use BoringSSL for SSL/TLS.

TICKET = KAFKA-2561
LI_DESCRIPTION =
Make Kafka capable of using BoringSSL for encryption.
EXIT_CRITERIA = TICKET [KAFKA-2561]

* Removed unused imports

* [LI-HOTFIX] Fix SSL channel close on fake buffer overflow/underflow (linkedin#62)

    TICKET =
    LI_DESCRIPTION = SslTransportLayer takes netBuffer/appBuffer full as buffer overflow and close the connection unnecessarily.

    EXIT_CRITERIA = MANUAL [""]

* Fix failing unit tests.

Co-authored-by: kun du <kdu@linkedin.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants