Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sock_shutdown a closed fd segfaults #3041

Closed
yagehu opened this issue Nov 19, 2023 · 1 comment
Closed

sock_shutdown a closed fd segfaults #3041

yagehu opened this issue Nov 19, 2023 · 1 comment
Labels
bug Something isn't working c-WASI good first issue Good for newcomers

Comments

@yagehu
Copy link
Contributor

yagehu commented Nov 19, 2023

Summary

fd_close any file descriptor then attempting to call sock_shutdown on it causes wasmedge CLI to segfault.

Current State

No response

Expected State

No response

Reproduction steps

(module
  (type (func))
  (type (func (param i32 i32 i32) (result i32)))
  (type (func (param i32)))
  (type (func (param i32) (result i32)))
  (import "wasi_snapshot_preview1" "sock_accept" (func $sock_shutdown (type 1)))
  (import "wasi_snapshot_preview1" "proc_exit" (func $proc_exit (type 2)))
  (import "wasi_snapshot_preview1" "fd_close" (func $fd_close (type 3)))
  (func $_start
    (call $fd_close
      (i32.const 2)
    )
    drop
    (call $sock_shutdown
      (i32.const 2)
      (i32.const 27)
      (i32.const 1337)
    )
    call $proc_exit
  )
  (memory 2)
  (export "memory" (memory 0))
  (export "_start" (func $_start))
)
  1. Build with options wat2wasm shutdown.wat -o shutdown.wasm
  2. Execute with flags wasmedge shutdown.wasm
  3. Get error
$ wasmedge shutdown.wasm
Segmentation fault (core dumped)

Screenshots

Any logs you want to share for showing the specific issue

No response

Components

CLI

WasmEdge Version or Commit you used

0.13.5

Operating system information

Fedora 39

Hardware Architecture

amd64

Compiler flags and options

No response

@yagehu yagehu added the bug Something isn't working label Nov 19, 2023
@dannypsnl
Copy link
Member

Reproducible

  1. macOS: 14.1.1, M2 Max
  2. wasmedge version 0.13.4-100-g8f37aedc

@hydai hydai added c-WASI good first issue Good for newcomers labels Nov 20, 2023
ibmibmibm added a commit that referenced this issue Nov 20, 2023
Signed-off-by: Shen-Ta Hsieh <beststeve@secondstate.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working c-WASI good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants