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

Fix segmentation fault error when using Linux Framebuffer DRM mode with AOT compilation #14266

Merged
merged 1 commit into from
Jan 19, 2024

Conversation

BenniSim
Copy link
Contributor

What does the pull request do?

Changes how the offsets uint array variable is instantiated for the Avalonia.LinuxFramebuffer.Output.DrmOutput:GetFbIdForBo(IntPtr bo) method, so that it's explicitly created as a 4-length array.

What is the current behavior?

When compilting an Avalonia application with AOT compilation, at least for the linux-64 runtime with the .NET 8.0 SDK, if DRM mode is used then a fatal Segmentation fault will be thrown from the invoked libdrm library. This appears to be due to the aforementioned offsets variable being a zero-length array when the library tries to copy data into it.

The application when built via JIT compilation seems to be clever enough to figure out that the array must have a certain length, but when compiled with AOT does not.

What is the updated/expected behavior with this PR?

The libdrm function successfully manages to copy memory to the offsets variable, even when application is AOT compiled.

How was the solution implemented (if it's not obvious)?

Explicitly instantializes the offsets variable as a 4-length uint array, rather than as an empty array.

Checklist

Breaking changes

Obsoletions / Deprecations

Fixed issues

Fixes #14227

@BenniSim
Copy link
Contributor Author

@dotnet-policy-service agree

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.1.999-cibuild0043696-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@maxkatz6 maxkatz6 added this pull request to the merge queue Jan 18, 2024
@maxkatz6 maxkatz6 added backport-candidate-11.0.x Consider this PR for backporting to 11.0 branch os-linux labels Jan 18, 2024
Merged via the queue into AvaloniaUI:master with commit 26d5245 Jan 19, 2024
6 checks passed
maxkatz6 pushed a commit that referenced this pull request Feb 8, 2024
…th AOT compilation (#14266)

Co-authored-by: Benjamin Simonsson <benjamin.simonsson@plejd.com>
@maxkatz6 maxkatz6 added backported-11.0.x and removed backport-candidate-11.0.x Consider this PR for backporting to 11.0 branch labels Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Linux Framebuffer DRM mode + AOT compilation leads to Segmentation Fault on linux-x64
3 participants