MPTCP Linux Development
 help / color / mirror / Atom feed
From: Matthieu Baerts <matttbe@kernel.org>
To: Geliang Tang <geliang@kernel.org>, mptcp@lists.linux.dev
Cc: Geliang Tang <tanggeliang@kylinos.cn>
Subject: Re: [PATCH mptcp-next v7 2/4] selftests/bpf: Add getsockopt to inspect mptcp subflow
Date: Wed, 4 Sep 2024 12:35:52 +0200	[thread overview]
Message-ID: <5c2feea4-21ff-442e-91b3-bc7eecca4c4c@kernel.org> (raw)
In-Reply-To: <a6721d3d1700413d9e815a057267be55273f6f34.camel@kernel.org>

On 04/09/2024 12:09, Geliang Tang wrote:
> On Tue, 2024-09-03 at 11:11 +0200, Matthieu Baerts wrote:
>> On 03/09/2024 10:04, Geliang Tang wrote:

(...)

>>> +SEC("cgroup/getsockopt")
>>> +int _getsockopt_subflow(struct bpf_sockopt *ctx)
>>> +{
>>> +	struct bpf_sock *sk = ctx->sk;
>>> +
>>> +	if (!sk) {
>>> +		bpf_printk("MPTCP Subflow: unexpected socket, sk
>>> is NULL");
>>> +		ctx->retval = -1;
>>> +		return 1;
>>> +	}
>>> +
>>> +	if (ctx->level == SOL_SOCKET && ctx->optname == SO_MARK)
>>> +		ctx->retval = _check_getsockopt_subflow_mark(sk);
>>> +	else if (ctx->level == SOL_TCP && ctx->optname ==
>>> TCP_CONGESTION)
>>> +		ctx->retval = _check_getsockopt_subflow_cc(sk);
>>
>> As I mentioned in my previous reply: can ctx->retval be < 0 here,
>> before
>> calling _check_getsockopt_subflow_XXX()?
>> If yes or not sure, maybe safer to do:
>>
>>   err = _check_getsockopt_subflow_XXX()
>>   (...)
>>
>>   if (err)
>>       ctx->retval = -1;
>     else
>         ctx->retval = 0;
> 
> Otherwise:
> 
> 86: (63) *(u32 *)(r6 +0) = r1
> dereference of modified ctx ptr R6 off=36 disallowed
> processed 169 insns (limit 1000000) max_states_per_insn 2 total_states
> 15 peak_states 15 mark_read 4
> -- END PROG LOAD LOG --

Sorry, I'm not familiar with these errors: do you mean that 'retval'
always need to be set? But in a previous version you sent, 'retval' was
only set to -1 in case of error, no?

The error message doesn't seem to say that.
Are you sure it is not because 'err' was not initialised, or something
like that?

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.


  reply	other threads:[~2024-09-04 10:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-03  8:04 [PATCH mptcp-next v7 0/4] fixes for "new MPTCP subflow subtest v4" Geliang Tang
2024-09-03  8:04 ` [PATCH mptcp-next v7 1/4] Squash to "selftests/bpf: Add mptcp subflow example" Geliang Tang
2024-09-03  8:04 ` [PATCH mptcp-next v7 2/4] selftests/bpf: Add getsockopt to inspect mptcp subflow Geliang Tang
2024-09-03  9:11   ` Matthieu Baerts
2024-09-03  9:16     ` Matthieu Baerts
2024-09-04  9:55       ` Geliang Tang
2024-09-04 10:29         ` Matthieu Baerts
2024-09-04 10:09     ` Geliang Tang
2024-09-04 10:35       ` Matthieu Baerts [this message]
2024-09-03  8:04 ` [PATCH mptcp-next v7 3/4] Squash to "selftests/bpf: Add mptcp subflow subtest" Geliang Tang
2024-09-03  8:05 ` [PATCH mptcp-next v7 4/4] Squash to "selftests/bpf: Add bpf scheduler test" Geliang Tang
2024-09-03  8:59 ` [PATCH mptcp-next v7 0/4] fixes for "new MPTCP subflow subtest v4" MPTCP CI

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=5c2feea4-21ff-442e-91b3-bc7eecca4c4c@kernel.org \
    --to=matttbe@kernel.org \
    --cc=geliang@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=tanggeliang@kylinos.cn \
    /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