From owner-svn-src-all@freebsd.org Sun Dec 6 02:23:32 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C40C1A3B6AD; Sun, 6 Dec 2015 02:23:32 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from mr11p00im-asmtp003.me.com (mr11p00im-asmtp003.me.com [17.110.69.254]) (using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A5F411FC7; Sun, 6 Dec 2015 02:23:32 +0000 (UTC) (envelope-from rpokala@mac.com) Received: from [192.168.1.4] (c-24-6-178-251.hsd1.ca.comcast.net [24.6.178.251]) by mr11p00im-asmtp003.me.com (Oracle Communications Messaging Server 7.0.5.35.0 64bit (built Mar 31 2015)) with ESMTPSA id <0NYW00C1LZZ00C20@mr11p00im-asmtp003.me.com>; Sun, 06 Dec 2015 02:23:26 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2015-12-06_02:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 kscore.is_bulkscore=0 kscore.compositescore=1 compositescore=0.9 suspectscore=0 phishscore=0 bulkscore=0 kscore.is_spamscore=0 rbsscore=0 spamscore=0 urlsuspectscore=0.9 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1510090000 definitions=main-1512060044 User-Agent: Microsoft-MacOutlook/0.0.0.151105 Date: Sat, 05 Dec 2015 18:23:24 -0800 Subject: Re: svn commit: r291716 - in head: share/man/man4 sys/cam sys/cam/ata sys/cam/scsi sys/dev/md sys/geom sys/kern sys/pc98/include sys/sys usr.sbin usr.sbin/camdd From: Ravi Pokala Sender: "Pokala, Ravi" To: "Kenneth D. Merry" , Ravi Pokala Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-id: Thread-topic: svn commit: r291716 - in head: share/man/man4 sys/cam sys/cam/ata sys/cam/scsi sys/dev/md sys/geom sys/kern sys/pc98/include sys/sys usr.sbin usr.sbin/camdd References: <201512032054.tB3KsuUw037541@repo.freebsd.org> <75635FDB-E85F-4F0A-8EDC-8A29F8A095BE@panasas.com> <20151204163208.GA93141@mithlond.kdm.org> In-reply-to: <20151204163208.GA93141@mithlond.kdm.org> MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Dec 2015 02:23:33 -0000 -----Original Message----- From: "Kenneth D. Merry" Date: 2015-12-04, Friday at 08:32 To: Ravi Pokala Cc: , , Subject: Re: svn commit: r291716 - in head: share/man/man4 sys/cam sys/cam/ata sys/cam/scsi sys/dev/md sys/geom sys/kern sys/pc98/include sys/sys usr.sbin usr.sbin/camdd >On Thu, Dec 03, 2015 at 23:55:14 -0800, Ravi Pokala wrote: >>(a) How does that work? That is, how does the argument get to the ioctl handler in the kernel? >> > >In sys_ioctl(), in sys/kern/sys_generic.c, the pointer argument ("data") to >the ioctl syscall is passed through into kern_ioctl() and then on down >until it gets into the passioctl() call. It is passed through even when >the declared size of the ioctl is 0, as it is for the two new ioctls: > >... > >The problem is, upon exit from the ioctl, that data is freed. With a >queueing interface, we need to keep a copy of the CCB around after the >ioctl exits. You have the same problem even after r274017, because that >just provides a small buffer on the stack. (And would only help in the >pointer case. And we don't need to copyin the pointer.) > >So, to avoid that, we don't declare an argument, but we do pass in a >pointer and do the copy the user's CCB into a CCB that is allocated inside >the pass(4) driver. Clever! I've actually written and modified ioctl handlers many times, but it was always with a declared argument (via _IOR | _IOW | IOWR), and I never had to worry about persistence after the handler exits. So, I've never had to pay much attention to what happens between the userland call and the handler getting invoked. >> (b) The CCB is large, but the CCB pointer is just a pointer; shouldn't that be passed in as the arg? >> > >It is. Here's what camdd(8) does: Yeah, I was thrown by the fact that there wasn't a declared arg; sys_ioctl() DTRT and figures it out anyway. Thanks, Ravi (rpokala@) >Ken >-- >Kenneth Merry >ken@FreeBSD.ORG