Skip to content

server: fix SIGSEGV caused by port probing with audit plugin#16038

Merged
jackysp merged 2 commits intopingcap:masterfrom
lysu:fix-segv-audit
Apr 3, 2020
Merged

server: fix SIGSEGV caused by port probing with audit plugin#16038
jackysp merged 2 commits intopingcap:masterfrom
lysu:fix-segv-audit

Conversation

@lysu
Copy link
Contributor

@lysu lysu commented Apr 3, 2020

What problem does this PR solve?

Issue Number: close #16037

Problem Summary:

port probing will establish tcp connection, then exit without send any auth packet, so conn's session ctx should be nil and this cause crash in audit plugin code path.

What is changed and how it works?

What's Changed:

ensure session ctx is not nil before do reject audit.

How it Works:

check nil

Related changes

  • Need to cherry-pick to the release branch

Check List

Tests

  • Manual test
start tidb with audit plugin, and telnet 0.0.0.0 4000 then control-c to exit telent

and watch tidb-stderr.log

Side effects

  • n/a

Release note


This change is Reviewable

@lysu
Copy link
Contributor Author

lysu commented Apr 3, 2020

/run-unit-test

@codecov
Copy link

codecov bot commented Apr 3, 2020

Codecov Report

Merging #16038 into master will decrease coverage by 0.0695%.
The diff coverage is 0%.

@@               Coverage Diff                @@
##             master     #16038        +/-   ##
================================================
- Coverage   80.5421%   80.4725%   -0.0696%     
================================================
  Files           507        506         -1     
  Lines        136613     135343      -1270     
================================================
- Hits         110031     108914      -1117     
+ Misses        18062      17918       -144     
+ Partials       8520       8511         -9

Copy link
Contributor

@jackysp jackysp left a comment

Choose a reason for hiding this comment

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

LGTM

@jackysp jackysp added the status/LGT1 Indicates that a PR has LGTM 1. label Apr 3, 2020
Copy link

@imtbkcat imtbkcat left a comment

Choose a reason for hiding this comment

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

LGTM

@lysu
Copy link
Contributor Author

lysu commented Apr 3, 2020

/merge

1 similar comment
@jackysp
Copy link
Contributor

jackysp commented Apr 3, 2020

/merge

@jackysp
Copy link
Contributor

jackysp commented Apr 3, 2020

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Apr 3, 2020

cherry pick to release-3.0 in PR #16064

@sre-bot
Copy link
Contributor

sre-bot commented Apr 3, 2020

cherry pick to release-3.1 in PR #16065

shuke987 pushed a commit that referenced this pull request May 19, 2020
jackysp added a commit to jackysp/tidb that referenced this pull request May 19, 2020
jackysp added a commit to bb7133/tidb that referenced this pull request May 19, 2020
server: fix SIGSEGV caused by port probing with audit plugin (pingcap#16038)…(pingcap#17291)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/plugin component/server status/LGT1 Indicates that a PR has LGTM 1. type/bugfix This PR fixes a bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SIGSEGV caused by port probing with audit plugin enable

4 participants