Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1373503

Re: [PATCH] arm64: CONFIG_DEVPORT should not be used when PCI is being used

From Al Stone <astone@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH] arm64: CONFIG_DEVPORT should not be used when PCI is being used
Date 2016-04-07 18:00 +0200
Message-ID <rlkvF-692-27@gated-at.bofh.it> (permalink)
References <rl3bu-1Cm-47@gated-at.bofh.it> <rl5PX-3DR-1@gated-at.bofh.it> <rlcy6-kR-3@gated-at.bofh.it>
Organization Red Hat, Inc.

Show all headers | View raw


On 04/07/2016 01:26 AM, Geert Uytterhoeven wrote:
> On Thu, Apr 7, 2016 at 2:18 AM, Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
>> On Wed, Apr 06, 2016 at 03:27:20PM -0600, Al Stone wrote:
>>> On arm64 systems, using /dev/port does not really make sense; this is
>>> historically used for other architectures to access ISA IO ports, which
>>> with any luck do not exist on arm64 platforms.  With the following snippet
>>> of perl code (from Jeff Bastian <jbastian@redhat.com>), we can reliably
>>> panic an arm64 system with PCI enabled:
>>>
>>>       #!/usr/bin/perl -w
>>>       # extracted from sensors-detect from lm_sensors
>>>       # to reproduce kernel crash when probing the
>>>       # Super-I/O ports
>>>       use Fcntl qw(:DEFAULT :seek);
>>>       sysopen(IOPORTS, "/dev/port", O_RDWR);
>>>       binmode(IOPORTS);
>>>       sysseek(IOPORTS, 0x2e, 0);
>>>       syswrite(IOPORTS, pack("C", 0x0d), 1);
> 
> There are plenty of ways to crash a system as the root user...

Of course.  This was just a new one.

>>> So, make sure CONFIG_DEVPORT cannot be set on arm64; it cannot really be
>>> used and it allows us to crash a kernel from user space.
>>>
>>> Signed-off-by: Al Stone <ahs3@redhat.com>
>>> Cc: Arnd Bergmann <arnd@arndb.de>
>>> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>>> ---
>>>  drivers/char/Kconfig | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
>>> index b272397..c532f62 100644
>>> --- a/drivers/char/Kconfig
>>> +++ b/drivers/char/Kconfig
>>> @@ -587,7 +587,7 @@ config TELCLOCK
>>>
>>>  config DEVPORT
>>>       bool
>>> -     depends on !M68K
>>> +     depends on !M68K && !ARM64
>>
>> Why not fix the real bug here, it's odd that only these two arches need
>> this disabled, don't you agree?

Agreed.  It does seem odd.  I'm not sure I understand which bug you're thinking
is the real one, though -- that DEVPORT should be disabled in all places that
don't have ISA or that arm64 needs to have /dev/port work properly?  Or perhaps
I missed something else entirely...

> In fact even the !M68K dependency is odd.
> The logic seems to originate from commit 153dcc54df826d2f ("[PATCH] mem driver:
> fix conditional on isa i/o support"), which accidentally changed an "||" into
> an "&&".
> 
> Will send a patch later...
> 
> Gr{oetje,eeting}s,
> 
>                         Geert

Aha.  I missed that bit.  Sorry about that.  So something like this instead:

config DEVPORT
	bool
	depends on ISA && PCI
	default y

That makes more sense.  Thanks.	

-- 
ciao,
al
-----------------------------------
Al Stone
Software Engineer
Red Hat, Inc.
ahs3@redhat.com
-----------------------------------

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] arm64: CONFIG_DEVPORT should not be used when PCI is being used Al Stone <ahs3@redhat.com> - 2016-04-06 23:30 +0200
  Re: [PATCH] arm64: CONFIG_DEVPORT should not be used when PCI is  being used Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-07 02:20 +0200
    Re: [PATCH] arm64: CONFIG_DEVPORT should not be used when PCI is  being used Geert Uytterhoeven <geert@linux-m68k.org> - 2016-04-07 09:30 +0200
      Re: [PATCH] arm64: CONFIG_DEVPORT should not be used when PCI is  being used Al Stone <astone@redhat.com> - 2016-04-07 18:00 +0200
        Re: [PATCH] arm64: CONFIG_DEVPORT should not be used when PCI is being used Arnd Bergmann <arnd@arndb.de> - 2016-04-09 04:30 +0200
        Re: [PATCH] arm64: CONFIG_DEVPORT should not be used when PCI is  being used Jon Masters <jcm@jonmasters.org> - 2016-04-12 07:20 +0200

csiph-web