Re: [PATCH bpf-next 2/2] selftests/bpf: validate nulled-out struct_ops program is handled properly

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

 



On 4/27/24 8:09 PM, Andrii Nakryiko wrote:
Add a selftests validating that it's possible to have some struct_ops
callback set declaratively, then disable it (by setting to NULL)
programmatically. Libbpf should detect that such program should be

such program should be /not/ loaded ?

loaded, even if host kernel doesn't have type information for it.


@@ -103,6 +104,10 @@ static void test_struct_ops_not_zeroed(void)
  	if (!ASSERT_OK_PTR(skel, "struct_ops_module_open"))
  		return;
+ skel->struct_ops.testmod_zeroed->zeroed = 0;
+	/* zeroed_op prog should be not loaded automatically now */
+	skel->struct_ops.testmod_zeroed->zeroed_op = NULL;
+
  	err = struct_ops_module__load(skel);
  	ASSERT_OK(err, "struct_ops_module_load");
@@ -118,6 +123,7 @@ static void test_struct_ops_not_zeroed(void)
  	 * value of "zeroed" is non-zero.
  	 */
  	skel->struct_ops.testmod_zeroed->zeroed = 0xdeadbeef;
+	skel->struct_ops.testmod_zeroed->zeroed_op = NULL;
  	err = struct_ops_module__load(skel);
  	ASSERT_ERR(err, "struct_ops_module_load_not_zeroed");





[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