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, 9 Mar 2018 15:16:35 +0800
From:   Jason Wang <jasowang@...hat.com>
To:     Jesper Dangaard Brouer <brouer@...hat.com>,
        BjörnTöpel <bjorn.topel@...el.com>,
        magnus.karlsson@...el.com
Cc:     netdev@...r.kernel.org, eugenia@...lanox.com,
        John Fastabend <john.fastabend@...il.com>,
        Eran Ben Elisha <eranbe@...lanox.com>,
        Saeed Mahameed <saeedm@...lanox.com>, galp@...lanox.com,
        Daniel Borkmann <borkmann@...earbox.net>,
        Alexei Starovoitov <alexei.starovoitov@...il.com>,
        Tariq Toukan <tariqt@...lanox.com>
Subject: Re: [bpf-next V2 PATCH 06/15] tun: convert to use generic xdp_frame
 and xdp_return_frame API



On 2018年03月08日 23:16, Jesper Dangaard Brouer wrote:
> Hi Jason,
>
> Please see below FIXME, which is actually a question to you.
>
> On Thu, 08 Mar 2018 14:08:11 +0100 Jesper Dangaard Brouer <brouer@...hat.com> wrote:
>
>> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
>> index 475088f947bb..cd046cf31b77 100644
>> --- a/drivers/net/tun.c
>> +++ b/drivers/net/tun.c
> [...]
>
>> @@ -1290,17 +1290,18 @@ static const struct net_device_ops tun_netdev_ops = {
>>   static int tun_xdp_xmit(struct net_device *dev, struct xdp_buff *xdp)
>>   {
>>   	struct tun_struct *tun = netdev_priv(dev);
>> -	struct xdp_buff *buff = xdp->data_hard_start;
>> -	int headroom = xdp->data - xdp->data_hard_start;
>> +	struct xdp_frame *frame;
>>   	struct tun_file *tfile;
>>   	u32 numqueues;
>>   	int ret = 0;
>>   
>> -	/* Assure headroom is available and buff is properly aligned */
>> -	if (unlikely(headroom < sizeof(*xdp) || tun_is_xdp_buff(xdp)))
>> -		return -ENOSPC;
>> +	/* FIXME: Explain why this check is the needed! */
>> +	if (unlikely(tun_is_xdp_frame(xdp)))
>> +		return -EBADRQC;
>>   
>> -	*buff = *xdp;
>> +	frame = convert_to_xdp_frame(xdp);
>> +	if (unlikely(!frame))
>> +		return -EOVERFLOW;
> To Jason, in the FIXME, I'm inheriting a check you put in, but I don't
> understand why this check was needed?
>

Sorry for the late reply.

I think it was used to make sure to not use misaligned or invalid 
pointer that caller passed to us.

Thanks

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ