[WRAPPER] Check the validity of the path before my_execve - #4371
Open
Tianyu-Fu wants to merge 1 commit into
Open
[WRAPPER] Check the validity of the path before my_execve#4371Tianyu-Fu wants to merge 1 commit into
Tianyu-Fu wants to merge 1 commit into
Conversation
ptitSeb
requested changes
Sep 9, 2026
| if(!path) | ||
| return 0; | ||
| uintptr_t p = (uintptr_t)path; | ||
| for(size_t i = 0; i < 4096; ++i) { |
Owner
There was a problem hiding this comment.
the 4096 magic constant should be a MACRO constant instead
| return 0; | ||
| uintptr_t p = (uintptr_t)path; | ||
| for(size_t i = 0; i < 4096; ++i) { | ||
| if(!(getProtection_fast(p + i) & PROT_READ)) |
Owner
There was a problem hiding this comment.
Do not call getprotection if page didn't change, use a local cache.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Check the validity of the path before my_execve
Motivation
I tested the LTP support of box64 on RV development board A210 and partial execve testcases will trigger SEGV, such as execve03.
Before calling host execve(), my_execve() will first treat the guest path as a regular C string for user mode detection. But LTP passed in an illegal path parameter, causing the program to crash. Therefore, it is necessary to add a path validity check.
Test
Before repair
After repair
Checklist
ctest, 100% passmain