[PATCH bpf v2 0/2] Fix narrow loads from an offset outside of target field

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

 



This is a second attempt at fixing narrow loads from context fields backed
by smaller-in-size target fields, when load offset is beyond the target
field.

Following Yonghong suggestion, verifier now emits an 'wX = 0' or 'rX = 0'
instruction for loads from offsets outside of target field.

Cc: Yonghong Song <yhs@xxxxxx>

[v1] https://lore.kernel.org/bpf/20200710173123.427983-1-jakub@xxxxxxxxxxxxxx/

Jakub Sitnicki (2):
  bpf: Load zeros for narrow loads beyond target field
  selftests/bpf: Add test for narrow loads from context at an offset

 kernel/bpf/verifier.c                         | 23 ++++-
 .../selftests/bpf/prog_tests/narrow_load.c    | 84 +++++++++++++++++++
 .../selftests/bpf/progs/test_narrow_load.c    | 43 ++++++++++
 3 files changed, 148 insertions(+), 2 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/narrow_load.c
 create mode 100644 tools/testing/selftests/bpf/progs/test_narrow_load.c

-- 
2.25.4




[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