Masks and overflow of signed immediates in BPF instructions

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

 



Hello.

The selftest progs/verifier_masking.c contains inline assembly code
like:

  	w1 = 0xffffffff;

The 32-bit immediate of that instruction is signed.  Therefore, GAS
complains that the above instruction overflows its field:

  /tmp/ccNOXFQy.s:46: Error: signed immediate out of range, shall fit in 32 bits

The llvm assembler is likely relying on signed overflow for the above to
work.

Using negative numbers to denote masks is ugly and obfuscating (for
non-obvious cases like -1/0xffffffff) so I suggest we introduce a
pseudo-op so we can do:

   w1 = %mask(0xffffffff)

allowing the assembler to do the right thing (TM) converting and
checking that the mask is valid and not relying on UB.

Thoughts?




[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