All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amit Kachhap <amit.kachhap@arm.com>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-kernel@vger.kernel.org,
	Vincenzo Frascino <Vincenzo.Frascino@arm.com>,
	Kevin Brodsky <kevin.brodsky@arm.com>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	kexec <kexec@lists.infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Young <dyoung@redhat.com>, Baoquan He <bhe@redhat.com>,
	Vivek Goyal <vgoyal@redhat.com>, x86 <x86@kernel.org>
Subject: Re: [RFC PATCH 01/14] fs/proc/vmcore: Update read_from_oldmem() for user pointer
Date: Tue, 7 Dec 2021 12:41:52 +0530	[thread overview]
Message-ID: <08e4e9d8-2c42-115a-f440-d7f44fb19280@arm.com> (raw)
In-Reply-To: <20211206140451.GA4936@lst.de>



On 12/6/21 7:34 PM, Christoph Hellwig wrote:
> On Fri, Dec 03, 2021 at 04:12:18PM +0530, Amit Daniel Kachhap wrote:
>> +	return read_from_oldmem_to_kernel(buf, count, ppos,
>> +					  cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT));
> 
> Overly long line.
> 
>> +ssize_t read_from_oldmem(char __user *ubuf, char *kbuf, size_t count,
>> +			 u64 *ppos, bool encrypted)
>>   {
>>   	unsigned long pfn, offset;
>>   	size_t nr_bytes;
>> @@ -156,19 +163,27 @@ ssize_t read_from_oldmem(char *buf, size_t count,
>>   		/* If pfn is not ram, return zeros for sparse dump files */
>>   		if (!pfn_is_ram(pfn)) {
>>   			tmp = 0;
>> -			if (!userbuf)
>> -				memset(buf, 0, nr_bytes);
>> -			else if (clear_user(buf, nr_bytes))
>> +			if (kbuf)
>> +				memset(kbuf, 0, nr_bytes);
>> +			else if (clear_user(ubuf, nr_bytes))
>>   				tmp = -EFAULT;
> 
> This looks like a huge mess.  What speak against using an iov_iter
> here?

iov_iter seems to be a reasonable way. As a start I thought of adding
minimal changes.

> 

WARNING: multiple messages have this Message-ID (diff)
From: Amit Kachhap <amit.kachhap@arm.com>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-kernel@vger.kernel.org,
	Vincenzo Frascino <Vincenzo.Frascino@arm.com>,
	Kevin Brodsky <kevin.brodsky@arm.com>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	kexec <kexec@lists.infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Young <dyoung@redhat.com>, Baoquan He <bhe@redhat.com>,
	Vivek Goyal <vgoyal@redhat.com>, x86 <x86@kernel.org>
Subject: Re: [RFC PATCH 01/14] fs/proc/vmcore: Update read_from_oldmem() for user pointer
Date: Tue, 7 Dec 2021 12:41:52 +0530	[thread overview]
Message-ID: <08e4e9d8-2c42-115a-f440-d7f44fb19280@arm.com> (raw)
In-Reply-To: <20211206140451.GA4936@lst.de>



On 12/6/21 7:34 PM, Christoph Hellwig wrote:
> On Fri, Dec 03, 2021 at 04:12:18PM +0530, Amit Daniel Kachhap wrote:
>> +	return read_from_oldmem_to_kernel(buf, count, ppos,
>> +					  cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT));
> 
> Overly long line.
> 
>> +ssize_t read_from_oldmem(char __user *ubuf, char *kbuf, size_t count,
>> +			 u64 *ppos, bool encrypted)
>>   {
>>   	unsigned long pfn, offset;
>>   	size_t nr_bytes;
>> @@ -156,19 +163,27 @@ ssize_t read_from_oldmem(char *buf, size_t count,
>>   		/* If pfn is not ram, return zeros for sparse dump files */
>>   		if (!pfn_is_ram(pfn)) {
>>   			tmp = 0;
>> -			if (!userbuf)
>> -				memset(buf, 0, nr_bytes);
>> -			else if (clear_user(buf, nr_bytes))
>> +			if (kbuf)
>> +				memset(kbuf, 0, nr_bytes);
>> +			else if (clear_user(ubuf, nr_bytes))
>>   				tmp = -EFAULT;
> 
> This looks like a huge mess.  What speak against using an iov_iter
> here?

iov_iter seems to be a reasonable way. As a start I thought of adding
minimal changes.

> 

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  parent reply	other threads:[~2021-12-07  7:12 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-03 10:42 [RFC PATCH 00/14] fs/proc/vmcore: Remove unnecessary user pointer conversions Amit Daniel Kachhap
2021-12-03 10:42 ` Amit Daniel Kachhap
2021-12-03 10:42 ` [RFC PATCH 01/14] fs/proc/vmcore: Update read_from_oldmem() for user pointer Amit Daniel Kachhap
2021-12-03 10:42   ` Amit Daniel Kachhap
2021-12-06 14:04   ` Christoph Hellwig
2021-12-06 14:04     ` Christoph Hellwig
2021-12-06 14:17     ` Matthew Wilcox
2021-12-06 14:17       ` Matthew Wilcox
2021-12-06 14:54       ` Christoph Hellwig
2021-12-06 14:54         ` Christoph Hellwig
2021-12-06 15:07         ` Matthew Wilcox
2021-12-06 15:07           ` Matthew Wilcox
2021-12-07 11:15           ` Christoph Hellwig
2021-12-07 11:15             ` Christoph Hellwig
2021-12-07  7:11     ` Amit Kachhap [this message]
2021-12-07  7:11       ` Amit Kachhap
2021-12-03 10:42 ` [RFC PATCH 02/14] fs/proc/vmcore: Update copy_oldmem_page_encrypted() for user buffer Amit Daniel Kachhap
2021-12-03 10:42   ` Amit Daniel Kachhap
2021-12-03 10:42 ` [RFC PATCH 03/14] fs/proc/vmcore: Update copy_oldmem_page() " Amit Daniel Kachhap
2021-12-03 10:42   ` Amit Daniel Kachhap
2021-12-03 10:42 ` [RFC PATCH 04/14] x86/crash_dump_64: Use the new interface copy_oldmem_page_buf Amit Daniel Kachhap
2021-12-03 10:42   ` Amit Daniel Kachhap
2021-12-03 10:42 ` [RFC PATCH 05/14] x86/crash_dump_32: " Amit Daniel Kachhap
2021-12-03 10:42   ` Amit Daniel Kachhap
2021-12-03 10:42 ` [RFC PATCH 06/14] arm64/crash_dump: " Amit Daniel Kachhap
2021-12-03 10:42   ` Amit Daniel Kachhap
2021-12-03 10:42   ` Amit Daniel Kachhap
2021-12-03 10:42 ` [RFC PATCH 07/14] arm/crash_dump: " Amit Daniel Kachhap
2021-12-03 10:42   ` Amit Daniel Kachhap
2021-12-03 10:42   ` Amit Daniel Kachhap
2021-12-03 10:42 ` [RFC PATCH 08/14] mips/crash_dump: " Amit Daniel Kachhap
2021-12-03 10:42   ` Amit Daniel Kachhap
2021-12-03 10:42 ` [RFC PATCH 09/14] sh/crash_dump: " Amit Daniel Kachhap
2021-12-03 10:42   ` Amit Daniel Kachhap
2021-12-03 10:42 ` [RFC PATCH 10/14] riscv/crash_dump: " Amit Daniel Kachhap
2021-12-03 10:42   ` Amit Daniel Kachhap
2021-12-03 10:42   ` Amit Daniel Kachhap
2021-12-03 10:42 ` [RFC PATCH 11/14] powerpc/crash_dump: " Amit Daniel Kachhap
2021-12-03 10:42   ` Amit Daniel Kachhap
2021-12-03 10:42   ` Amit Daniel Kachhap
2021-12-03 10:42 ` [RFC PATCH 12/14] ia64/crash_dump: " Amit Daniel Kachhap
2021-12-03 10:54   ` Amit Daniel Kachhap
2021-12-03 10:42   ` Amit Daniel Kachhap
2021-12-03 10:42 ` [RFC PATCH 13/14] s390/crash_dump: " Amit Daniel Kachhap
2021-12-03 10:42   ` Amit Daniel Kachhap
2021-12-03 10:42 ` [RFC PATCH 14/14] fs/proc/vmcore: Remove the unused old interface copy_oldmem_page Amit Daniel Kachhap
2021-12-03 10:42   ` Amit Daniel Kachhap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=08e4e9d8-2c42-115a-f440-d7f44fb19280@arm.com \
    --to=amit.kachhap@arm.com \
    --cc=Vincenzo.Frascino@arm.com \
    --cc=bhe@redhat.com \
    --cc=bp@alien8.de \
    --cc=dyoung@redhat.com \
    --cc=hch@lst.de \
    --cc=kevin.brodsky@arm.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=vgoyal@redhat.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.