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

SDL does not call usbh_core_deinit() on exit #45

Open
LoveMHz opened this issue Jun 25, 2023 · 1 comment
Open

SDL does not call usbh_core_deinit() on exit #45

LoveMHz opened this issue Jun 25, 2023 · 1 comment

Comments

@LoveMHz
Copy link

LoveMHz commented Jun 25, 2023

In its current implementation, SDL does not call usbh_core_deinit() on exit.

When software exits, or when an XBE is launched, the system performs a soft reset, but the kernel has no mechanisms, to my knowledge, that would reset the USB hardware (all retail software attempts to uninitialize previously initialized hardware on exit).

This leaves a brief amount of time where, from soft-reset to the next application re-initializing the USB stack, that memory corruption can occur due to the USB hardware now pointing to an invalid region of memory.

I understand that as implemented, it's implied that it's up to the application to call usbh_core_deinit(). Ref

I'm opening this issue because I can not find any proof that software is currently doing this, and I believe it is an anti-pattern to the design and implementation goals of SDL.

I believe we need to handle this better, and I'm open to discussing what would be the better implementation. Right now, I'm investigating any possible side effects that may arise from this type of change.

@JayFoxRox
Copy link
Member

JayFoxRox commented Jun 25, 2023

How about ref-counting in the USB stack?

@Ryzee119 is probably most familiar with that code

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

No branches or pull requests

2 participants