Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BugFix] Fix use-after-free when set_call_back #26738

Merged
merged 1 commit into from
Jul 10, 2023

Conversation

stdpain
Copy link
Contributor

@stdpain stdpain commented Jul 7, 2023

For short-circuiting cases, this may result in the spiller being destructed early but the querycontext not being destructed, which can lead to use-after-free

fix such problem:

*** Aborted at 1688627331 (unix time) try "date -d @1688627331" if you are using GNU date ***
PC: @     0x7f7b534e69d5 __GI_raise
*** SIGABRT (@0x3e900237c64) received by PID 2325604 (TID 0x7f7a69fef640) from PID 2325604; stack trace: ***
    @          0x59bd9c2 google::(anonymous namespace)::FailureSignalHandler()
    @     0x7f7b5369b1d0 (unknown)
    @     0x7f7b534e69d5 __GI_raise
    @     0x7f7b534cf894 __GI_abort
    @          0x237c0d2 _ZN9__gnu_cxx27__verbose_terminate_handlerEv.cold
    @          0x787cad6 __cxxabiv1::__terminate()
    @          0x787cb41 std::terminate()
    @          0x787d1ff __cxa_pure_virtual
    @          0x2997fab starrocks::spill::RawSpillerWriter::acquire_stream()
    @          0x28f7603 _ZZN9starrocks5spill24PartitionedSpillerWriter5flushIRNS0_14IOTaskExecutorERNS0_23ResourceMemTrackerGuardIJSt8weak_ptrINS_8pipeline12QueryContextEEEEEEENS_6StatusEPNS_12RuntimeStateEOT_OT0_ENKUlvE0_clEv
    @          0x28f8c84 _ZNSt17_Function_handlerIFvvEZN9starrocks5spill24PartitionedSpillerWriter5flushIRNS2_14IOTaskExecutorERNS2_23ResourceMemTrackerGuardIJSt8weak_ptrINS1_8pipeline12QueryContextEEEEEEENS1_6StatusEPNS1_12RuntimeStateEOT_OT0_EUlvE0_E9_M_invokeERKSt9_Any_data
    @          0x2624271 starrocks::workgroup::ScanExecutor::worker_thread()
    @          0x488f0f2 starrocks::ThreadPool::dispatch_thread()
    @          0x4889bea starrocks::Thread::supervise_thread()
    @     0x7f7b536903fb start_thread
    @     0x7f7b535acc23 __GI___clone
    @                0x0 (unknown)
start time: Thu Jul 6 03:09:15 PM CST 2023

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr will affect users' behaviors
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 3.1
    • 3.0
    • 2.5
    • 2.4

Signed-off-by: stdpain <drfeng08@gmail.com>
@mergify mergify bot assigned stdpain Jul 7, 2023
@stdpain stdpain enabled auto-merge (squash) July 7, 2023 12:06
@stdpain stdpain merged commit 298f16f into StarRocks:main Jul 10, 2023
42 of 46 checks passed
@wanpengfei-git
Copy link
Collaborator

@Mergifyio backport branch-3.1

@github-actions github-actions bot removed the 3.1 label Jul 10, 2023
@wanpengfei-git
Copy link
Collaborator

@Mergifyio backport branch-3.0

@github-actions github-actions bot removed the 3.0 label Jul 10, 2023
@mergify
Copy link
Contributor

mergify bot commented Jul 10, 2023

backport branch-3.1

✅ Backports have been created

@mergify
Copy link
Contributor

mergify bot commented Jul 10, 2023

backport branch-3.0

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Jul 10, 2023
Signed-off-by: stdpain <drfeng08@gmail.com>
(cherry picked from commit 298f16f)

# Conflicts:
#	be/src/exec/aggregator.cpp
#	be/src/exec/hash_joiner.cpp
#	be/src/exec/pipeline/aggregate/spillable_aggregate_blocking_sink_operator.cpp
#	be/src/exec/pipeline/aggregate/spillable_aggregate_blocking_source_operator.cpp
#	be/src/exec/pipeline/aggregate/spillable_aggregate_distinct_blocking_operator.cpp
#	be/src/exec/pipeline/hashjoin/spillable_hash_join_build_operator.cpp
#	be/src/exec/pipeline/hashjoin/spillable_hash_join_probe_operator.cpp
#	be/src/exec/pipeline/sort/spillable_partition_sort_sink_operator.cpp
#	be/src/exec/pipeline/spill_process_operator.cpp
#	be/src/exec/spillable_chunks_sorter_full_sort.cpp
mergify bot pushed a commit that referenced this pull request Jul 10, 2023
Signed-off-by: stdpain <drfeng08@gmail.com>
(cherry picked from commit 298f16f)

# Conflicts:
#	be/src/exec/spill/executor.h
stdpain added a commit to stdpain/starrocks-2 that referenced this pull request Jul 10, 2023
Signed-off-by: stdpain <drfeng08@gmail.com>

Signed-off-by: stdpain <34912776+stdpain@users.noreply.github.com>
stdpain added a commit that referenced this pull request Jul 10, 2023
Signed-off-by: stdpain <drfeng08@gmail.com>

Signed-off-by: stdpain <34912776+stdpain@users.noreply.github.com>
stdpain added a commit to stdpain/starrocks-2 that referenced this pull request Jul 10, 2023
…)"

This reverts commit 1800e54.

Signed-off-by: stdpain <drfeng08@gmail.com>
stdpain added a commit to stdpain/starrocks-2 that referenced this pull request Jul 21, 2023
Signed-off-by: stdpain <drfeng08@gmail.com>
stdpain added a commit that referenced this pull request Jul 21, 2023
Signed-off-by: stdpain <drfeng08@gmail.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.

None yet

4 participants