-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[lldb][debugserver] Max response size for qSpeedTest #156099
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
[lldb][debugserver] Max response size for qSpeedTest #156099
Conversation
Only allow qSpeedTest packet size requests up to 4MB. Allocate the temporary buffer for the packet on the heap, instead of stack. rdar://158630250
@llvm/pr-subscribers-lldb Author: Jason Molenda (jasonmolenda) ChangesThe qSpeedTest packet is used for experiments to determine the optimal packet size for a given communication medium, e.g. to transfer 10MB of memory, is it faster to send a hundred 100KB packets or ten 1MB packets. It creates a packet of the requested size in a stack allocation, but is not checking that its buffer is large enough for the requested size. Change this allocation to be on heap, and impose a maximum size that can be tested (4MB, for now). rdar://158630250 Full diff: https://github.com/llvm/llvm-project/pull/156099.diff 1 Files Affected:
diff --git a/lldb/tools/debugserver/source/RNBRemote.cpp b/lldb/tools/debugserver/source/RNBRemote.cpp
index 102b2ab3e8484..d9fb22c6a1c06 100644
--- a/lldb/tools/debugserver/source/RNBRemote.cpp
+++ b/lldb/tools/debugserver/source/RNBRemote.cpp
@@ -4423,12 +4423,12 @@ rnb_err_t RNBRemote::HandlePacket_qSpeedTest(const char *p) {
return HandlePacket_ILLFORMED(
__FILE__, __LINE__, p,
"Didn't find response_size value at right offset");
- else if (*end == ';') {
- static char g_data[4 * 1024 * 1024 + 16];
- strcpy(g_data, "data:");
- memset(g_data + 5, 'a', response_size);
- g_data[response_size + 5] = '\0';
- return SendPacket(g_data);
+ else if (*end == ';' && response_size < (4 * 1024 * 1024)) {
+ std::vector<char> buf(response_size + 6, 'a');
+ memcpy(buf.data(), "data:", 5);
+ buf[buf.size() - 1] = '\0';
+ rnb_err_t return_value = SendPacket(buf.data());
+ return return_value;
} else {
return SendErrorPacket("E79");
}
|
* main: (1483 commits) [clang] fix error recovery for invalid nested name specifiers (llvm#156772) Revert "[lldb] Add count for errors of DWO files in statistics and combine DWO file count functions" (llvm#156777) AMDGPU: Add agpr variants of multi-data DS instructions (llvm#156420) [libc][NFC] disable localtime on aarch64/baremetal (llvm#156776) [win/asan] Improve SharedReAlloc with HEAP_REALLOC_IN_PLACE_ONLY. (llvm#132558) [LLDB] Make internal shell the default for running LLDB lit tests. (llvm#156729) [lldb][debugserver] Max response size for qSpeedTest (llvm#156099) [AMDGPU] Define 1024 VGPRs on gfx1250 (llvm#156765) [flang] Check for BIND(C) name conflicts with alternate entries (llvm#156563) [RISCV] Add exhausted_gprs_fprs test to calling-conv-half.ll. NFC (llvm#156586) [NFC] Remove trailing whitespaces from `clang/include/clang/Basic/AttrDocs.td` [lldb] Mark scripted frames as synthetic instead of artificial (llvm#153117) [docs] Refine some of the wording in the quality developer policy (llvm#156555) [MLIR] Apply clang-tidy fixes for readability-identifier-naming in TransformOps.cpp (NFC) [MLIR] Add LDBG() tracing to VectorTransferOpTransforms.cpp (NFC) [NFC] Apply clang-format to PPCInstrFutureMMA.td (llvm#156749) [libc] implement template functions for localtime (llvm#110363) [llvm-objcopy][COFF] Update .symidx values after stripping (llvm#153322) Add documentation on debugging LLVM. [lldb] Add count for errors of DWO files in statistics and combine DWO file count functions (llvm#155023) ...
The qSpeedTest packet is used for experiments to determine the optimal packet size for a given communication medium, e.g. to transfer 10MB of memory, is it faster to send a hundred 100KB packets or ten 1MB packets. It creates a packet of the requested size in a stack allocation, but is not checking that its buffer is large enough for the requested size. Change this allocation to be on heap, and impose a maximum size that can be tested (4MB, for now). rdar://158630250 (cherry picked from commit ac8e7be)
…max-packet-size [lldb][debugserver] Max response size for qSpeedTest (llvm#156099)
The qSpeedTest packet is used for experiments to determine the optimal packet size for a given communication medium, e.g. to transfer 10MB of memory, is it faster to send a hundred 100KB packets or ten 1MB packets. It creates a packet of the requested size in a stack allocation, but is not checking that its buffer is large enough for the requested size. Change this allocation to be on heap, and impose a maximum size that can be tested (4MB, for now). rdar://158630250 (cherry picked from commit ac8e7be)
…packet-cap-20240723 [lldb][debugserver] Max response size for qSpeedTest (llvm#156099)
The qSpeedTest packet is used for experiments to determine the optimal packet size for a given communication medium, e.g. to transfer 10MB of memory, is it faster to send a hundred 100KB packets or ten 1MB packets. It creates a packet of the requested size in a stack allocation, but is not checking that its buffer is large enough for the requested size. Change this allocation to be on heap, and impose a maximum size that can be tested (4MB, for now). rdar://158630250 (cherry picked from commit ac8e7be)
…-speedtest-packet-6.2.1 [lldb][debugserver] Max response size for qSpeedTest (llvm#156099)
The qSpeedTest packet is used for experiments to determine the optimal packet size for a given communication medium, e.g. to transfer 10MB of memory, is it faster to send a hundred 100KB packets or ten 1MB packets. It creates a packet of the requested size in a stack allocation, but is not checking that its buffer is large enough for the requested size.
Change this allocation to be on heap, and impose a maximum size that can be tested (4MB, for now).
rdar://158630250