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]
Message-ID: <473C6CB3.6040803@trash.net>
Date:	Thu, 15 Nov 2007 16:58:43 +0100
From:	Patrick McHardy <kaber@...sh.net>
To:	Eric Dumazet <dada1@...mosbay.com>
CC:	"David S. Miller" <davem@...emloft.net>,
	Linux Netdev List <netdev@...r.kernel.org>,
	Netfilter Development Mailinglist 
	<netfilter-devel@...ts.netfilter.org>
Subject: Re: [PATCH, take2] netfilter : struct xt_table_info diet

Eric Dumazet wrote:
> On Thu, 15 Nov 2007 13:41:54 +0100
> Patrick McHardy <kaber@...sh.net> wrote:
> 
>>> +#define XT_TABLE_INFO_SZ (offsetof(struct xt_table_info, entries) \
>>> +			  + nr_cpu_ids * sizeof(char *))
>>
>>>  	/* overflow check */
>>> -	if (tmp.size >= (INT_MAX - sizeof(struct xt_table_info)) / NR_CPUS -
>>> -			SMP_CACHE_BYTES)
>>> +	if (tmp.size >= INT_MAX / num_possible_cpus())
>>>  		return -ENOMEM;
>> We need to make sure offsetof(struct xt_table_info, entries) +
>> nr_cpu_ids * sizeof(char *) doesn't overflow, so why doesn't it
>> use nr_cpu_ids here as well?
>>
> 
> nr_cpu_ids is <= NR_CPUS, so XT_TABLE_INFO_SZ cannot overflow


Yes, but nr_cpu_ids is >= num_possible_cpus, which is what we're
using with your patch.

> The 'overflow check' we do here is in fact not very usefull now
> that we dont need to multiply tmp.size by NR_CPUS and potentially
> overflow the result.
> 
> We can delete the test, because kmalloc()/vmalloc() will probably
> fail gracefully if we ask too much memory.


You're right, I'll remove it. Thanks.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ