Re: [PATCH v2 bpf-next 03/17] bpf: Introduce BPF trampoline

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On Nov 7, 2019, at 3:09 PM, Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx> 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?



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux