[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT PATCH] lib/vfscore: vfscore_put_fd: do not reject fd <= 2
As a temporary fix this should be fine. We may get issues when we have proper shutdown support. Since we are anyway revisiting vfscore soon, we could implement those 3 basic file descriptors non-static. Thanks! Reviewed-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx> On 13.02.20 10:55, Hugo Lefeuvre wrote: Rejecting fd <= 2 is legitimate in some way, since freeing std(in|out|err) might lead to crash if .f_count is 1. This is because stdin, stdout and stderr fps are statically allocated. However, returning -EBUSY in this case breaks dup2 with stdin, out, and err. Ignoring this should be fine as long as those are not fdrop-ed twice. Signed-off-by: Hugo Lefeuvre <hugo.lefeuvre@xxxxxxxxx> --- lib/vfscore/fd.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/vfscore/fd.c b/lib/vfscore/fd.c index 6b7f5ec..684ea50 100644 --- a/lib/vfscore/fd.c +++ b/lib/vfscore/fd.c @@ -97,9 +97,15 @@ int vfscore_put_fd(int fd) unsigned long flags;UK_ASSERT(fd < (int) FDTABLE_MAX_FILES);- /* Currently it is not allowed to free std(in|out|err) */ - if (fd <= 2) - return -EBUSY; + + /* FIXME Currently it is not allowed to free std(in|out|err): + * if (fd <= 2) return -EBUSY; + * + * However, returning -EBUSY in this case breaks dup2 with stdin, out, + * err. Ignoring this should be fine as long as those are not fdrop-ed + * twice, in which case the static fp would be freed, and here be + * dragons. + */flags = ukplat_lcpu_save_irqf();uk_bitmap_clear(fdtable.bitmap, fd, 1); _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |