[Toybox] Impact of global struct size

Rob Landley rob at landley.net
Thu Jan 4 17:14:22 PST 2024


On 1/4/24 18:30, enh wrote:
>> Between the two of them you can do things like check the current timestamp
>> without a system call. What they actually provide varies by OS (and then your
>> libc has to be taught to use each new capability out of there instead of making
>> the syscalls).
>>
>> "cat /proc/self/maps" and they're the last two entries if present.
> 
> (not necesssarily. aslr applies to them too.)

I thought that was in order of map creation, not the order they occurred in the
address space?

> funnily enough (as you can see from that link), argc is there too, so
> you don't have to count the entries in argv. (and although a null
> argv[0] is no longer allowed, that was allowed by linux until fairly
> recently.)

I really need to check in a lot of the dirty changes in my tree:

diff --git a/main.c b/main.c
index 3d9f612e..190e65cd 100644
--- a/main.c
+++ b/main.c
diff --git a/main.c b/main.c
index 3d9f612e..190e65cd 100644
--- a/main.c
+++ b/main.c
@@ -279,6 +280,7 @@ void toybox_main(void)
 int main(int argc, char *argv[])
 {
   // don't segfault if our environment is crazy
+  // TODO mooted by kernel commit dcd46d897adb7 5.17 kernel Jan 2022
   if (!*argv) return 127;

   // Snapshot stack location so we can detect recursion depth later.

It's the tabsplosion problem in code form...

Rob


More information about the Toybox mailing list