Thread (45 messages) 45 messages, 6 authors, 2019-11-08

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

From: Song Liu <hidden>
Date: 2019-11-07 23:16:39
Also in: bpf

On Nov 7, 2019, at 3:09 PM, Alexei Starovoitov [off-list ref] wrote:

On Thu, Nov 07, 2019 at 11:07:21PM +0000, Song Liu wrote:
quoted
quoted
quoted
quoted
+
+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?
quoted
quoted
quoted
quoted
+{
+	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?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help