[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <22015BB9-7A84-4F5E-A8A5-D10CB9DA3AEE@fb.com>
Date: Thu, 7 Nov 2019 23:16:20 +0000
From: Song Liu <songliubraving@...com>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>
CC: Alexei Starovoitov <ast@...nel.org>,
"davem@...emloft.net" <davem@...emloft.net>,
"daniel@...earbox.net" <daniel@...earbox.net>,
"x86@...nel.org" <x86@...nel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"bpf@...r.kernel.org" <bpf@...r.kernel.org>,
Kernel Team <Kernel-team@...com>
Subject: Re: [PATCH v2 bpf-next 03/17] bpf: Introduce BPF trampoline
> On Nov 7, 2019, at 3:09 PM, Alexei Starovoitov <alexei.starovoitov@...il.com> wrote:
>
> On Thu, Nov 07, 2019 at 11:07:21PM +0000, Song Liu wrote:
>>
>>
>>>
>>>
>>>>> +
>>>>> +static int bpf_trampoline_update(struct bpf_prog *prog)
>>>>
>>>> Seems argument "prog" is not used at all?
>>>
>>> like one below ? ;)
>> e... I was really dumb... sorry..
>>
>> Maybe we should just pass the tr in?
>
> that would be imbalanced.
Hmm.. what do you mean by imbalanced?
>
>>>
>>>>> +{
>>>>> + struct bpf_trampoline *tr = prog->aux->trampoline;
>>>>> + void *old_image = tr->image + ((tr->selector + 1) & 1) * PAGE_SIZE/2;
>>>>> + void *new_image = tr->image + (tr->selector & 1) * PAGE_SIZE/2;
>>>>> + if (err)
>>>>> + goto out;
>>>>> + tr->selector++;
>>>>
>>>> Shall we do selector-- for unlink?
>>>
>>> It's a bit flip. I think it would be more confusing with --
>>
>> Right.. Maybe should use int instead of u64 for selector?
>
> No, since int can overflow.
I guess it is OK to overflow, no?
Powered by blists - more mailing lists