Skip to content

add initial SFTP benchmark collection scripts - #784

Draft
JacobBarthelmeh wants to merge 7 commits into
wolfSSL:masterfrom
JacobBarthelmeh:sftp_benchmark
Draft

JacobBarthelmeh wants to merge 7 commits into
wolfSSL:masterfrom
JacobBarthelmeh:sftp_benchmark

Conversation

@JacobBarthelmeh

Copy link
Copy Markdown
Contributor

No description provided.

@JacobBarthelmeh JacobBarthelmeh self-assigned this Feb 24, 2025
@JacobBarthelmeh
JacobBarthelmeh force-pushed the sftp_benchmark branch 4 times, most recently from adec8e2 to ea11966 Compare February 25, 2025 23:07
Comment thread .github/workflows/sftp-benchmark.yml Outdated
Copilot AI balanced review requested due to automatic review settings September 30, 2026 02:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@JacobBarthelmeh
JacobBarthelmeh requested a balanced review from Copilot September 30, 2026 02:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

…SSH results, up timeout, remove password auth option with test

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #784

Scan targets checked: wolfssh-src, wolfssh-bugs
Coverage: 1 of 1 in-scope changed file(s) opened by the reviewer

Findings: 3
3 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Reported findings require changes before merge.

Review tier: Lite


#if !defined(WOLFSSH_NO_TIMESTAMP) && !defined(USE_WINDOWS_API) &&\
defined(EXAMPLE_SFTP_BENCHMARK)
ret = WFOPEN(NULL, &f, fullpath, "rb");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Benchmark sizes the remote path via local fopen instead of the transferred source file · Logic errors

fullpath is the remote SFTP path, but it is opened on the local filesystem. For PUT the size comes from the remote destination and not from local. Any remote path that does not also exist locally returns WS_BAD_FILE_E and aborts the transfer. The benchmark only works on loopback with a pre-copied file.

Suggested fix: For PUT, take the size from the local source file local. For GET, take it after the transfer from local or from the remote file attributes. Never fail the transfer because the size lookup failed.

return WS_BAD_FILE_E;
}
longBytes = (word32)WFTELL(NULL, f);
WREWIND(NULL, f);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

FILE handle opened for size measurement is never closed on the success path · Resource leaks

After WFTELL/WREWIND, f is never closed with WFCLOSE. Each benchmarked autopilot transfer leaks one open FILE stream and its file descriptor.

Suggested fix: Call WFCLOSE(NULL, f) right after the size is read, since the stream is not used again.
Basis: C11 7.21.5.1: fclose flushes and closes the stream and releases its resources; an unclosed stream is only released at program exit.

#if !defined(WOLFSSH_NO_TIMESTAMP) && !defined(USE_WINDOWS_API) &&\
defined(EXAMPLE_SFTP_BENCHMARK)
ret = WFOPEN(NULL, &f, fullpath, "rb");
if (ret != 0 || f == WBADFILE) return WS_BAD_FILE_E;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Early returns in benchmark block leak the SFTP name list from doBuildRemotePath · Resource leaks on error paths

When doBuildRemotePath has allocated name, the new return WS_BAD_FILE_E paths (open failure and seek failure) skip wolfSSH_SFTPNAME_list_free(name), which leaks the list.

Suggested fix: Free name with wolfSSH_SFTPNAME_list_free before each new early return, or send these failures to a common cleanup path.

Related known findings (similar but distinct; listed for context, not part of this finding)

  • F-10551 (open): File/function: candidate is in sftpclient.c/doAutopilot vs. F-10551 in wolfsftp.c/wolfSSH_SFTP_RecvOpenDir — different files and functions. Faulting operation: both are early error-return paths that skip freeing/unlinking an already-allocated list-type resource (SFTP name list vs. directory-list node) before returning an error code, so the general pattern is closely related. Root cause: 'new/existing error return bypasses required cleanup for a previously allocated resource' is shared, though the

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.

4 participants