Skip to content

Commit

Permalink
in stream_on_receive probe, emit offset rather than pointer, as onl…
Browse files Browse the repository at this point in the history
…y USDT can subtract between payload and an address (as USDT can obtain the address of payload)
  • Loading branch information
kazuho committed Jan 29, 2025
1 parent 9963836 commit 05d92e1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions lib/quicly.c
Original file line number Diff line number Diff line change
Expand Up @@ -2184,14 +2184,15 @@ static quicly_error_t apply_stream_frame(quicly_stream_t *stream, quicly_stream_

if (apply_len != 0 || quicly_recvstate_transfer_complete(&stream->recvstate)) {
uint64_t buf_offset = frame->offset + frame->data.len - apply_len - stream->recvstate.data_off;
const void *apply_src = frame->data.base + frame->data.len - apply_len;
QUICLY_PROBE(STREAM_ON_RECEIVE, stream->conn, stream->conn->stash.now, stream, (size_t)buf_offset, apply_src, apply_len);
size_t apply_off = frame->data.len - apply_len;
QUICLY_PROBE(STREAM_ON_RECEIVE, stream->conn, stream->conn->stash.now, stream, (size_t)buf_offset, apply_off, apply_len);
QUICLY_LOG_CONN(stream_on_receive, stream->conn, {
PTLS_LOG_ELEMENT_SIGNED(stream_id, stream->stream_id);
PTLS_LOG_ELEMENT_UNSIGNED(off, buf_offset);
PTLS_LOG_APPDATA_ELEMENT_HEXDUMP(src, apply_src, apply_len);
PTLS_LOG_ELEMENT_UNSIGNED(buf_off, buf_offset);
PTLS_LOG_ELEMENT_UNSIGNED(apply_off, apply_off);
PTLS_LOG_ELEMENT_UNSIGNED(apply_len, apply_len);
});
stream->callbacks->on_receive(stream, (size_t)buf_offset, apply_src, apply_len);
stream->callbacks->on_receive(stream, (size_t)buf_offset, frame->data.base + apply_off, apply_len);
if (stream->conn->super.state >= QUICLY_STATE_CLOSING)
return QUICLY_ERROR_IS_CLOSING;
}
Expand Down
4 changes: 2 additions & 2 deletions quicly-probes.d
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ provider quicly {
probe stream_on_send_emit(struct st_quicly_conn_t *conn, int64_t at, struct st_quicly_stream_t *stream, size_t off,
size_t capacity);
probe stream_on_send_stop(struct st_quicly_conn_t *conn, int64_t at, struct st_quicly_stream_t *stream, int64_t err);
probe stream_on_receive(struct st_quicly_conn_t *conn, int64_t at, struct st_quicly_stream_t *stream, size_t off,
const void *src, size_t src_len);
probe stream_on_receive(struct st_quicly_conn_t *conn, int64_t at, struct st_quicly_stream_t *stream, size_t buf_off,
size_t apply_off, size_t apply_len);
probe stream_on_receive_reset(struct st_quicly_conn_t *conn, int64_t at, struct st_quicly_stream_t *stream, int64_t err);

probe enter_cc_limited(struct st_quicly_conn_t *conn, int64_t at, uint64_t pn);
Expand Down

0 comments on commit 05d92e1

Please sign in to comment.