All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: SF Markus Elfring <elfring@users.sourceforge.net>
Cc: kvm@vger.kernel.org, linux-s390 <linux-s390@vger.kernel.org>,
	"Christian Bornträger" <borntraeger@de.ibm.com>,
	"Cornelia Huck" <cornelia.huck@de.ibm.com>,
	"David Hildenbrand" <dahi@linux.vnet.ibm.com>,
	"Heiko Carstens" <heiko.carstens@de.ibm.com>,
	"Martin Schwidefsky" <schwidefsky@de.ibm.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	LKML <linux-kernel@vger.kernel.org>,
	"kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>,
	"Julia Lawall" <julia.lawall@lip6.fr>,
	"Walter Harms" <wharms@bfs.de>
Subject: Re: [PATCH v2 2/2] KVM: s390: Use memdup_user() rather than duplicating code
Date: Mon, 3 Oct 2016 16:00:03 +0200	[thread overview]
Message-ID: <CAMuHMdUS2aMd5B2nQOpQFdQGE7EvWMCea+dMzS7R7_yZ4LdONw@mail.gmail.com> (raw)
In-Reply-To: <9ee60162-110b-1305-5a97-624de425d072@users.sourceforge.net>

Hi Markus,

On Mon, Oct 3, 2016 at 3:47 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
>>> Did you notice the check "IS_ERR(bp_data)" and the corresponding reaction
>>> in this update suggestion?
>>
>> Yes, but bp_data may still be a valid (as in "not an error") value.
>
> Thanks for your constructive feedback.
>
>> Your commit a1708a2eaded836b ("KVM: s390: Improve determination of sizes in
>> kvm_s390_import_bp_data()") made the code more robust, as kmalloc_array() ha
>>  a builtin overflow check, and will return NULL if overflow is detected.
>> However, commit 0624a8eb82efd58e ("KVM: s390: Use memdup_user() rather than
>> duplicating code") dropped that safety net again.
>
> * How much are you concerned about the shown software evolution around
>   multiplications for memory allocations?

Enough to write my reply ;-)

> * Does there really a probability remain that an inappropriate product
>   would be calculated here (as the situation was before my two update steps
>   for this software module)?

Perhaps not. Hence my "Probably not an issue here, ...".

> * Can it be that you are looking for a variant of a function like "memdup_user"
>   where values can be passed as separate parameters "count" and "size" so that
>   the needed multiplication and corresponding overflow check would be performed
>   together as desired?

If there are enough uses, and people like it, adding memdup_user_array()
may be a good idea...

P.S. Why do your questions make me think of a scientific paper? ;-)

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

WARNING: multiple messages have this Message-ID (diff)
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: SF Markus Elfring <elfring@users.sourceforge.net>
Cc: kvm@vger.kernel.org, linux-s390 <linux-s390@vger.kernel.org>,
	"Christian Bornträger" <borntraeger@de.ibm.com>,
	"Cornelia Huck" <cornelia.huck@de.ibm.com>,
	"David Hildenbrand" <dahi@linux.vnet.ibm.com>,
	"Heiko Carstens" <heiko.carstens@de.ibm.com>,
	"Martin Schwidefsky" <schwidefsky@de.ibm.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	LKML <linux-kernel@vger.kernel.org>,
	"kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>,
	"Julia Lawall" <julia.lawall@lip6.fr>,
	"Walter Harms" <wharms@bfs.de>
Subject: Re: [PATCH v2 2/2] KVM: s390: Use memdup_user() rather than duplicating code
Date: Mon, 03 Oct 2016 14:00:03 +0000	[thread overview]
Message-ID: <CAMuHMdUS2aMd5B2nQOpQFdQGE7EvWMCea+dMzS7R7_yZ4LdONw@mail.gmail.com> (raw)
In-Reply-To: <9ee60162-110b-1305-5a97-624de425d072@users.sourceforge.net>

Hi Markus,

On Mon, Oct 3, 2016 at 3:47 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
>>> Did you notice the check "IS_ERR(bp_data)" and the corresponding reaction
>>> in this update suggestion?
>>
>> Yes, but bp_data may still be a valid (as in "not an error") value.
>
> Thanks for your constructive feedback.
>
>> Your commit a1708a2eaded836b ("KVM: s390: Improve determination of sizes in
>> kvm_s390_import_bp_data()") made the code more robust, as kmalloc_array() ha
>>  a builtin overflow check, and will return NULL if overflow is detected.
>> However, commit 0624a8eb82efd58e ("KVM: s390: Use memdup_user() rather than
>> duplicating code") dropped that safety net again.
>
> * How much are you concerned about the shown software evolution around
>   multiplications for memory allocations?

Enough to write my reply ;-)

> * Does there really a probability remain that an inappropriate product
>   would be calculated here (as the situation was before my two update steps
>   for this software module)?

Perhaps not. Hence my "Probably not an issue here, ...".

> * Can it be that you are looking for a variant of a function like "memdup_user"
>   where values can be passed as separate parameters "count" and "size" so that
>   the needed multiplication and corresponding overflow check would be performed
>   together as desired?

If there are enough uses, and people like it, adding memdup_user_array()
may be a good idea...

P.S. Why do your questions make me think of a scientific paper? ;-)

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

  reply	other threads:[~2016-10-03 14:00 UTC|newest]

Thread overview: 94+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-17 18:02 [PATCH 0/4] KVM-S390: Fine-tuning for kvm_s390_import_bp_data() SF Markus Elfring
2016-08-17 18:02 ` SF Markus Elfring
2016-08-17 18:06 ` [PATCH 1/4] KVM-S390: Improve determination of sizes in kvm_s390_import_bp_data() SF Markus Elfring
2016-08-17 18:06   ` SF Markus Elfring
2016-08-18  7:25   ` walter harms
2016-08-18  7:25     ` walter harms
2016-08-18  9:02     ` Julia Lawall
2016-08-18  9:02       ` Julia Lawall
2016-08-18  9:48       ` Paolo Bonzini
2016-08-18  9:48         ` Paolo Bonzini
2016-08-18 10:52         ` walter harms
2016-08-18 10:52           ` walter harms
2016-08-18 10:55           ` Paolo Bonzini
2016-08-18 10:55             ` Paolo Bonzini
2016-08-22 12:58             ` Cornelia Huck
2016-08-22 12:58               ` Cornelia Huck
2016-08-24 12:10         ` Replacing specific kmalloc() calls by kmalloc_array()? SF Markus Elfring
2016-08-24 12:10           ` SF Markus Elfring
2016-08-24 15:00           ` Paolo Bonzini
2016-08-24 15:00             ` Paolo Bonzini
2016-08-17 18:08 ` [PATCH 2/4] KVM-S390: Use memdup_user() rather than duplicating its implementation SF Markus Elfring
2016-08-17 18:08   ` SF Markus Elfring
2016-08-22 13:02   ` David Hildenbrand
2016-08-22 13:02     ` David Hildenbrand
2016-08-22 13:05   ` Cornelia Huck
2016-08-22 13:05     ` Cornelia Huck
2016-08-24 15:19   ` Christian Borntraeger
2016-08-24 15:19     ` Christian Borntraeger
2016-08-24 18:30     ` [PATCH v2 0/2] KVM: s390: Fine-tuning for kvm_s390_import_bp_data() SF Markus Elfring
2016-08-24 18:30       ` SF Markus Elfring
2016-08-24 18:36       ` [PATCH v2 1/2] KVM: s390: Improve determination of sizes in kvm_s390_import_bp_data() SF Markus Elfring
2016-08-24 18:36         ` SF Markus Elfring
2016-08-25 16:10         ` Cornelia Huck
2016-08-25 16:10           ` Cornelia Huck
2016-08-25 16:45           ` SF Markus Elfring
2016-08-25 16:45             ` SF Markus Elfring
2016-08-25 17:34           ` Software evolution around scripts for the semantic patch langugae SF Markus Elfring
2016-08-25 17:34             ` SF Markus Elfring
2016-08-25 17:40             ` Cornelia Huck
2016-08-25 17:40               ` Cornelia Huck
2016-08-25 17:54               ` SF Markus Elfring
2016-08-25 17:54                 ` SF Markus Elfring
2016-08-25 18:14             ` Julia Lawall
2016-08-25 18:14               ` Julia Lawall
2016-08-25 18:20               ` SF Markus Elfring
2016-08-25 18:20                 ` SF Markus Elfring
2016-08-25 18:23                 ` Julia Lawall
2016-08-25 18:23                   ` Julia Lawall
2016-08-25 21:04                   ` Cornelia Huck
2016-08-25 21:04                     ` Cornelia Huck
2016-08-24 18:40       ` [PATCH v2 2/2] KVM: s390: Use memdup_user() rather than duplicating code SF Markus Elfring
2016-08-24 18:40         ` SF Markus Elfring
2016-08-25 16:11         ` Cornelia Huck
2016-08-25 16:11           ` Cornelia Huck
2016-10-03 12:11         ` Geert Uytterhoeven
2016-10-03 12:11           ` Geert Uytterhoeven
2016-10-03 12:28           ` SF Markus Elfring
2016-10-03 12:28             ` SF Markus Elfring
2016-10-03 13:10             ` Geert Uytterhoeven
2016-10-03 13:10               ` Geert Uytterhoeven
2016-10-03 13:47               ` SF Markus Elfring
2016-10-03 13:47                 ` SF Markus Elfring
2016-10-03 14:00                 ` Geert Uytterhoeven [this message]
2016-10-03 14:00                   ` Geert Uytterhoeven
2016-10-03 14:25                   ` SF Markus Elfring
2016-10-03 14:25                     ` SF Markus Elfring
2016-08-25 16:12       ` [PATCH v2 0/2] KVM: s390: Fine-tuning for kvm_s390_import_bp_data() Christian Borntraeger
2016-08-25 16:12         ` Christian Borntraeger
2016-08-17 18:10 ` [PATCH 3/4] KVM-S390: Less function calls in kvm_s390_import_bp_data() after error detection SF Markus Elfring
2016-08-17 18:10   ` SF Markus Elfring
2016-08-22 12:58   ` David Hildenbrand
2016-08-22 12:58     ` David Hildenbrand
2016-08-22 13:00   ` Cornelia Huck
2016-08-22 13:00     ` Cornelia Huck
2016-08-22 16:56     ` SF Markus Elfring
2016-08-22 16:56       ` SF Markus Elfring
2016-08-22 19:37       ` Cornelia Huck
2016-08-22 19:37         ` Cornelia Huck
2016-08-22 21:17         ` SF Markus Elfring
2016-08-22 21:17           ` SF Markus Elfring
2016-08-22 21:28           ` Cornelia Huck
2016-08-22 21:28             ` Cornelia Huck
2016-08-31 12:29           ` Paolo Bonzini
2016-08-31 12:29             ` Paolo Bonzini
2016-08-24 15:10   ` Christian Borntraeger
2016-08-24 15:10     ` Christian Borntraeger
2016-08-27 16:12     ` SF Markus Elfring
2016-08-27 16:12       ` SF Markus Elfring
2016-08-17 18:12 ` [PATCH 4/4] KVM-S390: Delete an unnecessary initialisation for a buffer variable SF Markus Elfring
2016-08-17 18:12   ` SF Markus Elfring
2016-08-22 12:59   ` David Hildenbrand
2016-08-22 12:59     ` David Hildenbrand
2016-08-22 13:01   ` Cornelia Huck
2016-08-22 13:01     ` Cornelia Huck

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=CAMuHMdUS2aMd5B2nQOpQFdQGE7EvWMCea+dMzS7R7_yZ4LdONw@mail.gmail.com \
    --to=geert@linux-m68k.org \
    --cc=borntraeger@de.ibm.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=dahi@linux.vnet.ibm.com \
    --cc=elfring@users.sourceforge.net \
    --cc=heiko.carstens@de.ibm.com \
    --cc=julia.lawall@lip6.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=schwidefsky@de.ibm.com \
    --cc=wharms@bfs.de \
    /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.