Skip to contentSkip to conversation

BPF_PSEUDO_CALL function calls are not allowed while holding a lock

DISCUSSION Barret Rhoden 1 participant 1 message Mar 2, 2023 BPF

lore
Share & tools
lore
#0 lore raw

Hi -

I'd like to be able to hold a BPF spinlock and call a static function elsewhere in my BPF program.

Depending on whether the compiler chooses to inline a function or not, I'll get a verifier error like:

	573: (85) call pc+126
	function calls are not allowed while holding a lock

I think that's considered a BPF_PSEUDO_CALL.

I can get around it by sprinkling __attribute__((always_inline)) all over the place, subject to the compiler actually inlining my functions.

Would it be possible for the verifier to maintain the env->cur_state->active_lock.ptr state or something across those calls?

Thanks,
Barret