kboot: Implement dup(2)
Early in boot, we need to create the normal stdin/out/err env for the
boot loader to run in. To do that, we need to open the console and
duplicate the file descriptors which requires dup(2). Implement a
wrapper as host_dup.
Sponsored by: Netflix
(cherry picked from commit bc84de741dfd3b81cc7d332f8e6f0d84afe4eee1)