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


Groups > linux.kernel > #1355129

Re: [v2] serial_core:recognize invalid pointer from userspace

From One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
Newsgroups linux.kernel
Subject Re: [v2] serial_core:recognize invalid pointer from userspace
Date 2016-03-10 14:50 +0100
Message-ID <rb98u-7FW-21@gated-at.bofh.it> (permalink)
References <raZiO-Rs-1@gated-at.bofh.it> <raZiO-Rs-9@gated-at.bofh.it> <raZCa-10L-11@gated-at.bofh.it> <rb0Rz-1TP-1@gated-at.bofh.it>
Organization Intel Corporation

Show all headers | View raw


> When userspace get setting with TIOCGSERIAL,
> 
> 1.On 64bit kernel + 32bit rootfs, compat ioctl code use 0xffffffff to 
> mark invalid conversion.

Start at the beginning. What is being passed back and forth that causes
the problem. What memory address does your uart have ?

> 2.On 32bit kernel with 64bit physical address, uart_get_info() in 
> serial_core will truncate a 64bit address into 32bit pointer with 
> following code:
>      retinfo->iomem_base      = (void *)(unsigned long)uport->mapbase;
> 
> Then when setting with TIOCSSERIAL ioctl, application can not provide 
> original value for iomem_base, it leads setserial can not work on such 
> boards.

Yes - it's a legacy feature that isn't really needed on 64bit systems.

> I don't know why kernel should expose this value to userspace, and seems 
> no need for userspace application to update an physical address for driver.
> Can we consider drop this member in handle for TIOCSSERIAL ioctl. Please 
> see a rough patch in attachment.

There are old PC and embedded cases from the time before devicetree and
ACPI were the default. It's now an API people rely upon.

It would make sense I think to return 0 for the base address if it
exceeds 32bits, and also to ignore a TIOCSSERIAL that passes 0 as the
address back. Would that fix your use case ?

Alan

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


Thread

[v2]serial_core:recognize invalid pointer from userspace Jiang Lu <lu.jiang@windriver.com> - 2016-03-10 04:20 +0100
  [v2] serial_core:recognize invalid pointer from userspace Jiang Lu <lu.jiang@windriver.com> - 2016-03-10 04:20 +0100
    Re: [v2] serial_core:recognize invalid pointer from userspace Greg KH <gregkh@linuxfoundation.org> - 2016-03-10 04:40 +0100
      Re: [v2] serial_core:recognize invalid pointer from userspace "Lu.Jiang" <lu.jiang@windriver.com> - 2016-03-10 06:00 +0100
        Re: [v2] serial_core:recognize invalid pointer from userspace One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk> - 2016-03-10 14:50 +0100
          Re: [v2] serial_core:recognize invalid pointer from userspace "Lu.Jiang" <lu.jiang@windriver.com> - 2016-03-11 03:40 +0100

csiph-web