Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 05 Jul 2015 00:19:19 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 201350] loader nextboot will leave trash in stack
Message-ID:  <bug-201350-8@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=201350

            Bug ID: 201350
           Summary: loader nextboot will leave trash in stack
           Product: Base System
           Version: 11.0-CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: kern
          Assignee: freebsd-bugs@FreeBSD.org
          Reporter: tsoome@me.com

the include_nextboot_file word is using catch to intercept errors from file io,
and leaves trash in stack; 

it happens because before ['] peek_file catch the get_nextboot_conf_file leaves
stack as ( addr len ) and catch will restore stack pointer to the same state
(but not values!). to clean up, following update will do:

: include_nextboot_file
-  get_nextboot_conf_file
-  ['] peek_file catch
+  get_nextboot_conf_file               ( addr len )
+  ['] peek_file catch                  ( addr len code )
+  dup EOPEN = if
+    drop       ( drop exception code )
+    2drop      ( drop file name restored by catch )
+  else
+    throw
+  then


the throw/catch mechanism is described very nicely by
www.complang.tuwien.ac.at/anton/euroforth/ef98/milendorf98.pdf

btw, also related to nextboot, yes that strdup is leak and not needed at all;)
: get_nextboot_conf_file ( -- addr len )
-  nextboot_conf_file strget strdup     \ XXX is the strdup a leak ?
+  nextboot_conf_file strget
 ;

-- 
You are receiving this mail because:
You are the assignee for the bug.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-201350-8>