[Bug 201350] loader nextboot will leave trash in stack

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sun Jul 5 00:19:20 UTC 2015


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 at FreeBSD.org
          Reporter: tsoome at 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.


More information about the freebsd-bugs mailing list