Giter Club home page Giter Club logo

Comments (3)

wenyongh avatar wenyongh commented on June 6, 2024

invoke_native_with_hw_bound_check and call_wasm_with_hw_bound_check have native stack overflow checks against native_stack_boundary + page_size * (guard_page_count + 1). i don't understand where this + 1 came from. @wenyongh do you remember?

@yamt I remember that it is to reserve some stack space to ensure the runtime can successfully call to the AOT function, for example, avoiding core dump at os_setjmp, since wasm_exec_env_push_jmpbuf has been executed before it, if os_setjmp failed, then in the signal handler, the wrong jmpbuf will be popped for os_longjmp to jump. And we had better let stack overflow occurs in AOT code, not sure whether occurring in runtime part (e.g. wasm_runtime_invoke_native) will cause unexpected behavior.

from wasm-micro-runtime.

yamt avatar yamt commented on June 6, 2024

invoke_native_with_hw_bound_check and call_wasm_with_hw_bound_check have native stack overflow checks against native_stack_boundary + page_size * (guard_page_count + 1). i don't understand where this + 1 came from. @wenyongh do you remember?

@yamt I remember that it is to reserve some stack space to ensure the runtime can successfully call to the AOT function, for example, avoiding core dump at os_setjmp, since wasm_exec_env_push_jmpbuf has been executed before it, if os_setjmp failed, then in the signal handler, the wrong jmpbuf will be popped for os_longjmp to jump.

it doesn't seem to make much sense to me because native_stack_boundary at this point already includes WASM_STACK_GUARD_SIZE adjustment, which should be enough for the jmpbuf setup.

And we had better let stack overflow occurs in AOT code, not sure whether occurring in runtime part (e.g. wasm_runtime_invoke_native) will cause unexpected behavior.

it makes sense.
i'm thinking to separate stack consumption of native functions from WASM_STACK_GUARD_SIZE.

from wasm-micro-runtime.

wenyongh avatar wenyongh commented on June 6, 2024

Yes, after some amendings, the code may look a little confusing, please help enhance it if you are glad to.

from wasm-micro-runtime.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.