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-next>] [day] [month] [year] [list]
Date:   Sat, 10 Oct 2020 08:55:27 +0200
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     NazimeHandeHarputluogluhandeharput@...il.com
Cc:     Valentina Manea <valentina.manea.m@...il.com>,
        Shuah Khan <shuah@...nel.org>, linux-kernel@...r.kernel.org,
        linux-usb@...r.kernel.org, Dmitry Vyukov <dvyukov@...gle.com>,
        Andrey Konovalov <andreyknvl@...gle.com>,
        Hande Harputluoglu <handeharput@...il.com>,
        Nazime Hande Harputluoglu <handeharputlu@...gle.com>
Subject: Re: [PATCH] usbip, kcov: collect coverage from usbip client

On Fri, Oct 09, 2020 at 03:22:55PM +0000, NazimeHandeHarputluogluhandeharput@...il.com wrote:
> From: Nazime Hande Harputluoglu <handeharputlu@...gle.com>
> 
> Add kcov_remote_start()/kcov_remote_stop() annotations to the
> vhci_rx_loop() function, which is responsible for parsing USB/IP packets
> in USB/IP client.
> 
> Since vhci_rx_loop() threads are spawned per usbip device instance, the
> common kcov handle is used for kcov_remote_start()/stop() annotations
> (see Documentation/dev-tools/kcov.rst for details). As the result kcov
> can now be used to collect coverage from vhci_rx_loop() threads.
> 
> Signed-off-by: Nazime Hande Harputluoglu <handeharputlu@...gle.com>
> ---
>  drivers/usb/usbip/usbip_common.h | 2 ++
>  drivers/usb/usbip/vhci_rx.c      | 6 ++++--
>  drivers/usb/usbip/vhci_sysfs.c   | 2 ++
>  3 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/usbip/usbip_common.h b/drivers/usb/usbip/usbip_common.h
> index 8be857a4fa13..cbbf2aa8ac73 100644
> --- a/drivers/usb/usbip/usbip_common.h
> +++ b/drivers/usb/usbip/usbip_common.h
> @@ -277,6 +277,8 @@ struct usbip_device {
>  		void (*reset)(struct usbip_device *);
>  		void (*unusable)(struct usbip_device *);
>  	} eh_ops;
> +
> +        u64 kcov_handle;
>  };
>  
>  #define kthread_get_run(threadfn, data, namefmt, ...)			   \
> diff --git a/drivers/usb/usbip/vhci_rx.c b/drivers/usb/usbip/vhci_rx.c
> index 266024cbb64f..b2eb3e8c04b9 100644
> --- a/drivers/usb/usbip/vhci_rx.c
> +++ b/drivers/usb/usbip/vhci_rx.c
> @@ -260,8 +260,10 @@ int vhci_rx_loop(void *data)
>  	while (!kthread_should_stop()) {
>  		if (usbip_event_happened(ud))
>  			break;
> -
> -		vhci_rx_pdu(ud);
> +                
> +                kcov_remote_start_common(ud->kcov_handle);
> +                vhci_rx_pdu(ud);
> +                kcov_remote_stop();
>  	}
>  
>  	return 0;
> diff --git a/drivers/usb/usbip/vhci_sysfs.c b/drivers/usb/usbip/vhci_sysfs.c
> index be37aec250c2..4dfe3809ebbb 100644
> --- a/drivers/usb/usbip/vhci_sysfs.c
> +++ b/drivers/usb/usbip/vhci_sysfs.c
> @@ -9,6 +9,7 @@
>  #include <linux/net.h>
>  #include <linux/platform_device.h>
>  #include <linux/slab.h>
> +#include <linux/kcov.h>
>  
>  /* Hardening for Spectre-v1 */
>  #include <linux/nospec.h>
> @@ -383,6 +384,7 @@ static ssize_t attach_store(struct device *dev, struct device_attribute *attr,
>  	vdev->ud.sockfd     = sockfd;
>  	vdev->ud.tcp_socket = socket;
>  	vdev->ud.status     = VDEV_ST_NOTASSIGNED;
> +        vdev->ud.kcov_handle = kcov_common_handle();
>  
>  	spin_unlock(&vdev->ud.lock);
>  	spin_unlock_irqrestore(&vhci->lock, flags);
> -- 
> 2.28.0.1011.ga647a8990f-goog
> 

Please run checkpatch.pl on your patches before sending them out, so you
don't get grumpy maintainers telling you to run checkpatch.pl on your
patch...

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ