public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>,
	linux-kernel@vger.kernel.org, y2038@lists.linaro.org,
	gregkh@linuxfoundation.org, broonie@kernel.org
Subject: Re: [PATCH v2 2/2] ppdev: add support for compat ioctl
Date: Wed, 30 Dec 2015 16:46:48 +0530	[thread overview]
Message-ID: <20151230111648.GA29697@sudip-pc> (raw)
In-Reply-To: <2687762.Ja01N3hBuT@wuerfel>

[-- Attachment #1: Type: text/plain, Size: 1065 bytes --]

On Fri, Dec 18, 2015 at 12:12:05AM +0100, Arnd Bergmann wrote:
> On Thursday 17 December 2015 17:58:52 Bamvor Jian Zhang wrote:
> > The arg of ioctl in ppdev is the pointer of integer except the
> > timeval in PPSETTIME, PPGETTIME. Different size of timeval
> > is already supported by the previous patches. So, it is safe
> > to add compat support.
> > 
> > Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
> > 
> 
> Reviewed-by: Arnd Bergmann <arnd@arndb.de>
> 
> (I think I replied with the reviewed-by tag before to this patch)

I was testing this series today. And it is breaking my userspace code. I
am attaching my userspace code for you to check. Its very simple
userspace code:
1: open
2: ioctl to claim
3: ioctl - PPGETTIME
4: ioctl - PPSETTIME
5: ioctl - PPGETTIME
6: ioctl - release
7: close

Without this series it works as expected.

With this series applied, the userspace code prints the error message:
PPNEGOT: Bad address

I traced it with strace and:
ioctl(3, PPGETTIME, 0xbfe91508)         = -1 EFAULT (Bad address)

regards
sudip

[-- Attachment #2: ppdev_user.c --]
[-- Type: text/x-csrc, Size: 890 bytes --]

#include <stdio.h>
#include<stdlib.h>
#include <unistd.h>
#include <linux/ioctl.h>
#include <linux/parport.h>
#include <linux/ppdev.h>
#include <fcntl.h>
#include <sys/time.h>

int main(int argc, char *argv[])
{
  int fd
  struct timeval tv;	

  fd = open("/dev/parport0",O_RDWR);
  if (fd == -1)
  {
    perror("open");
    exit(1);
  }
  if (ioctl(fd,PPCLAIM))
  {
    perror("PPCLAIM");
    close(fd);
    exit(1);
  }
  if (ioctl(fd, PPGETTIME, &tv))
  {
    perror ("PPNEGOT");
    close (fd);
    return 1;
  }
  printf("sec %u usec %u\n",tv.tv_sec, tv.tv_usec);
  tv.tv_sec = 50;
  tv.tv_usec = 1000;
  if (ioctl(fd, PPSETTIME, &tv))
  {
    perror ("PPNEGOT");
    close (fd);
    return 1;
  }
  if (ioctl(fd, PPGETTIME, &tv))
  {
    perror ("PPNEGOT");
    close (fd);
    return 1;
  }
  printf("sec %u usec %u\n",tv.tv_sec, tv.tv_usec);
  ioctl (fd, PPRELEASE);
  close(fd);
}

  reply	other threads:[~2015-12-30 11:17 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-17  9:58 [PATCH v2 0/2] Convert ppdev to y2038 safe Bamvor Jian Zhang
2015-12-17  9:58 ` [PATCH v2 1/2] ppdev: convert " Bamvor Jian Zhang
2015-12-17  9:58 ` [PATCH v2 2/2] ppdev: add support for compat ioctl Bamvor Jian Zhang
2015-12-17 23:12   ` Arnd Bergmann
2015-12-30 11:16     ` Sudip Mukherjee [this message]
2015-12-30 13:24       ` Bamvor Jian Zhang
2015-12-30 13:48         ` Sudip Mukherjee
2015-12-30 13:51         ` [Y2038] " Arnd Bergmann
2015-12-30 14:20           ` Bamvor Jian Zhang
2015-12-31  9:43             ` Sudip Mukherjee
2015-12-31 14:12               ` Arnd Bergmann
2016-01-01  5:04                 ` Sudip Mukherjee
2016-01-01 22:09                   ` Arnd Bergmann
2016-01-02  6:29                     ` Sudip Mukherjee
2016-01-02 22:40                       ` Arnd Bergmann
2016-01-04 13:14                         ` Sudip Mukherjee
2016-01-04 13:26                           ` Arnd Bergmann
2016-01-06 12:56                           ` Bamvor Jian Zhang
2016-01-07 15:12                             ` Arnd Bergmann

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=20151230111648.GA29697@sudip-pc \
    --to=sudipm.mukherjee@gmail.com \
    --cc=arnd@arndb.de \
    --cc=bamvor.zhangjian@linaro.org \
    --cc=broonie@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=y2038@lists.linaro.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