Flexible I/O Tester development
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Eric Sandeen <sandeen@redhat.com>, fio@vger.kernel.org
Subject: Re: [PATCH 1/3] client: sanitize FIO_NET_CMD_SENDFILE requests
Date: Thu, 17 Sep 2026 14:47:41 -0600	[thread overview]
Message-ID: <ff4f6468-e7f1-4346-9192-a59fa863a2a7@kernel.dk> (raw)
In-Reply-To: <62500f3e-1211-41ee-997c-fd5aac3a56fc@redhat.com>

On 9/17/26 2:46 PM, Eric Sandeen wrote:
> On 9/17/26 3:00 PM, Jens Axboe wrote:
>> On 9/17/26 1:41 PM, Eric Sandeen wrote:
>>> A legitimate fio server should only be requesting files from the
>>> client's cwd; reject absolute paths or any paths above the cwd.
>>>
>>> Since this adds yet another failure mode, move fail: to the end of
>>> the function as is a bit more typical for a goto fail;
>>>
>>> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
>>> ---
>>>  client.c | 23 ++++++++++++++++++-----
>>>  1 file changed, 18 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/client.c b/client.c
>>> index 374a744a..b32c2852 100644
>>> --- a/client.c
>>> +++ b/client.c
>>> @@ -1809,12 +1809,18 @@ static int fio_send_file(struct fio_client *client, struct cmd_sendfile *pdu,
>>>  	size = sizeof(*rep);
>>>  	rep = malloc(size);
>>>  
>>> +	/* Sanitize requested path to reject files not under cwd */
>>> +	if (pdu->path[0] == '/' ||
>>> +	    strstr((const char *)pdu->path, "..") != NULL) {
>>> +		log_err("fio: rejecting sendfile request for unsafe path: %s\n",
>>> +			(const char *)pdu->path);
>>> +		rep->error = EPERM;
>>> +		goto fail;
>>> +	}
>>
>> Won't this potentially break existing use cases?
> TBH I did this a while ago and never sent it, so let me re-check. I thought
> I had considered that at the time...
> 
> OK yeah, I guess it is too broad, I suppose if a job name has ".." in it,
> this would  cause improper rejections. I don't think anything legitimately
> tries to grab files on relative paths, though.
> 
> I'm guessing you think this isn't worth it either, and if so again I'm
> happy to just drop it. Or I could tighten it up to only catch things that
> really try to grab arbitrary paths outside of cwd.
> 
> I'm also leaning towards not worth it. :)

Not worth it.

-- 
Jens Axboe


  reply	other threads:[~2026-09-17 20:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17 19:41 [PATCH 0/3] Tidy up some client/server behaviors Eric Sandeen
2026-09-17 19:41 ` [PATCH 1/3] client: sanitize FIO_NET_CMD_SENDFILE requests Eric Sandeen
2026-09-17 20:00   ` Jens Axboe
2026-09-17 20:46     ` Eric Sandeen
2026-09-17 20:47       ` Jens Axboe [this message]
2026-09-17 19:41 ` [PATCH 2/3] client: don't send uninitialized data in fio_send_file error replies Eric Sandeen
2026-09-17 19:41 ` [PATCH 3/3] fio: server: Warn when listening on network Eric Sandeen
2026-09-17 20:01   ` Jens Axboe
2026-09-17 20:29     ` Eric Sandeen
2026-09-17 20:45       ` Jens Axboe
2026-09-17 20:46         ` Jens Axboe
2026-09-17 20:47         ` Eric Sandeen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ff4f6468-e7f1-4346-9192-a59fa863a2a7@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=fio@vger.kernel.org \
    --cc=sandeen@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox