mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
To: "Lu.Jiang" <lu.jiang@windriver.com>
Cc: Greg KH <gregkh@linuxfoundation.org>,
	<linux-kernel@vger.kernel.org>, <linux-serial@vger.kernel.org>
Subject: Re: [v2] serial_core:recognize invalid pointer from userspace
Date: Thu, 10 Mar 2016 13:46:47 +0000	[thread overview]
Message-ID: <20160310134647.7053a520@lxorguk.ukuu.org.uk> (raw)
In-Reply-To: <56E0FE77.1020303@windriver.com>

> 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

  reply	other threads:[~2016-03-10 13:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-10  3:17 [v2]serial_core:recognize " Jiang Lu
2016-03-10  3:17 ` [v2] serial_core:recognize " Jiang Lu
2016-03-10  3:34   ` Greg KH
2016-03-10  4:56     ` Lu.Jiang
2016-03-10 13:46       ` One Thousand Gnomes [this message]
2016-03-11  2:30         ` Lu.Jiang

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=20160310134647.7053a520@lxorguk.ukuu.org.uk \
    --to=gnomes@lxorguk.ukuu.org.uk \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=lu.jiang@windriver.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®