From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5A2BE69E9D for ; Tue, 3 Dec 2024 10:42:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1BAB26B007B; Tue, 3 Dec 2024 05:42:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 16B5A6B0083; Tue, 3 Dec 2024 05:42:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 00B986B0085; Tue, 3 Dec 2024 05:42:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id D76736B007B for ; Tue, 3 Dec 2024 05:42:40 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 5983B12087F for ; Tue, 3 Dec 2024 10:42:40 +0000 (UTC) X-FDA: 82853308860.21.6326030 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf25.hostedemail.com (Postfix) with ESMTP id 02049A0004 for ; Tue, 3 Dec 2024 10:42:28 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=UslTuqr5; spf=pass (imf25.hostedemail.com: domain of bhe@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1733222548; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=D5AHi0uk+oN+zpkzvh/QNmG2L3UPAKNwXGcHrJAQaZM=; b=XsRyjObmfI5fAyfytuXQFFvixoU6CfohhK4TIQJFdMKYuBWls/Rh3NRz1yfrJcJ+110zu0 4reR+uHIeJGWZlD5859VI3gwowC+8DG14o1hfnqmvmvqWusSqytalQbJ+9LCbF3diDinyH ci58bWIVcO1d8GVwtcNt96klfxsWhNk= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=UslTuqr5; spf=pass (imf25.hostedemail.com: domain of bhe@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733222548; a=rsa-sha256; cv=none; b=YgI8O1gOakWDQwhD3V9z+20IhqFVW1Q6vv5uXe71naqY2dmm5V+YEqq1X8bunTFHZPeT7/ XJq2P6NrX2P/6DUCz/e/oAZwWnxJwElEP7w9cl5ko/o2uVJmYgt4SeVm0C4nJSqjxfnwub NcMHMDEjzYuB3bojJnHVl4QHPz6+HRo= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1733222557; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=D5AHi0uk+oN+zpkzvh/QNmG2L3UPAKNwXGcHrJAQaZM=; b=UslTuqr5HZJQF3Njm98uFv4O5xo5JALnN5BUBHOHaWO+9h/W8cfWbr0HqCe3KsI0XCyaz7 7P59v6omP37MoBCp09xtlQOPeKFObtRqyUr8C9T75NwNjiwkHdbP0aOoFlkAvHsN1wtcLn da2oHwTf0h+WjthjF82lASseKWT2MTY= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-300-P5838zgdOW6m0hg0rLlvbA-1; Tue, 03 Dec 2024 05:42:36 -0500 X-MC-Unique: P5838zgdOW6m0hg0rLlvbA-1 X-Mimecast-MFC-AGG-ID: P5838zgdOW6m0hg0rLlvbA Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DE7BF19560BD; Tue, 3 Dec 2024 10:42:32 +0000 (UTC) Received: from localhost (unknown [10.72.113.10]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9A28330000DF; Tue, 3 Dec 2024 10:42:29 +0000 (UTC) Date: Tue, 3 Dec 2024 18:42:25 +0800 From: Baoquan He To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-s390@vger.kernel.org, virtualization@lists.linux.dev, kvm@vger.kernel.org, linux-fsdevel@vger.kernel.org, kexec@lists.infradead.org, Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , Eugenio =?iso-8859-1?Q?P=E9rez?= , Vivek Goyal , Dave Young , Thomas Huth , Cornelia Huck , Janosch Frank , Claudio Imbrenda , Eric Farman , Andrew Morton Subject: Re: [PATCH v1 03/11] fs/proc/vmcore: disallow vmcore modifications after the vmcore was opened Message-ID: References: <20241025151134.1275575-1-david@redhat.com> <20241025151134.1275575-4-david@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Rspamd-Queue-Id: 02049A0004 X-Rspamd-Server: rspam12 X-Stat-Signature: y1pyefgkyj39fmp4wrxh19bexqqjihw3 X-Rspam-User: X-HE-Tag: 1733222548-522638 X-HE-Meta: U2FsdGVkX19Y9htm6M8L3VPhNJOhhOtnPHAz4UaUFt8HiePZwxcNjRlAwLZgxS9vpuwRip3UyqIdhxgPpymaEKQvILeb54dGFEUbsHl7xo7cjoEcXabaLNbwR4np8XBA8LqWXvcPpqBR+TidsfvPy36EVxIlhg3AjDSjELlLgbCGk60E8E9wIBqwvKKfZM3RfXiGD0TbCwZOuiW6QPpjXpFodEpPC1yZXJAzCBMUKZh0uKV4s0X/heSfPaUYxMTad5SKwzYycdzXt3cSqv2qsDKSgIke8opMYJiuxTEM2WOyVuHZx3P/HaaJd/L7T4rolqG+8SFJ1i/w/RGkns2qUdqiA5x1kVfijflZe6/2BUh9QNphgh4waLVycFH22SHqmlTrXzDbQyUjE6I02AnjnFlH2pD0YMPiEYGkGQspKUgYy+DaFNUlGzBMBV05y+ntyQs1DycQUzzlFJWJjmfwEA2iQCcqU2tgQMSzFCBXtlOQJICBvA081Fr3OhMPLpn+ugrU4cosWKzpA7nWnJEfK9Lt6pOXy6OUd6V8gfyhONbNwQq4RimFXQJ7KPtGF1DPL2DlaPAWPiRrrBKI2N5aNrCGiPIMsuQZ6myByp4LaJsRLizJUlpG7dmv2BKWQsx0p+XmV2NHMIo6WOsm6DtZBsTAMmXMyQZh/EIjvaysg105uxBebebR9z68QpO3Ec2YlucLpkvkc+2ryDnre/ssS5hgg3X3fRstB38eyUVUe5SR87et5PUQxuGptc15HCzaQwVbb+3cuR1xoHtmK/PrS2X+PkizHiGOvae3Wtj8xeob4I5Ao8cGjZzZjCel+FN0PRzSplc0am6U8Te8JH11n6zTo6BzpFIMlSfmrjFR63YWg93Fs2eRSR9sojk+2SG4pT1duVqYXPwkd+RQPrPKDbaCdUoD6fN13kEnFcmbdYHj7xs2x5xN1aq6+KVxqY3+ujak+MpNiPdYcScNTVK ck1s3kG+ T5smY37yg9sp7joypL/EfQB3//dfTOmeVsnYBsTtqQtfrbNWQCf+QnKTayKGi4iDXnbM04Fl6DHU9doTeiZ/oaWJCn72niyTI0cb2Rc6DvbDvvQF549/RHZS5YaMb/nrBsRddQ6CFFxCi6V9WNqjtlk0HEJ1D2giqKnxMNcNvsRtCXcP60UEXqQPBrkHLZcKVjbenW0pxnXr3JdwxYV5ToefHtdfCbVgJaA/woV1cwFymBaPlADYiv3c3K3fx11EEMOE7tdREm3ORNEdhM5cIzWC/FjDhze636OxSmxVV/+ihV5l8+RH35jlUVFIF3J5zJ2bZaz1ff3akFMHOXpTLS+ovg11fVPFVgPi4 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 11/29/24 at 11:38am, David Hildenbrand wrote: > On 25.11.24 15:41, Baoquan He wrote: > > On 11/22/24 at 10:30am, David Hildenbrand wrote: > > > On 22.11.24 10:16, Baoquan He wrote: > > > > 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; > > > > > > > > > > Hi, > > > > > > > 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); > > > > > > The only reasonable case where this could happen (with virtio_mem) would be > > > when you hotplug a virtio-mem device into a VM that is currently in the > > > kdump kernel. However, in this case, the device would not provide any memory > > > we want to dump: > > > > > > (1) The memory was not available to the 1st (crashed) kernel, because > > > the device got hotplugged later. > > > (2) Hotplugged virtio-mem devices show up with "no plugged memory", > > > meaning there wouldn't be even something to dump. > > > > > > Drivers will be loaded (as part of the kernel or as part of the initrd) > > > before any kdump action is happening. Similarly, just imagine your NIC > > > driver not being loaded when you start dumping to a network share ... > > > > > > This should similarly apply to vmcoredd providers. > > > > > > There is another concern I had at some point with changing the effective > > > /proc/vmcore size after someone already opened it, and might assume the size > > > will stay unmodified (IOW, the file was completely static before vmcoredd > > > showed up). > > > > > > So unless there is a real use case that requires tracking whether the file > > > is no longer open, to support modifying the vmcore afterwards, we should > > > keep it simple. > > > > > > I am not aware of any such cases, and my experiments with virtio_mem showed > > > that the driver get loaded extremely early from the initrd, compared to when > > > we actually start messing with /proc/vmcore from user space. It's OK, David, I don't have strong opinion about the current implementation. I raised this concern because 1) I saw the original vmcoredd only warn when doing register if vmcore_opened is true; 2) in patch 1, it says vmcore_mutex is introduced to protect vmcore modifications from concurrent opening. If we are confident, the old vmcoredd_mutex can guarantee it, I could be wrong here. Anyway, it's just a tiny concern, I believe it won't cause issue at present. So it's up to you. Thanks