Bug 15351 - latest 1.36.0 `sh -i` without tty segfaults
Summary: latest 1.36.0 `sh -i` without tty segfaults
Status: NEW
Alias: None
Product: Busybox
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: All Linux
: P5 major
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-24 05:36 UTC by Thiner Logoer
Modified: 2023-02-24 05:36 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thiner Logoer 2023-02-24 05:36:06 UTC
A quick way to check whether a busybox version has this bug:

```
user@~ $ docker pull busybox
Using default tag: latest
latest: Pulling from library/busybox
Digest: sha256:7b3ccabffc97de872a30dfd234fd972a66d247c8cfc69b0550f276481852627c
Status: Image is up to date for busybox:latest
docker.io/library/busybox:latest
user@~ $ docker run -ti --rm busybox sh
/ # 
/ # cat | sh -i

Segmentation fault (core dumped)
[1]+  Stopped (tty input)        cat | sh -i
/ # fg
cat | sh -i
```

This bug appears both in my manually compiled version and in docker shipped version, so it is not related to specific compiler or configs.

It seems that `sh -i` assumes stdin is a tty and will segfault when it is not. This bug does not appear in 1.35.0 but shows in 1.36.0 .