[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z0BL/UopaH5Xg5jS@MiWiFi-R3L-srv>
Date: Fri, 22 Nov 2024 17:16:45 +0800
From: Baoquan He <bhe@...hat.com>
To: David Hildenbrand <david@...hat.com>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
linux-s390@...r.kernel.org, virtualization@...ts.linux.dev,
kvm@...r.kernel.org, linux-fsdevel@...r.kernel.org,
kexec@...ts.infradead.org, Heiko Carstens <hca@...ux.ibm.com>,
Vasily Gorbik <gor@...ux.ibm.com>,
Alexander Gordeev <agordeev@...ux.ibm.com>,
Christian Borntraeger <borntraeger@...ux.ibm.com>,
Sven Schnelle <svens@...ux.ibm.com>,
"Michael S. Tsirkin" <mst@...hat.com>,
Jason Wang <jasowang@...hat.com>,
Xuan Zhuo <xuanzhuo@...ux.alibaba.com>,
Eugenio PĂ©rez <eperezma@...hat.com>,
Vivek Goyal <vgoyal@...hat.com>, Dave Young <dyoung@...hat.com>,
Thomas Huth <thuth@...hat.com>, Cornelia Huck <cohuck@...hat.com>,
Janosch Frank <frankja@...ux.ibm.com>,
Claudio Imbrenda <imbrenda@...ux.ibm.com>,
Eric Farman <farman@...ux.ibm.com>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH v1 03/11] fs/proc/vmcore: disallow vmcore modifications
after the vmcore was opened
On 10/25/24 at 05:11pm, David Hildenbrand wrote:
......snip...
> @@ -1482,6 +1470,10 @@ int vmcore_add_device_dump(struct vmcoredd_data *data)
> return -EINVAL;
> }
>
> + /* We'll recheck under lock later. */
> + if (data_race(vmcore_opened))
> + return -EBUSY;
As I commented to patch 7, if vmcore is opened and closed after
checking, do we need to give up any chance to add device dumping
as below?
fd = open(/proc/vmcore);
...do checking;
close(fd);
quit any device dump adding;
run makedumpfile on s390;
->fd = open(/proc/vmcore);
-> try to dump;
->close(fd);
> +
> if (!data || !strlen(data->dump_name) ||
> !data->vmcoredd_callback || !data->size)
> return -EINVAL;
> @@ -1515,12 +1507,16 @@ int vmcore_add_device_dump(struct vmcoredd_data *data)
> dump->buf = buf;
> dump->size = data_size;
>
> - /* Add the dump to driver sysfs list */
> + /* Add the dump to driver sysfs list and update the elfcore hdr */
> mutex_lock(&vmcore_mutex);
> - list_add_tail(&dump->list, &vmcoredd_list);
> - mutex_unlock(&vmcore_mutex);
> + if (vmcore_opened) {
> + ret = -EBUSY;
> + goto out_err;
> + }
>
> + list_add_tail(&dump->list, &vmcoredd_list);
> vmcoredd_update_size(data_size);
> + mutex_unlock(&vmcore_mutex);
> return 0;
>
> out_err:
> --
> 2.46.1
>
Powered by blists - more mailing lists