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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 02 Nov 2015 12:39:48 -0800
From:	Joe Perches <joe@...ches.com>
To:	madalin.bucur@...escale.com
Cc:	netdev@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
	linux-kernel@...r.kernel.org, davem@...emloft.net,
	scottwood@...escale.com, igal.liberman@...escale.com,
	roy.pledge@...escale.com, ppc@...dchasers.com, pebolle@...cali.nl,
	joakim.tjernlund@...nsmode.se, gregkh@...uxfoundation.org,
	Ioana Ciornei <ioana.ciornei@...escale.com>
Subject: Re: [net-next v4 6/8] dpaa_eth: add ethtool statistics

On Mon, 2015-11-02 at 19:31 +0200, Madalin Bucur wrote:
> Add a series of counters to be exported through ethtool:
> - add detailed counters for reception errors;
> - add detailed counters for QMan enqueue reject events;
> - count the number of fragmented skbs received from the stack;
> - count all frames received on the Tx confirmation path;
> - add congestion group statistics;
> - count the number of interrupts for each CPU.
[]
> diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c b/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c
[]
> +static void dpa_get_strings(struct net_device *net_dev, u32 stringset, u8 *data)
> +{
> +	unsigned int i, j, num_cpus, size;
> +	char string_cpu[ETH_GSTRING_LEN];
> +	u8 *strings;
> +
> +	strings   = data;
> +	num_cpus  = num_online_cpus();
> +	size      = DPA_STATS_GLOBAL_LEN * ETH_GSTRING_LEN;
> +
> +	for (i = 0; i < DPA_STATS_PERCPU_LEN; i++) {
> +		for (j = 0; j < num_cpus; j++) {
> +			snprintf(string_cpu, ETH_GSTRING_LEN, "%s [CPU %d]",
> +				 dpa_stats_percpu[i], j);
> +			memcpy(strings, string_cpu, ETH_GSTRING_LEN);
> +			strings += ETH_GSTRING_LEN;
> +		}
> +		snprintf(string_cpu, ETH_GSTRING_LEN, "%s [TOTAL]",
> +			 dpa_stats_percpu[i]);
> +		memcpy(strings, string_cpu, ETH_GSTRING_LEN);
> +		strings += ETH_GSTRING_LEN;
> +	}
> +	memcpy(strings, dpa_stats_global, size);
> +}

This leaks uninitialized stack via a memcpy of uninitialized
string_cpu bytes into user-space.

Using
	char string_cpu[ETH_GSTRING_LEN] = {};
or a memset before each snprintf would fix it.


--
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