lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 29 Jan 2021 13:50:56 -0800
From:   Jakub Kicinski <kuba@...nel.org>
To:     Chris Mi <cmi@...dia.com>
Cc:     netdev@...r.kernel.org, jiri@...dia.com, saeedm@...dia.com,
        kernel test robot <lkp@...el.com>
Subject: Re: [PATCH net-next v4] net: psample: Introduce stubs to remove NIC
 driver dependency

On Thu, 28 Jan 2021 09:45:43 +0800 Chris Mi wrote:
> In order to send sampled packets to userspace, NIC driver calls
> psample api directly. But it creates a hard dependency on module
> psample. Introduce psample_ops to remove the hard dependency.
> It is initialized when psample module is loaded and set to NULL
> when the module is unloaded.
> 
> Reported-by: kernel test robot <lkp@...el.com>
> Signed-off-by: Chris Mi <cmi@...dia.com>
> Reviewed-by: Jiri Pirko <jiri@...dia.com>

> diff --git a/include/net/psample.h b/include/net/psample.h
> index 68ae16bb0a4a..e6a73128de59 100644
> --- a/include/net/psample.h
> +++ b/include/net/psample.h
> @@ -4,6 +4,7 @@
>  
>  #include <uapi/linux/psample.h>
>  #include <linux/list.h>
> +#include <linux/skbuff.h>

Forward declaration should be enough.

>  struct psample_group {
>  	struct list_head list;

>  static void __exit psample_module_exit(void)
>  {
> +	RCU_INIT_POINTER(psample_ops, NULL);

I think you can use rcu_assign_pointer(), it handles constants 
right these days.

Please add a comment here saying that you depend on
genl_unregister_family() executing synchronize_rcu() 
and name the function where it does so.

>  	genl_unregister_family(&psample_nl_family);
>  }

> diff --git a/net/sched/psample_stub.c b/net/sched/psample_stub.c
> new file mode 100644
> index 000000000000..0615a7b64000
> --- /dev/null
> +++ b/net/sched/psample_stub.c
> @@ -0,0 +1,7 @@
> +// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
> +/* Copyright (c) 2021 Mellanox Technologies. */
> +
> +#include <net/psample.h>

Forward declaration is sufficient.

> +const struct psample_ops __rcu *psample_ops __read_mostly;
> +EXPORT_SYMBOL_GPL(psample_ops);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ