-
Notifications
You must be signed in to change notification settings - Fork 723
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
Support wasm architecture #1552
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//go:build !wasm | ||
|
||
package internal | ||
|
||
import "os" | ||
|
||
func Getpagesize() int { | ||
return os.Getpagesize() | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
//go:build wasm | ||
|
||
package internal | ||
|
||
func Getpagesize() int { | ||
// A WebAssembly page has a constant size of 65,536 bytes, i.e., 64KiB | ||
return 64 * 1024 | ||
lmb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,14 @@ var ( | |
// invalidBPFObjNameChar returns true if char may not appear in | ||
// a BPF object name. | ||
func invalidBPFObjNameChar(char rune) bool { | ||
dotAllowed := objNameAllowsDot() == nil | ||
var dotAllowed bool | ||
if runtime.GOOS == "js" { | ||
// In Javascript environments, BPF objects are not going to be | ||
// loaded to a kernel, so we can use dots without testing. | ||
dotAllowed = true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why isn't this logic in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did some reading on this last week, apparently ENOSYS is returned by much of the tinygo syscall package for wasm. This would be a good sentinel to conclude that a syscall can't be made and we need to fall back to a sane default. We can make things on the Windows side behave similarly, so high-level logic only needs to check for ENOSYS. cc @lmb There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I discovered this in a different issue / PR and wrote a comment there, ofc can't find it now. I think the real fix is to not take the os into account from the ELF reader. Basically calling SanitizeName from there is wrong. Resolving that would also remove the need for this work around. I'll see whether I can figure something out. |
||
} else { | ||
dotAllowed = objNameAllowsDot() == nil | ||
} | ||
|
||
switch { | ||
case char >= 'A' && char <= 'Z': | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bummer I think. How would we prevent this list from ever expanding as the ELF reader changes?