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

AddressSanitzer et al. exit leaves terminal echo disabled. #26

Open
AliceLR opened this issue Mar 6, 2021 · 3 comments
Open

AddressSanitzer et al. exit leaves terminal echo disabled. #26

AliceLR opened this issue Mar 6, 2021 · 3 comments

Comments

@AliceLR
Copy link
Contributor

AliceLR commented Mar 6, 2021

When xmp is terminated by AddressSanitizer, MemorySanitizer, etc. encountering an error and exiting, terminal echo is still turned off until manually fixed with stty echo, tput reset, or similar. I don't know what the correct solution is for this, but I tried adding an atexit hook to call reset_tty and it didn't help. This has been mildly annoying when diagnosing issues like libxmp/libxmp#319 with input files that cause a lot of ASan/MSan exits.

@debrouxl
Copy link

debrouxl commented Mar 6, 2021

Based on what some other projects do, I'd suggest:

  • either adding a special fuzzing-oriented mode to the existing xmp, enabled by a #define: reduced initialization (e.g. hard-coded null device), reduced / eliminated terminal setup, etc.
  • or probably better - slightly faster execution, no xmp source code clutter - making a second fuzzing-oriented libxmp front-end: a standalone, file-oriented (xmp_load_module_from_file), possibly slightly less bare-bones variant of the libfuzzer-based front-end I posted at OSS-Fuzz and/or libFuzzer integration. libxmp#302 - maybe basic module information could still be displayed upon successfully loading the module.

@sezero
Copy link
Collaborator

sezero commented Jun 7, 2021

Anyone has a patch for this?

@AliceLR
Copy link
Contributor Author

AliceLR commented Jun 10, 2021

Not yet. I think the first one wouldn't be all that much clutter to xmp, and ideally it'd just suppress the player display portion of the terminal output (which is presumably the reason echo/etc is changed). The driver portion could just be handled with the driver flag, if needed (WAV output or playback might be desirable in some cases). It'd also be good to have a way to target any arbitrary one of the four xmp_load_module* functions.

edit: -q suppresses the player portion but it also suppresses the other output (which might not matter much if libxmp is built with -DDEBUG).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants