In this article I read that Golang supports Openbsd Pledge:
http://undeadly.org/cgi?action=article&sid=20170323042425
Does it mean that only code written for OPENBsd can use it?
Has anyone looked into it?
Thank you.
In this article I read that Golang supports Openbsd Pledge:
http://undeadly.org/cgi?action=article&sid=20170323042425
Does it mean that only code written for OPENBsd can use it?
Has anyone looked into it?
Thank you.
Does it mean that only code written for OPENBsd can use it?
Yes.
Syscalls are only available on the systems which implement them.
While I haven’t used pledge
, I like the idea of it.
Hey it seems I managed to “pledge” some golang code
package main
import "golang.org/x/sys/unix"
import "fmt"
import "os"
func main() {
err := unix.Pledge("stdio",nil)
if err != nil {
fmt.Println("pledge error: ", err)
}
fmt.Println("Ciao!")
os.Exit(0)
}
If you try to change the “stdio” it will not work
What you can put in the Pledge function is a space separated list of arguments that you can find here:
https://man.openbsd.org/pledge.2
Of course I tried it on a OpendBsd SO and it is working there.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.