Convert 'alloc_obj' family to use the new default GFP_KERNEL argumentThis was done entirely with mindless brute force, using git grep -l '\<k[vmz]*alloc_objs*(.*, GFP_KERNEL)' | xargs
Convert 'alloc_obj' family to use the new default GFP_KERNEL argumentThis was done entirely with mindless brute force, using git grep -l '\<k[vmz]*alloc_objs*(.*, GFP_KERNEL)' | xargs sed -i 's/\(alloc_objs*(.*\), GFP_KERNEL)/\1)/'to convert the new alloc_obj() users that had a simple GFP_KERNELargument to just drop that argument.Note that due to the extreme simplicity of the scripting, any slightlymore complex cases spread over multiple lines would not be triggered:they definitely exist, but this covers the vast bulk of the cases, andthe resulting diff is also then easier to check automatically.For the same reason the 'flex' versions will be done as a separateconversion.Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
show more ...
treewide: Replace kmalloc with kmalloc_obj for non-scalar typesThis is the result of running the Coccinelle script fromscripts/coccinelle/api/kmalloc_objs.cocci. The script is designed toavoid sc
treewide: Replace kmalloc with kmalloc_obj for non-scalar typesThis is the result of running the Coccinelle script fromscripts/coccinelle/api/kmalloc_objs.cocci. The script is designed toavoid scalar types (which need careful case-by-case checking), andinstead replace kmalloc-family calls that allocate struct or unionobject instances:Single allocations: kmalloc(sizeof(TYPE), ...)are replaced with: kmalloc_obj(TYPE, ...)Array allocations: kmalloc_array(COUNT, sizeof(TYPE), ...)are replaced with: kmalloc_objs(TYPE, COUNT, ...)Flex array allocations: kmalloc(struct_size(PTR, FAM, COUNT), ...)are replaced with: kmalloc_flex(*PTR, FAM, COUNT, ...)(where TYPE may also be *VAR)The resulting allocations no longer return "void *", instead returning"TYPE *".Signed-off-by: Kees Cook <kees@kernel.org>
parisc: fix unaligned accesses in BPFThere were spurious unaligned access warnings when calling BPF code.Sometimes, the warnings were triggered with any incoming packet, makingthe machine hard to
parisc: fix unaligned accesses in BPFThere were spurious unaligned access warnings when calling BPF code.Sometimes, the warnings were triggered with any incoming packet, makingthe machine hard to use.The reason for the warnings is this: on parisc64, pointers to functionsare not really pointers to functions, they are pointers to 16-bytedescriptor. The first 8 bytes of the descriptor is a pointer to thefunction and the next 8 bytes of the descriptor is the content of the"dp" register. This descriptor is generated in the functionbpf_jit_build_prologue.The problem is that the function bpf_int_jit_compile advertises 4-bytealignment when calling bpf_jit_binary_alloc, bpf_jit_binary_allocrandomizes the returned array and if the array happens to be not alignedon 8-byte boundary, the descriptor generated in bpf_jit_build_prologue isalso not aligned and this triggers the unaligned access warning.Fix this by advertising 8-byte alignment on parisc64 when callingbpf_jit_binary_alloc.Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>Cc: stable@vger.kernel.orgSigned-off-by: Helge Deller <deller@gmx.de>
bpf: Take return from set_memory_rox() into account with bpf_jit_binary_lock_ro()set_memory_rox() can fail, leaving memory unprotected.Check return and bail out when bpf_jit_binary_lock_ro() retu
bpf: Take return from set_memory_rox() into account with bpf_jit_binary_lock_ro()set_memory_rox() can fail, leaving memory unprotected.Check return and bail out when bpf_jit_binary_lock_ro() returnsan error.Link: https://github.com/KSPP/linux/issues/7Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>Cc: linux-hardening@vger.kernel.org <linux-hardening@vger.kernel.org>Reviewed-by: Kees Cook <keescook@chromium.org>Reviewed-by: Puranjay Mohan <puranjay12@gmail.com>Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com> # s390xAcked-by: Tiezhu Yang <yangtiezhu@loongson.cn> # LoongArchReviewed-by: Johan Almbladh <johan.almbladh@anyfinetworks.com> # MIPS PartMessage-ID: <036b6393f23a2032ce75a1c92220b2afcb798d5d.1709850515.git.christophe.leroy@csgroup.eu>Signed-off-by: Alexei Starovoitov <ast@kernel.org>
parisc: Add eBPF JIT compiler glue code and MakefileSigned-off-by: Helge Deller <deller@gmx.de>
parisc: Add 64-bit eBPF JIT compilerSigned-off-by: Helge Deller <deller@gmx.de>
parisc: Add 32-bit eBPF JIT compilerSigned-off-by: Helge Deller <deller@gmx.de>