diff options
author | Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> | 2016-02-14 19:04:09 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2016-02-26 14:36:24 +0100 |
commit | 5fa9fefddce56fab75b2e6c88c4516e2b21d2f5a (patch) | |
tree | fd83192c6bc05746002ae2a015d3c7fbbe51f97b /shell/ash_test/ash-misc/for.right | |
parent | 03718bb2743fbd772732a2c57c76c1c56fa9cd37 (diff) | |
download | busybox-5fa9fefddce56fab75b2e6c88c4516e2b21d2f5a.tar.gz |
taskset: fix non-fancy cpuset printing on big-endian
The non-fancy version of the from_cpuset uses CPU_SETSIZE as if it
represents the number of bytes in the cpuset, while it is actually
the number of bits. This leads to out-of-bounds accesses on the
cpu_set_t in the big-endian case. Basically all uses of CPU_SETSIZE
have to be divided by 8. This is done correctly in the fancy version
of from_cpuset.
In addition, the big-endian case is completely wrong to begin with.
All standard C libraries that I know of implement cpu_set_t as an
unsigned long array, so both for big and little endian, the least
significant bits are in the beginning of the array. Therefore, the
approach taken for the little endian case is equally valid. We only
need special handling for big endian when CPU_SETSIZE is large and
we use an unsigned long long to get more bits out.
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/ash_test/ash-misc/for.right')
0 files changed, 0 insertions, 0 deletions