Skip to content

Commit

Permalink
Fix permissions issue in analyze uworker_main (#4348)
Browse files Browse the repository at this point in the history
Close testcases in postprocess.
Fixes: crbug.com/374738561
  • Loading branch information
jonathanmetzman authored Oct 23, 2024
1 parent 918a833 commit 60143b4
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
17 changes: 11 additions & 6 deletions src/clusterfuzz/_internal/bot/tasks/utasks/analyze_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@ def handle_analyze_no_revision_index(output):
handle_build_setup_error(output)


def handle_analyze_close_invalid_uploaded(output):
testcase = data_handler.get_testcase_by_id(output.uworker_input.testcase_id)
testcase_upload_metadata = query_testcase_upload_metadata(
output.uworker_input.testcase_id)
data_handler.close_invalid_uploaded_testcase(
testcase, testcase_upload_metadata, 'Irrelevant')


def prepare_env_for_main(testcase_upload_metadata):
"""Prepares the environment for execute_task."""
# Reset redzones.
Expand Down Expand Up @@ -411,14 +419,9 @@ def utask_main(uworker_input):

# See if we have to ignore this crash.
if crash_analyzer.ignore_stacktrace(state.crash_stacktrace):
# TODO(metzman): Handle this by closing the testcase on the trusted worker.
# Also, deal with the other cases where we are updating testcase comment
# in untrusted.
data_handler.close_invalid_uploaded_testcase(
testcase, testcase_upload_metadata, 'Irrelevant')
return uworker_msg_pb2.Output( # pylint: disable=no-member
analyze_task_output=analyze_task_output,
error_type=uworker_msg_pb2.ErrorType.UNHANDLED) # pylint: disable=no-member
error_type=uworker_msg_pb2.ErrorType.ANALYZE_CLOSE_INVALID_UPLOADED) # pylint: disable=no-member

test_for_reproducibility(fuzz_target, testcase, testcase_file_path, state,
test_timeout)
Expand Down Expand Up @@ -473,6 +476,8 @@ def handle_build_setup_error(output):
handle_analyze_no_revision_index,
uworker_msg_pb2.ErrorType.ANALYZE_NO_REVISIONS_LIST: # pylint: disable=no-member
handle_analyze_no_revisions_list_error,
uworker_msg_pb2.ErrorType.ANALYZE_CLOSE_INVALID_UPLOADED: # pylint: disable=no-member
handle_analyze_close_invalid_uploaded,
}).compose_with(
setup.ERROR_HANDLER,
uworker_handle_errors.UNHANDLED_ERROR_HANDLER,
Expand Down
3 changes: 2 additions & 1 deletion src/clusterfuzz/_internal/protos/uworker_msg.proto
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,6 @@ enum ErrorType {
FUZZ_DATA_BUNDLE_SETUP_FAILURE = 10;
FUZZ_NO_FUZZER = 11;
FUZZ_NO_FUZZ_TARGET_SELECTED = 13;
FUZZ_BAD_BUILD = 37;
PROGRESSION_REVISION_LIST_ERROR = 14;
PROGRESSION_BUILD_NOT_FOUND = 15;
PROGRESSION_NO_CRASH = 16;
Expand All @@ -380,6 +379,8 @@ enum ErrorType {
LIBFUZZER_MINIMIZATION_FAILED = 34;
CORPUS_PRUNING_FUZZER_SETUP_FAILED = 35;
CORPUS_PRUNING_ERROR = 36;
FUZZ_BAD_BUILD = 37;
ANALYZE_CLOSE_INVALID_UPLOADED = 38;
}

message Output {
Expand Down
Loading

0 comments on commit 60143b4

Please sign in to comment.