-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
vm: support console_cmd to run cmd to collect console log #5677
base: master
Are you sure you want to change the base?
Conversation
Hi Joey! |
Hi Alex, The console_cmd is to run this |
I would propose to run this command externally and redirect its output to the pipe. Syzkaller may read that pipe instead of command spawning. |
How to? |
@@ -134,6 +135,25 @@ func OpenAdbConsole(bin, dev string) (rc io.ReadCloser, err error) { | |||
return OpenRemoteConsole(bin, "-s", dev, "shell") | |||
} | |||
|
|||
// Open console log by cmd. | |||
func OpenConsoleByCmd(cmdline string) (rc io.ReadCloser, cmd *exec.Cmd, err error) { |
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.
Please note that other similar methods don't return exec.Cmd
explicitly -- the process is killed once rc.Close()
is called. There's no reason not to follow the approach here as well.
Console string `json:"console"` // console device name (e.g. "/dev/pts/0") | ||
Serial string `json:"serial"` // device serial to connect | ||
Console string `json:"console"` // console device name (e.g. "/dev/pts/0") | ||
ConsoleCmd string `json:"console_cmd"` // command to obtain device console log |
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.
Nit: you could also make it []string
to prevent the need to split by the whitespace (which won't work correctly if you need to pass e.g. strings).
@@ -149,10 +152,15 @@ func (pool *Pool) Create(workdir string, index int) (vmimpl.Instance, error) { | |||
if err := inst.repair(); err != nil { | |||
return nil, err | |||
} | |||
if inst.console == "" { | |||
if inst.console == "" && inst.consoleCmd == "" { |
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.
if inst.console != "" {
// ...
} else if inst.consoleCmd != "" {
// ...
} else {
// ...
}
would be more readable.
Before sending a pull request, please review Contribution Guidelines:
https://github.com/google/syzkaller/blob/master/docs/contributing.md