All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: hpa@zytor.com, x86@kernel.org, linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Borislav Petkov <bp@alien8.de>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Denys Vlasenko <dvlasenk@redhat.com>,
	Andy Lutomirski <luto@kernel.org>,
	Brian Gerst <brgerst@gmail.com>
Subject: Re: [PATCH 2/2] x86: fix incomplete clear by clear_user()
Date: Sun, 21 Jun 2015 08:55:23 +0200	[thread overview]
Message-ID: <20150621065523.GA31829@gmail.com> (raw)
In-Reply-To: <20150620214715.GB14099@p183.telecom.by>


* Alexey Dobriyan <adobriyan@gmail.com> wrote:

> clear_user() used MOVQ+MOVB and if MOVQ faults, code simply exits and
> honestly returns remaining length. In case of unaligned area, unaligned
> remainder would count towards return value (correctly) but not cleared
> (lazy code at least):
> 
> 	clear_user(p + 4096 - 4, 8) = 8
> 
> No one would have noticed but REP MOVSB addition to clear_user()
> repertoire creates a problem: REP MOVSB does everything correctly,
> clears and counts to the last possible byte, but REP STOSQ and MOVQ
> variants DO NOT:
> 
> 	MOVQ		clear_user(p + 4096 - 4, 8) = 8
> 	REP STOSQ	clear_user(p + 4096 - 4, 8) = 8
> 	REP STOSB	clear_user(p + 4096 - 4, 8) = 4
> 
> Patch fixes incomplete clear on 32-bit and 64-bit REP STOSQ, MOVQ.

So please flip the order of the changes around so that we never have this 
inconsistency observable: i.e. first update the existing clearing method, then 
move it and introduce the new variants without having to patch them.

Thanks,

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

  reply	other threads:[~2015-06-21  6:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-20 21:45 [PATCH 1/2] x86: use alternatives for clear_user() Alexey Dobriyan
2015-06-20 21:47 ` [PATCH 2/2] x86: fix incomplete clear by clear_user() Alexey Dobriyan
2015-06-21  6:55   ` Ingo Molnar [this message]
2015-06-21  6:52 ` [PATCH 1/2] x86: use alternatives for clear_user() Ingo Molnar
2015-06-22 12:18   ` Alexey Dobriyan

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=20150621065523.GA31829@gmail.com \
    --to=mingo@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=adobriyan@gmail.com \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=dvlasenk@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=tglx@linutronix.de \
    --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.