[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    taskset fails on big endian system (mips)
From:       Karl Vogel <karl.vogel () gmail ! com>
Date:       2013-06-10 7:21:27
Message-ID: 87hah6jurs.fsf () ubuntu ! karlslan ! org
[Download RAW message or body]

In busybox/miscutils/taskset.c the function from_cpuset has following
logic for big endian systems:

---
#if BB_BIG_ENDIAN
    /* For big endian, it means LAST bits */
    if (CPU_SETSIZE < sizeof(long))
        p += CPU_SETSIZE - sizeof(int);
    else if (CPU_SETSIZE < sizeof(long long))
        p += CPU_SETSIZE - sizeof(long);
    else
        p += CPU_SETSIZE - sizeof(long long);
#endif
---

First issue is that CPU_SETSIZE is in bits, while this calculation
uses it as bytes, so we overwrite part of the stack from the calling
function.

Another issue on the platform I'm running it on, is that CPU_SETSIZE
is 1024 bits (128 bytes). This logic here takes the last "long long"
out of the structure, but the result is actually stored in the first
few bytes of the structure. I'm not sure if all big endian systems
follow this logic?!

The "fancy feature" implementation on the other hand, works fine.

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic