From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by befuddled.reisers.ca (Postfix, from userid 65534) id D1F341EF6B4; Fri, 19 Jul 2013 05:53:30 -0400 (EDT) Received: from aserp1040.oracle.com (aserp1040.oracle.com [141.146.126.69]) by befuddled.reisers.ca (Postfix) with ESMTPS id CAEC01EF56E for ; Fri, 19 Jul 2013 05:53:29 -0400 (EDT) Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r6J9rPv2022597 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 19 Jul 2013 09:53:27 GMT Received: from userz7022.oracle.com (userz7022.oracle.com [156.151.31.86]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r6J9rOJ7004566 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 19 Jul 2013 09:53:25 GMT Received: from abhmt118.oracle.com (abhmt118.oracle.com [141.146.116.70]) by userz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r6J9rOpx027236 for ; Fri, 19 Jul 2013 09:53:24 GMT MIME-Version: 1.0 Message-ID: <41356f9b-e7c3-4522-b960-142abea1cedd@default> Date: Fri, 19 Jul 2013 02:53:23 -0700 (PDT) From: Don Raikes Sender: Don Raikes To: "Speakup is a screen review system for Linux." Subject: ot memory allocation question X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.7 (607090) [OL 12.0.6668.5000 (x86)] X-Source-IP: ucsinet21.oracle.com [156.151.31.93] X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.2 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 X-BeenThere: speakup@linux-speakup.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: "Speakup is a screen review system for Linux." List-Id: "Speakup is a screen review system for Linux." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Jul 2013 09:53:31 -0000 Sorry folks, but I still have a question about all this kernel programming = stuff. =20 Is it possible from within a kernel module to allocate memory in userspace? =20 The reason I am asking is the function I am hooking into sys_write takes a = buffer as input, but the buffer is defined as const __user *. =20 To me this means that if I modify the text that I was given in the buffer a= nd want it to get written to the file, then I need to update the buffer. However since the buffer is a const, I shuldn't write to it, plus in my cas= e I am enlarging the amount of data, so if I were to cast the buffer to a w= ritable __user *, then I am in danger of overwriting something I shouldn't = in the user process (which in my case is the file pointer). =20 After completing the sys_write by passing the updated buffer to the origina= l sys_write, I try to close the file and get an error. =20 My solution: Allocate a new larger buffer inside of the userspace and copy_to_user into = the new buffer and then when I pass control to the "real" sys_write functio= n point it to the new buffer. =20 But the problem is how do I allocate this new buffer? --=20 Best Regards, Donald HYPERLINK "http://www.oracle.com/" \nOracle Donald raikes | Accessibility Specialist/ QA Engineer Phone: HYPERLINK "tel:+15202717608"+15202717608 | Mobile: HYPERLINK "tel:+1= 5202717608"+15202717608=20 Oracle Quality Assurance | Tucson, Arizona=20 HYPERLINK "http://www.oracle.com/commitment" \nGreen Oracle Oracle is committed to developing practices and products that help protect = the environment =20