mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: Rodolfo Giometti <giometti@enneenne.com>
Cc: linux-kernel@vger.kernel.org, Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] LinuxPPS (with new syscalls API)
Date: Tue, 26 Jun 2007 18:38:40 +0100	[thread overview]
Message-ID: <1182879520.3263.19.camel@shinybook.infradead.org> (raw)
In-Reply-To: <20070626170622.GA13886@enneenne.com>

On Tue, 2007-06-26 at 19:06 +0200, Rodolfo Giometti wrote:
> On Tue, Jun 26, 2007 at 11:57:07AM +0100, David Woodhouse wrote:
> > 
> > Your syscalls blindly dereference userspace pointers instead of using
> > copy_{to,from} user.
> 
> I use access_ok() to test userspace addresses. It should be ok,
> shouldn't it?

No; it's racy. You must use copy_from_user() and copy_to_user().

> > Why did you split all your syscalls into two functions?
> > 
> > s/__FUNCTION__/__func__/
> 
> Just for an easy management of mutex locking.

That sounds like you're scared of using goto. Don't be :)

> > s/antennas/antennae/
> 
> Done. However I found other files in the kernel code with the same
> error... ;)

This is often true of anything which gets pointed out during review. :)

> > You seem to have added debugging messages mentioning 'serial8250' into
> > serial_core.h
> 
> Yes! Fixed.
> 
> > You added <linux/pps.h> with #ifdef __KERNEL__ in it, but didn't export
> > it to userspace. Why?
> 
> This file is called by timepps.h who exports the userland data.

I don't see this timepps.h of which you speak. If it's a _userspace_
file, it cannot include <linux/pps.h> unless you actually add
<linux/pps.h> to the list of files which are exported.

Run 'make headers_install' and observe that there is no file
usr/include/linux/pps.h -- so there would be no /usr/include/linux/pps.h
generated from your kernel tree. You need to add 'unifdef-y += pps.h' to
include/linux/Kbuild for that to happen.

> > Your structures for userspace communication look OK -- I don't think you
> > need special 32/64 compatibility for them. You do need it for the
> > 'struct timespec' in sys_time_pps_fetch() though.
> 
> Mmm... can you please explain a bit what do you mean? Maybe just a
> link...

64-bit kernels can run 32-bit userspace programs. But some structures
come out _differently_ between 32-bit and 64-bit compilation, so the
system call needs a special 'compat' handler instead of just running the
normal 64-bit system call.

The 'struct timespec' is one structure which is sometimes different for
32-bit vs. 64-bit, so any system call taking a 'struct timespec' must
have a separate compat_sys_xxxx() to handle that. See something like
compat_sys_clock_settime() in kernel/compat.c for an example (but don't
use set_fs() like it does; just see how it handles the compat_timespec).

> > Must we have the ioctl-like interface to sys_time_pps_cmd()? If the
> 
> It seems to me stronger then other solutions...
> 
> > second argument is always 'struct pps_source_data_s *', why does the
> > syscall pretend it's 'void *'?
> 
> Just to keep sys_time_pps_cmd() generic for future new commands.

Hm. I'll let other people complain at you about that :)

-- 
dwmw2


  reply	other threads:[~2007-06-26 17:38 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-26 10:06 Rodolfo Giometti
2007-06-26 10:57 ` David Woodhouse
2007-06-26 17:06   ` Rodolfo Giometti
2007-06-26 17:38     ` David Woodhouse [this message]
2007-06-26 18:13       ` Rodolfo Giometti
2007-06-26 18:20         ` David Woodhouse
2007-06-27 10:14       ` Rodolfo Giometti
2007-06-27 10:18         ` David Woodhouse
2007-06-27 12:58           ` Rodolfo Giometti
2007-06-27 16:11             ` David Woodhouse
2007-06-27 17:45               ` Rodolfo Giometti
2007-06-27 17:49                 ` David Woodhouse
2007-06-27 22:46                   ` Rodolfo Giometti
2007-06-28  8:08                     ` David Woodhouse
2007-06-28  8:15                       ` Rodolfo Giometti
2007-06-28  8:31                         ` David Woodhouse
2007-06-28  8:40                           ` Rodolfo Giometti
2007-06-28 11:44                             ` David Woodhouse
2007-06-28 14:15                               ` Rodolfo Giometti
2007-06-28 16:14                               ` [PATCH] LinuxPPS (with new syscalls API) - new version Rodolfo Giometti
2007-06-29 11:38                                 ` David Woodhouse
2007-06-29 15:08                                   ` Rodolfo Giometti
2007-06-29 15:25                                     ` David Woodhouse
2007-06-29 15:38                                       ` Rodolfo Giometti
2007-06-29 15:41                                         ` David Woodhouse
2007-06-29 16:23                                           ` Rodolfo Giometti
2007-06-29 16:23                                             ` David Woodhouse
2007-06-29 16:36                                               ` Rodolfo Giometti
2007-06-29 16:38                                                 ` David Woodhouse
2007-06-29 15:55                                     ` David Woodhouse
2007-06-29 16:34                                       ` Rodolfo Giometti
2007-06-29 16:40                                         ` David Woodhouse
2007-06-30 17:13                                           ` Rodolfo Giometti
2007-07-01  7:13                                             ` Stephen Rothwell
2007-07-01 19:24                                               ` Rodolfo Giometti
2007-07-10 16:01                                                 ` Lennart Sorensen
2007-07-10 16:36                                                   ` Rodolfo Giometti
2007-07-10 16:36                                                     ` David Woodhouse
2007-07-10 16:44                                                       ` Rodolfo Giometti
2007-07-10 22:03                                                     ` Lennart Sorensen
2007-07-11  8:06                                                       ` Rodolfo Giometti
2007-07-11 15:22                                                         ` Lennart Sorensen
2007-07-11 16:32                                                           ` Rodolfo Giometti
2007-07-11  1:18                                                   ` Roman Zippel
2007-07-11 15:24                                                     ` Lennart Sorensen
2007-07-11 16:35                                                       ` Rodolfo Giometti
2007-07-11 17:34                                                       ` Roman Zippel
2007-07-01 12:03                                             ` David Woodhouse
2007-07-01 19:27                                               ` Rodolfo Giometti
2007-07-03  9:48                                               ` Rodolfo Giometti
2007-07-03 13:09                                                 ` David Woodhouse
2007-07-03 13:21                                                   ` Rodolfo Giometti
2007-07-09 13:19                                                   ` Rodolfo Giometti
2007-07-10 16:05                                                     ` David Woodhouse
2007-07-10 16:38                                                       ` Rodolfo Giometti
2007-07-11  9:17                                                         ` David Woodhouse
2007-07-11 10:46                                                           ` Rodolfo Giometti
2007-06-30  8:38                                 ` Christoph Hellwig
2007-06-30 17:06                                   ` Rodolfo Giometti
2007-07-08  9:05                                 ` Oleg Verych
2007-07-09  9:16                                   ` Rodolfo Giometti
2007-07-09 10:56                                     ` Makefiles for GNU make (Re: [PATCH] LinuxPPS (with new syscalls API) - new version) Oleg Verych
2007-07-09 10:57                                       ` Rodolfo Giometti
     [not found] <fa.KzVWiacZsGdGiMxLldFOOPOdIEw@ifi.uio.no>
     [not found] ` <fa.TdDfr0FpGG8OjqtqWj6RNRusuU0@ifi.uio.no>
     [not found]   ` <fa.qT2j8q7/hQ2xVpeJCg7VGv+FvpI@ifi.uio.no>
     [not found]     ` <fa.RLNIoDXtVxFnlYMPJh2Q2+yDDOk@ifi.uio.no>
2007-06-26 23:33       ` [PATCH] LinuxPPS (with new syscalls API) Robert Hancock

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=1182879520.3263.19.camel@shinybook.infradead.org \
    --to=dwmw2@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=giometti@enneenne.com \
    --cc=linux-kernel@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome