From owner-freebsd-hackers@FreeBSD.ORG Thu Apr 29 21:19:48 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 52510106566C for ; Thu, 29 Apr 2010 21:19:48 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: from mail-ew0-f224.google.com (mail-ew0-f224.google.com [209.85.219.224]) by mx1.freebsd.org (Postfix) with ESMTP id D41958FC08 for ; Thu, 29 Apr 2010 21:19:47 +0000 (UTC) Received: by ewy24 with SMTP id 24so5078129ewy.33 for ; Thu, 29 Apr 2010 14:19:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=zUEmUd18xPrBtzaqmgOw/PBmoQcZfw0RAFZO7jrkCl4=; b=rrdiJ+cpKI8IO6Xray9vZNFKmh2Mz3wbmYRPrm81kjGYz/qcvZTC0iHDmQ01LtYvWB OCRqOy+1sfjDAigXC09y/xwEK1aBxpL5PnTvTAP1+4idgAd1WgZkqM5Y2BsH9m2mqN/I OGmyg6o3OxN+t/7s+hwdHnTVBBJfNNYfqI1Nk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=qbo9Jxxv0Ph3FKFipHupHIBsYGq7K1zu1VbX3HkEFkmzabjvE4xvKX3ln8HQmlXdli lXZigKyqv9PPf2mNkK7kwG3YQcdilUpQieu1KLSyiWZHZdGXdaDDN4B31AY9ob2pj4ed tdrA8zKPRCMiH1iwU7OBuc9uhRgbWEaNtm0RM= MIME-Version: 1.0 Received: by 10.213.110.135 with SMTP id n7mr3645955ebp.66.1272575981227; Thu, 29 Apr 2010 14:19:41 -0700 (PDT) Received: by 10.213.10.6 with HTTP; Thu, 29 Apr 2010 14:19:41 -0700 (PDT) In-Reply-To: References: <201004291418.09768.jhb@freebsd.org> <201004291606.35899.jhb@freebsd.org> Date: Thu, 29 Apr 2010 17:19:41 -0400 Message-ID: From: Ryan Stone To: =?ISO-8859-2?Q?Luk=E1=B9_Czerner?= Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org Subject: Re: ioctl, copy string from user X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Apr 2010 21:19:48 -0000 > Apparently I need to tell ioctl how big is the variable I am > providing to it ([MAXLEN]). The odd thing is, when I have a structure > like this: > > struct lrfs_attach_info { > =A0 =A0 =A0 =A0char *name; > =A0 =A0 =A0 =A0int priority; > }; > > and I pass the pointer to that structure to the ioctl, it just > works. I can even use the 'name' string from the structure without > any problems, apparently it translates the pointer properly, but I > did not expect this... I think that you'll find that what actually happens is that you're reading from the userspace pointer. That will work as long as the pointer is mapped, but you'll panic if what it points to gets swapped out or is invalid.