Attention is currently required from: Jack Rosenthal. Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/52215 )
Change subject: linux_mtd: prevent corruption of flash when stdout/stderr is closed ......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
Generally, as this seems to be a problem of the CLI (flashrom_print_cb() using stdout/stderr I guess), I'd prefer a patch for the CLI, e.g. check if fstat() works on them or something like
that. Other programmers might suffer the same.
Are you aware of any other programmers that will write file contents directly to the flash like Linux MTD? Would be useful to add the same to them...
I don't think there are any. There are other programmers that use file I/O, though, e.g. anything TTY using. Chances seem low that they'd recognize text output as commands, I guess?
Patching just the CLI would not protect libflashrom users, unfortunately.
I'm not aware of any non-CLI code writing to stdout/stderr. That would be a bug. I just grepped and all I could find was serprog flushing stdout. That seems not very critical but should be fixed anyway.