On LP64 systems, address space is effectively free, and the security
folks have found a variety of ways to use large PROT_NONE regions. For
example, Android currently spends 3GiB on the CFI shadow and 7GiB
padding the scudo heap, meaning that even toybox cat has a VmSize around
10GiB. This means that the default ps output doesn't line up.

Arguably this should be a change to the default width (currently 7) of
the VSZ entry in the "typos" array, but as long as desktop Linux isn't
using its address space for security mitigations, that seemed like it
might be too contentious.
---
 toys/posix/ps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
From 1c33ef9f9d4461aa5bd17e1bbb66802d9e155e46 Mon Sep 17 00:00:00 2001
From: Elliott Hughes <e...@google.com>
Date: Thu, 23 Feb 2023 12:29:00 -0800
Subject: [PATCH] ps: widen the VSIZE field for Android's default view.

On LP64 systems, address space is effectively free, and the security
folks have found a variety of ways to use large PROT_NONE regions. For
example, Android currently spends 3GiB on the CFI shadow and 7GiB
padding the scudo heap, meaning that even toybox cat has a VmSize around
10GiB. This means that the default ps output doesn't line up.

Arguably this should be a change to the default width (currently 7) of
the VSZ entry in the "typos" array, but as long as desktop Linux isn't
using its address space for security mitigations, that seemed like it
might be too contentious.
---
 toys/posix/ps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/toys/posix/ps.c b/toys/posix/ps.c
index 1fdfc17c..d43379c3 100644
--- a/toys/posix/ps.c
+++ b/toys/posix/ps.c
@@ -1348,7 +1348,7 @@ void ps_main(void)
     not_o = "F,S,UID,%sPPID,C,PRI,NI,BIT,SZ,WCHAN,TTY,TIME,CMD";
   else if (CFG_TOYBOX_ON_ANDROID)
     sprintf(not_o = toybuf+128,
-            "USER,%%sPPID,VSIZE,RSS,WCHAN:10,ADDR:10,S,%s",
+            "USER,%%sPPID,VSIZE:10,RSS,WCHAN:10,ADDR:10,S,%s",
             FLAG(T) ? "CMD" : "NAME");
   sprintf(toybuf, not_o, FLAG(T) ? "PID,TID," : "PID,");
 
-- 
2.39.2.722.g9855ee24e9-goog

_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to