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

BUG: unsigned int is not enough for passing pointers to machine_call #109

Closed
pranjalchanda08 opened this issue Feb 19, 2022 · 1 comment · Fixed by #110
Closed

BUG: unsigned int is not enough for passing pointers to machine_call #109

pranjalchanda08 opened this issue Feb 19, 2022 · 1 comment · Fixed by #110
Assignees
Labels
bug-critical System failure can be predicted cyancore framework Cyancore framework feature request
Projects

Comments

@pranjalchanda08
Copy link
Contributor

Describe the bug
Using unsigned int means restricting the size to 2 or 4 bytes max which does not comply with pointers which can acquire up-to 8 bytes of space when using pointers. Hence it is a huge vulnerability for inter-arch switch.

Expected behavior
To be able to pass pointers through the mcalls irrespective of any arch.

Workaround
To introduce a user-defined type which switches between the data-type sizes as required.

Eg:

#if defined(ARCH_ARM_32)
#define __CALL_ARG_TYPE__ unsigned long

#elif defined(ARCH_RISCV_64) || defined(ARCH_ARM_64)
#define __CALL_ARG_TYPE__ unsigned long

#else
#define __CALL_ARG_TYPE__ unsigned int

#endif

typedef __CALL_ARG_TYPE__ call_args;
@pranjalchanda08 pranjalchanda08 added cyancore framework Cyancore framework feature request bug-critical System failure can be predicted labels Feb 19, 2022
@pranjalchanda08 pranjalchanda08 linked a pull request Feb 19, 2022 that will close this issue
@pranjalchanda08 pranjalchanda08 added this to the Release #3 v2.2.1 milestone Feb 19, 2022
@pranjalchanda08 pranjalchanda08 added this to Issues in Terravisor via automation Feb 19, 2022
@pranjalchanda08 pranjalchanda08 linked a pull request Feb 19, 2022 that will close this issue
2 tasks
Terravisor automation moved this from Issues to Done Feb 19, 2022
@pranjalchanda08
Copy link
Contributor Author

The changes are performed in respective arch.h

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-critical System failure can be predicted cyancore framework Cyancore framework feature request
Projects
Development

Successfully merging a pull request may close this issue.

2 participants