[CRIU] [PATCH 1/5] files: Fix crossing unused and service fds of shared fd tables
Cyrill Gorcunov
gorcunov at virtuozzo.com
Wed Jun 7 18:26:21 MSK 2017
On Wed, Jun 07, 2017 at 06:15:12PM +0300, Kirill Tkhai wrote:
> service_fd_id is id of a specific task, while other tasks
> in shared fd table group may have bigger id numbers.
> In this case given unused fd intersects with service fds
> of such tasks. This leads to undefined behaviour. Fix that.
>
> Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
> +int service_fd_min_fd(struct pstree_item *item)
> {
> - return service_fd_rlim_cur - (SERVICE_FD_MAX - 1) - SERVICE_FD_MAX * service_fd_id;
> + struct fdt *fdt = rsti(item)->fdt;
> + int id = 0;
> +
> + if (fdt)
> + id = fdt->nr - 1;
Why -1 here?
More information about the CRIU
mailing list