[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH v2] lib/ukboot: Fix handling of main arguments


  • To: minios-devel@xxxxxxxxxxxxx
  • From: Costin Lupu <costin.lupu@xxxxxxxxx>
  • Date: Sat, 8 Jun 2019 11:06:07 +0300
  • Cc: felipe.huici@xxxxxxxxx, simon.kuenzer@xxxxxxxxx
  • Delivery-date: Sat, 08 Jun 2019 08:06:28 +0000
  • Ironport-phdr: 9a23:gaWWTxzVC+gnQ1bXCy+O+j09IxM/srCxBDY+r6Qd2+0RIJqq85mqBkHD//Il1AaPAdyCrasY1KGP6f2ocFdDyK7JiGoFfp1IWk1NouQttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXdrXKo8DEdBAj0OxZrKeTpAI7SiNm82/yv95HJbAhEmSexbalvIBi5rwjdudQajZViJ60s1hbHv3xEdvhMy2h1P1yThRH85smx/J5n7Stdvu8q+tBDX6vnYak2VKRUAzs6PW874s3rrgTDQhCU5nQASGUWkwFHDBbD4RrnQ5r+qCr6tu562CmHIc37SK0/VDq+46t3ThLjlSEKPCM7/m7KkMx9lKJVrgy8qRJxwIDaZ5qYOOZicq7HYd8XX3ZNUtpXWidcAo28dYwPD+8ZMOtGqIn9vEcOrRq4BQKxAu3v1ydIhmLr1qA9z+shFhrG3BAhH9IIqnjUqMj1NL8PUe2u0KbI1i/Pb+tL2Tjm8oTIaBchrOiKULltcsTR0VEiGx7Kg1mNs4DoPDOY2v4Tv2SF7edsT+yih3Y6pwx+vzSj3MQhh4nTio4LxF3J+z91zJs6KNGmTkNwfMSqH4FKty6AMot7WsYiQ2Z1tykk0rAGopu7fDQSyJQg2h7fd+SLc4iW7RLnU+acOSl4hHd/d7K+gxa+61SvyvbmWsmszVZFtTBJksPLtnwV1hzT7NaISudl80u81juDyhrf5+JELEwui6bXNZwszqQ+m5YLtETMBC72mEH4jK+McUUk//Cl5PjgYrX9up+cNol0hhv6MqQzgsy/HP81PRQVX2SB4eS8yabs8VfjQLVNlvE2iLXWsIjGJcQHoa60GwpV0ocl6xa+CDemy80UkmQZI1JbZh2Hi5PkO1XPIPDjEfe/mE6gkTh1yPDAJLHhBY/NLnfbmrf7Ybl981JcyBY0zd1H6ZJbFLUBIPPrWkDvrtDYDgI5Mw2ozObmE9h90J0RVn6LAqCDK6zeq0GH5v83KemWeIAVoCr9K+Qi5/P2ln85mFodfa6v3ZcNa3C4A+ppI0OYYHXymNcMCmEKsRQiQ+zuklKNSiRfaGivX/F02jZuDYOgDIDYA4ygnrGF9CO6BYFNIHBLDBaLC3i7WZ+DXqInbzmOI8kptiEcSPD1QIg6yRCo8gvn06dPJfGS4jAS84jkgosmr9bPnA0/oGQnR/+W1HuAGjl5
  • Ironport-sdr: A/Z6avIribvLQwGEtacQoc77SYc4MBPvHGG2/HCdCzHGS69x5J2dFeopbsVC8dWNV8n1KFohTH RQ3Sg+GHQeaA==
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>

When the command line is parsed and split into arguments, each argument is saved
in an array of pointers allocated on the stack ('argv' array in
ukplat_entry_argp()). This means that the array can be overwritten anytime
before starting the main thread which needs the arguments. This patch fixes that
by making the array static.

Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
---
 lib/ukboot/boot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/ukboot/boot.c b/lib/ukboot/boot.c
index 4dcc0afb..97c7d18b 100644
--- a/lib/ukboot/boot.c
+++ b/lib/ukboot/boot.c
@@ -145,7 +145,7 @@ static void main_thread_func(void *arg)
 /* defined in <uk/plat.h> */
 void ukplat_entry_argp(char *arg0, char *argb, __sz argb_len)
 {
-       char *argv[CONFIG_LIBUKBOOT_MAXNBARGS];
+       static char *argv[CONFIG_LIBUKBOOT_MAXNBARGS];
        int argc = 0;
 
        if (arg0) {
-- 
2.11.0


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.