All of lore.kernel.org
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@armlinux.org.uk>
To: Thomas Garnier <thgarnie@google.com>
Cc: Will Deacon <will.deacon@arm.com>,
	Leonard Crestez <leonard.crestez@nxp.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Dave Martin <Dave.Martin@arm.com>,
	Chris Metcalf <cmetcalf@mellanox.com>,
	Pratyush Anand <panand@redhat.com>,
	linux-arm-kernel@lists.infradead.org,
	LKML <linux-kernel@vger.kernel.org>,
	Kernel Hardening <kernel-hardening@lists.openwall.com>
Subject: Re: [PATCH 1/3] arm/syscalls: Move address limit check in loop
Date: Wed, 26 Jul 2017 19:25:34 +0100	[thread overview]
Message-ID: <20170726182534.GQ31807@n2100.armlinux.org.uk> (raw)
In-Reply-To: <CAJcbSZG6qsaVGY7Weh6n+xs5XaDg+=h8SDUYJfMUTWbdYOd7rA@mail.gmail.com>

On Wed, Jul 26, 2017 at 07:20:22AM -0700, Thomas Garnier wrote:
> On Wed, Jul 26, 2017 at 5:02 AM, Will Deacon <will.deacon@arm.com> wrote:
> > I looked to see what you've done for x86, but it looks like you check/clear
> > the flag before the work pending loop (exit_to_usermode_loop), which
> > subsequently re-enables interrupts and exits when
> > EXIT_TO_USERMODE_LOOP_FLAGS are all clear. Since TIF_FSCHECK isn't included
> > in those flags, what stops it being set again by an irq and remaining set
> > for the return to userspace?
> 
> Nothing, I plan to improve the x86 logic later. I focused on ARM/ARM64
> right now based on Leonard report.

Hmm.  In this case, I'd suggest concentrating on x86 and getting the
implementation correct there before porting it to other architectures.

If x86 were to check TIF_FSCHECK in the loop, and repeat until clear,
would x86 also end up in these infinite loops that have been reported
on ARM as well?

I strongly suggest testing the behaviour with kprobes/tracing enabled
for a function called from the work pending loop, and checking how
that behaves.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

WARNING: multiple messages have this Message-ID (diff)
From: linux@armlinux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] arm/syscalls: Move address limit check in loop
Date: Wed, 26 Jul 2017 19:25:34 +0100	[thread overview]
Message-ID: <20170726182534.GQ31807@n2100.armlinux.org.uk> (raw)
In-Reply-To: <CAJcbSZG6qsaVGY7Weh6n+xs5XaDg+=h8SDUYJfMUTWbdYOd7rA@mail.gmail.com>

On Wed, Jul 26, 2017 at 07:20:22AM -0700, Thomas Garnier wrote:
> On Wed, Jul 26, 2017 at 5:02 AM, Will Deacon <will.deacon@arm.com> wrote:
> > I looked to see what you've done for x86, but it looks like you check/clear
> > the flag before the work pending loop (exit_to_usermode_loop), which
> > subsequently re-enables interrupts and exits when
> > EXIT_TO_USERMODE_LOOP_FLAGS are all clear. Since TIF_FSCHECK isn't included
> > in those flags, what stops it being set again by an irq and remaining set
> > for the return to userspace?
> 
> Nothing, I plan to improve the x86 logic later. I focused on ARM/ARM64
> right now based on Leonard report.

Hmm.  In this case, I'd suggest concentrating on x86 and getting the
implementation correct there before porting it to other architectures.

If x86 were to check TIF_FSCHECK in the loop, and repeat until clear,
would x86 also end up in these infinite loops that have been reported
on ARM as well?

I strongly suggest testing the behaviour with kprobes/tracing enabled
for a function called from the work pending loop, and checking how
that behaves.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

WARNING: multiple messages have this Message-ID (diff)
From: Russell King - ARM Linux <linux@armlinux.org.uk>
To: Thomas Garnier <thgarnie@google.com>
Cc: Will Deacon <will.deacon@arm.com>,
	Leonard Crestez <leonard.crestez@nxp.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Dave Martin <Dave.Martin@arm.com>,
	Chris Metcalf <cmetcalf@mellanox.com>,
	Pratyush Anand <panand@redhat.com>,
	linux-arm-kernel@lists.infradead.org,
	LKML <linux-kernel@vger.kernel.org>,
	Kernel Hardening <kernel-hardening@lists.openwall.com>
Subject: [kernel-hardening] Re: [PATCH 1/3] arm/syscalls: Move address limit check in loop
Date: Wed, 26 Jul 2017 19:25:34 +0100	[thread overview]
Message-ID: <20170726182534.GQ31807@n2100.armlinux.org.uk> (raw)
In-Reply-To: <CAJcbSZG6qsaVGY7Weh6n+xs5XaDg+=h8SDUYJfMUTWbdYOd7rA@mail.gmail.com>

On Wed, Jul 26, 2017 at 07:20:22AM -0700, Thomas Garnier wrote:
> On Wed, Jul 26, 2017 at 5:02 AM, Will Deacon <will.deacon@arm.com> wrote:
> > I looked to see what you've done for x86, but it looks like you check/clear
> > the flag before the work pending loop (exit_to_usermode_loop), which
> > subsequently re-enables interrupts and exits when
> > EXIT_TO_USERMODE_LOOP_FLAGS are all clear. Since TIF_FSCHECK isn't included
> > in those flags, what stops it being set again by an irq and remaining set
> > for the return to userspace?
> 
> Nothing, I plan to improve the x86 logic later. I focused on ARM/ARM64
> right now based on Leonard report.

Hmm.  In this case, I'd suggest concentrating on x86 and getting the
implementation correct there before porting it to other architectures.

If x86 were to check TIF_FSCHECK in the loop, and repeat until clear,
would x86 also end up in these infinite loops that have been reported
on ARM as well?

I strongly suggest testing the behaviour with kprobes/tracing enabled
for a function called from the work pending loop, and checking how
that behaves.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

  reply	other threads:[~2017-07-26 18:25 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-19 17:58 [PATCH 1/3] arm/syscalls: Move address limit check in loop Thomas Garnier
2017-07-19 17:58 ` [kernel-hardening] " Thomas Garnier
2017-07-19 17:58 ` Thomas Garnier
2017-07-19 17:58 ` [PATCH 2/3] arm/syscalls: Optimize work flags assembly check Thomas Garnier
2017-07-19 17:58   ` [kernel-hardening] " Thomas Garnier
2017-07-19 17:58   ` Thomas Garnier
2017-07-19 17:59 ` [PATCH 3/3] arm64/syscalls: Move address limit check in loop Thomas Garnier
2017-07-19 17:59   ` [kernel-hardening] " Thomas Garnier
2017-07-19 17:59   ` Thomas Garnier
2017-07-24 17:07 ` [PATCH 1/3] arm/syscalls: " Thomas Garnier
2017-07-24 17:07   ` [kernel-hardening] " Thomas Garnier
2017-07-24 17:07   ` Thomas Garnier
2017-07-25 10:28   ` Leonard Crestez
2017-07-25 10:28     ` [kernel-hardening] " Leonard Crestez
2017-07-25 10:28     ` Leonard Crestez
2017-07-25 10:38     ` Russell King - ARM Linux
2017-07-25 10:38       ` [kernel-hardening] " Russell King - ARM Linux
2017-07-25 10:38       ` Russell King - ARM Linux
2017-07-25 20:01       ` Thomas Garnier
2017-07-25 20:01         ` [kernel-hardening] " Thomas Garnier
2017-07-25 20:01         ` Thomas Garnier
2017-07-26 12:02         ` Will Deacon
2017-07-26 12:02           ` [kernel-hardening] " Will Deacon
2017-07-26 12:02           ` Will Deacon
2017-07-26 14:20           ` Thomas Garnier
2017-07-26 14:20             ` [kernel-hardening] " Thomas Garnier
2017-07-26 14:20             ` Thomas Garnier
2017-07-26 18:25             ` Russell King - ARM Linux [this message]
2017-07-26 18:25               ` [kernel-hardening] " Russell King - ARM Linux
2017-07-26 18:25               ` Russell King - ARM Linux
2017-07-26 18:29               ` Thomas Garnier
2017-07-26 18:29                 ` [kernel-hardening] " Thomas Garnier
2017-07-26 18:29                 ` Thomas Garnier

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=20170726182534.GQ31807@n2100.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=Dave.Martin@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=cmetcalf@mellanox.com \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=leonard.crestez@nxp.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=panand@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=thgarnie@google.com \
    --cc=will.deacon@arm.com \
    /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.