site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Thread-index: Acnfs2iPzOKVYHiGRqSjm0OxUoYubgAAgeHO Thread-topic: copy some kernel extensions to /tmp directory and then load that kext when program Launches Hi :) I have solved the messy case. KEXT was getting build with privileges other than as root:wheel. Could not figure out why so but changing permissions is OK for now. I can load it from anywhere. Now, I will try to build helper tool. Is there sample helper tool available which can be used for reference? Thanks Rahul ________________________________________ From: darwin-kernel-bounces+rahulkumar_tibdewal=persistent.co.in@lists.apple.com [darwin-kernel-bounces+rahulkumar_tibdewal=persistent.co.in@lists.apple.com] On Behalf Of mm w [0xcafefeed@gmail.com] Sent: Thursday, May 28, 2009 10:13 PM To: darwin-kernel@lists.apple.com Subject: Re: copy some kernel extensions to /tmp directory and then load that kext when program Launches Hello, :) don't panic, there is something wrong with your setup, 1 regular case it sounds like you want to burn steps you have to understand which set of symbol you want to access and which version you want to use, as far I can understand (the name of your project) you may have set up your kext with the following dependencies <key>com.apple.kpi.bsd</key> ... <key>com.apple.kpi.libkern</key> I do encourage you to download and print the pdf files regarding kext and read those documents far from a computer. There are several explanation about what you can put in a kext Info.plist file and not only the about dependencies. Your kext needs a real sanity checking, a kext should be loadable anywhere, I can see several issues: chmod 0755 $(find "${kextpath}" -type d) chmod 0644 $(find "${kextpath}" -type f) chown -R root:wheel "${kextpath}" kextload -t ${kextpath} 2 the messy case now, it is certainly a problem of your parent directory in your user home, it's why you get this misleading and wrong warning, normally, it's working fine, you may run some chmod in your user home, it's working well from /tmp because e.g 1755, what I can say your devel environment is corrupted and messy, try to fix permissions in a proper way e.g don't disallow read access... I think you are in the "messy" case Best, On Thu, May 28, 2009 at 5:23 AM, Rahulkumar Tibdewal <rahulkumar_tibdewal@persistent.co.in> wrote:
Hi,
but I don't understand why you don't let the kexts into your app bundle and then execute from CFBundle Resources directory your pre-flight script using standard C functions
= I tried this but it faills to load and gives following error.
Error loading /Users/rahul/Desktop/MacResearch/InternetBlock/TcpFilter/trunk/build/Debug/TcpFilter.kext/Contents/MacOS/TcpFilter: dlopen(/Users/rahul/Desktop/MacResearch/InternetBlock/TcpFilter/trunk/build/Debug/TcpFilter.kext/Contents/MacOS/TcpFilter, 262): no suitable image found. Did find: /Users/rahul/Desktop/MacResearch/InternetBlock/TcpFilter/trunk/build/Debug/TcpFilter.kext/Contents/MacOS/TcpFilter: can't map
you can do whatever you want imagine you have your GUI app in awakeFromNib just execute the load using popen on a pre-flight,
= I would love to do that. But problem is I am able to load TcpFilter.kext from /tmp only.
sh-3.2$ sudo kextload -v /Users/rahul/Desktop/MacResearch/InternetBlock/TcpFilter/trunk/build/Release/TcpFilter.kext extension /Users/rahul/Desktop/MacResearch/InternetBlock/TcpFilter/trunk/build/Release/TcpFilter.kext has potential problems: Warnings { "Kext has immediate dependencies on both com.apple.kernel and com.apple.kpi components; use only one style" = true }
kextload: extension /Users/rahul/Desktop/MacResearch/InternetBlock/TcpFilter/trunk/build/Release/TcpFilter.kext appears to be loadable kextload: loading extension /Users/rahul/Desktop/MacResearch/InternetBlock/TcpFilter/trunk/build/Release/TcpFilter.kext kextload: extension /Users/rahul/Desktop/MacResearch/InternetBlock/TcpFilter/trunk/build/Release/TcpFilter.kext is not authentic (check ownership and permissions; run with -t for details)
second option create a deamon script loader/unloader using launchd, I don't understand what's your problem anyway I also used launchd. It also ask for password. Can see it on console. So, this dont load TcpFilter.kext
This thing is really frustrating. Please help. I also attached plist of TcpFilter.kext. May be that can give u clue to help me.
Thanks Rahul
________________________________________ From: darwin-kernel-bounces+rahulkumar_tibdewal=persistent.co.in@lists.apple.com [darwin-kernel-bounces+rahulkumar_tibdewal=persistent.co.in@lists.apple.com] On Behalf Of mm w [0xcafefeed@gmail.com] Sent: Thursday, May 28, 2009 12:34 AM To: darwin-kernel@lists.apple.com Subject: Re: copy some kernel extensions to /tmp directory and then load that kext when program Launches
if you don't know how to get a root Priviledge: (maybe it's the real question behind)
http://code.google.com/p/le-depotoir/source/browse/trunk/misc/auth.c
you could also use osascript or applescript (carbon embedded too)
do shell script "/bin/ls -la" with administrator privileges there are many well-known solutions (thousand lines on various forums) but it's definitely not a question for the kernel-dev-list or a kext problem
Best
On Wed, May 27, 2009 at 11:58 AM, mm w <0xcafefeed@gmail.com> wrote:
system(3) execve(2) popen(3) posix_spawn(2)
cp src -> dest, there are a lot of sub-api to copy data,
but in your case, you have only to spawn/exec/popen a pre-flight script in your code and do whatever you want as everybody does
but I don't understand why you don't let the kexts into your app bundle and then execute from CFBundle Resources directory your pre-flight script using standard C functions
you can do whatever you want imagine you have your GUI app in awakeFromNib just execute the load using popen on a pre-flight,
second option create a deamon script loader/unloader using launchd, I don't understand what's your problem anyway
Cheers!
On Wed, May 27, 2009 at 10:35 AM, Rahulkumar Tibdewal <rahulkumar_tibdewal@persistent.co.in> wrote:
Hi
As I said before, My heartiest apology for spam. Again that was not intentional.
I want to do this at standard user level. I am using C++/carbon code. You have give a scripts which will run for super user. However the case is I want to copy kext to /tmp and load from there itself on standard user machine. This will help server monitor network on that standard user machine.
Thanks Rahul
-----Original Message----- From: darwin-kernel-bounces+rahulkumar_tibdewal=persistent.co.in@lists.apple.com [mailto:darwin-kernel-bounces+rahulkumar_tibdewal=persistent.co.in@lists.apple.com] On Behalf Of mm w Sent: Wednesday, May 27, 2009 9:57 PM To: darwin-kernel@lists.apple.com Subject: Re: copy some kernel extensions to /tmp directory and then load that kext when program Launches
Hello,
your request is a bit messy, do you load your program at boot? deamon whatever or is it a Cocoa App that needs to work with its kexts ? you can use kextstat to grep your reversed DNS
popen NSTask whatever you choose are your friends, but I am not sure my answer fits with your multi spam request
sudo kextloader /tmp/kext.kext
#!/usr/bin/env bash
usage () { echo "Usage: kextdevel [load|unload] kext" exit 1 }
if [[ $UID -ne 0 ]]; then echo "System administrator privileges required" exit 1 fi
if [ $# != 2 ] ; then usage fi
if ! test -d "${2}" ; then usage fi
if test "${1}" = "load" ; then chmod 0755 $(find "${2}" -type d) chmod 0644 $(find "${2}" -type f) chown -R root:wheel "${2}" kextload -t "${2}" exit 0 elif test "${1}" = "unload" ; then kextunload "${2}" rm -Rf "${2}" exit 0 else usage fi
# EOF
Best
On Wed, May 27, 2009 at 7:01 AM, Rahulkumar Tibdewal <rahulkumar_tibdewal@persistent.co.in> wrote:
Hi,
I want to copy some kernel extensions to /tmp directory and then load that kext.
This can be done through super user privileges from terminal.
However I want to do this when my application launches.
Does anyone have any idea how can I do this?
Thanks
Rahul
DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/0xcafefeed%40gmail.com
This email sent to 0xcafefeed@gmail.com
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/rahulkumar_tibdewal%40p...
This email sent to rahulkumar_tibdewal@persistent.co.in
DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/rahulkumar_tibdewal%40p...
This email sent to rahulkumar_tibdewal@persistent.co.in
DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/rahulkumar_tibdewal%40p... This email sent to rahulkumar_tibdewal@persistent.co.in DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails. _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com