Patch "s390/bpf: Let arch_prepare_bpf_trampoline return program size" has been added to the 6.5-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    s390/bpf: Let arch_prepare_bpf_trampoline return program size

to the 6.5-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     s390-bpf-let-arch_prepare_bpf_trampoline-return-prog.patch
and it can be found in the queue-6.5 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit d10a17429162accce0e9031e2af6bdbcc074f4de
Author: Song Liu <song@xxxxxxxxxx>
Date:   Mon Sep 18 23:02:57 2023 -0700

    s390/bpf: Let arch_prepare_bpf_trampoline return program size
    
    [ Upstream commit cf094baa3e0f19f1f80ceaf205c80402b024386c ]
    
    arch_prepare_bpf_trampoline() for s390 currently returns 0 on success. This
    is not a problem for regular trampoline. However, struct_ops relies on the
    return value to advance "image" pointer:
    
    bpf_struct_ops_map_update_elem() {
        ...
        for_each_member(i, t, member) {
            ...
            err = bpf_struct_ops_prepare_trampoline();
            ...
            image += err;
        }
    }
    
    When arch_prepare_bpf_trampoline returns 0 on success, all members of the
    struct_ops will point to the same trampoline (the last one).
    
    Fix this by returning the program size in arch_prepare_bpf_trampoline (on
    success). This is the same behavior as other architectures.
    
    Signed-off-by: Song Liu <song@xxxxxxxxxx>
    Fixes: 528eb2cb87bc ("s390/bpf: Implement arch_prepare_bpf_trampoline()")
    Reviewed-by: Ilya Leoshkevich <iii@xxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230919060258.3237176-2-song@xxxxxxxxxx
    Signed-off-by: Alexei Starovoitov <ast@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c
index de2fb12120d2e..2861e3360affc 100644
--- a/arch/s390/net/bpf_jit_comp.c
+++ b/arch/s390/net/bpf_jit_comp.c
@@ -2513,7 +2513,7 @@ int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image,
 			return -E2BIG;
 	}
 
-	return ret;
+	return tjit.common.prg;
 }
 
 bool bpf_jit_supports_subprog_tailcalls(void)



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux