Re: [PATCH] sched: core: fix out of bounds read in sched_init_numa()

From: Rik van Riel
Date: Fri Nov 07 2014 - 13:50:01 EST


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/07/2014 09:53 AM, Andrey Ryabinin wrote:

> Zero 'level' (e.g. on non-NUMA system) causing out of bounds
> access in this line:
>
> sched_max_numa_distance = sched_domains_numa_distance[level - 1];
>
> Fix this by exiting from sched_init_numa() earlier.
>
> Signed-off-by: Andrey Ryabinin <a.ryabinin@xxxxxxxxxxx> Fixes:
> 9942f79ba ("sched/numa: Export info needed for NUMA balancing on
> complex topologies")

Reviewed-by: Rik van Riel <riel@xxxxxxxxxx>

> Another option would be to not call sched_init_numa() if
> nr_node_ids == 1, but I'm not sure that there is no such
> configuration where nr_node_ids > 1 and node_distance(i, j) =
> node_distance(0, 0) for any i and j.

When there is only one node, the distance from the node to itself
will always be equal to node_distance(0, 0)

I am somewhat surprised we go through all of sched_init_numa on
a non-numa system, though :)

- --
All rights reversed
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAEBAgAGBQJUXRQ1AAoJEM553pKExN6D+h4H/jWfrFnEJFJMIrZU/nK5EcHg
CiUGVJH2f4jL6qCSRIIduxyyu9qggsQ5Qp7Ci5bfGm98Sj89DNnXUv4sarPWT3zA
KIDM+BuKFjKSXfCjcwrCkBP6x8gIYgCLR3hSThmq/MPrbNULy+1SUslb77i3kmBK
OhLrjSC0SQty5yvGkCfWYGGh7rRboRcfVyckvODRRdhwHtBP1p/seDNWHadAeX+d
WRNqdqJkvwwJ+eW9e7e009+OqB2EmS9xKBjXGIc7zEehfgOaeROQZ8sL7exs2g3n
6gtnWpn4firR15BSaHdK8kaEmsReWUZdrIebNVsUDmErN97O/AJ9UygJ5wUenzQ=
=YPeU
-----END PGP SIGNATURE-----
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/