[CRIU] [PATCH] File lock status may be empty
Andrei Vagin
avagin at gmail.com
Wed Sep 11 14:38:20 MSK 2019
On Fri, Sep 06, 2019 at 07:28:33PM +0000, Nicolas Viennot wrote:
> The lock status string may be empty. This can happen when the owner of
> the lock is outside of our PID namespace. See the kernel function
> fs/locks.c:lock_get_status() when fl_pid == 0.
>
Could we introduce a test case for this?
> Signed-off-by: Nicolas Viennot <nviennot at twosigma.com>
> ---
> criu/proc_parse.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/criu/proc_parse.c b/criu/proc_parse.c
> index 0e8b6f20..749dfa40 100644
> --- a/criu/proc_parse.c
> +++ b/criu/proc_parse.c
> @@ -1669,17 +1669,21 @@ static int parse_fdinfo_pid_s(int pid, int fd, int type, void *arg)
> if (fdinfo_field(str, "lock")) {
> struct file_lock *fl;
> struct fdinfo_common *fdinfo = arg;
> + char *flock_buf = str+6;
>
> if (type != FD_TYPES__UND)
> continue;
>
> + if (flock_buf[0] == '\0')
> + continue;
> +
> fl = alloc_file_lock();
> if (!fl) {
> pr_perror("Alloc file lock failed!");
> goto out;
> }
>
> - if (parse_file_lock_buf(str + 6, fl, 0)) {
> + if (parse_file_lock_buf(flock_buf, fl, 0)) {
> xfree(fl);
> goto parse_err;
> }
> --
> 2.19.1
>
>
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
More information about the CRIU
mailing list