Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754665AbbL3LRC (ORCPT ); Wed, 30 Dec 2015 06:17:02 -0500 Received: from mail-pa0-f43.google.com ([209.85.220.43]:35478 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754309AbbL3LQ7 (ORCPT ); Wed, 30 Dec 2015 06:16:59 -0500 Date: Wed, 30 Dec 2015 16:46:48 +0530 From: Sudip Mukherjee To: Arnd Bergmann Cc: Bamvor Jian Zhang , 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 Message-ID: <20151230111648.GA29697@sudip-pc> References: <1450346332-31830-1-git-send-email-bamvor.zhangjian@linaro.org> <1450346332-31830-3-git-send-email-bamvor.zhangjian@linaro.org> <2687762.Ja01N3hBuT@wuerfel> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="liOOAslEiF7prFVr" Content-Disposition: inline In-Reply-To: <2687762.Ja01N3hBuT@wuerfel> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2436 Lines: 103 --liOOAslEiF7prFVr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 > > > > Reviewed-by: Arnd Bergmann > > (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 --liOOAslEiF7prFVr Content-Type: text/x-csrc; charset=us-ascii Content-Disposition: attachment; filename="ppdev_user.c" #include #include #include #include #include #include #include #include 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); } --liOOAslEiF7prFVr-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/