Questions tagged [xnu]

xnu is the name of the operating system kernel that underpins Mac OS X/darwin and iOS.

xnu is the name of the operating system kernel that underpins Darwin, which in turn is the core of Apple's macOS (formerly OS X and Mac OS X), iOS/iPadOS (formerly iPhoneOS), tvOS, and watchOS operating systems. It has its origins in the NeXTStep operating system, and is a combination of parts of the Mach kernel (mainly the virtual memory subsystem and inter-process communication via Mach "ports"), the 4.3BSD kernel (networking, process management, POSIX compatibility, VFS/file system layer) and a device driver subsystem called the I/O Kit, which was developed in C++ specifically for the xnu kernel.

147 questions
1
vote
1 answer

Mount/Unmount filesystem from macOS kernel extension

hdiutil can attach and detach a DMG file containing HFS+ partition, into selected mount-point. However, it uses the private API of DiskImages.framework. My aim is to make this task fully programmatic, so I look for alternative in the kernel drivers…
Zohar81
  • 4,554
  • 5
  • 29
  • 82
1
vote
1 answer

Using `decltype` in IOKit code

When compiling IOKit based kernel extension, the c++ compiler cannot recognize the keyword decltype. int f = 123; int (*f_ptr)() = 0; f_ptr = (decltype(f_ptr)) f; Compiler fail on the code above for reason : Use of undeclared identifier…
user7256215
1
vote
1 answer

Show backtrace for remote threads in kernel space

When debugging in kernel space, I sometimes wish to search for thread according to its backtrace frames among a group of threads, like all the threads on a specific task. For example, getting kernel_task id (lldb) showalltasks task …
Zohar81
  • 4,554
  • 5
  • 29
  • 82
1
vote
1 answer

Getting Shutdown and restart notifications in macOS

I'd like my IOKit driver to get notification of power off and restart events. Fortunately, IOKit provides this sort of notification using IOService::systemWillShutDown method which should be overwritten and include my logic as well. Here's an…
Irad K
  • 867
  • 6
  • 20
1
vote
1 answer

My USB Function Driver Doesn't Load If Dongle Is Attached At Boot

This is new just today. It's been working well for a while now. When functioning normally, the driver will match on the USB device's product and vendor IDs, then will load and operate. It's a USB video adapter so under normal operation, one sees a…
Mike Crawford
  • 2,232
  • 2
  • 18
  • 28
1
vote
1 answer

Passing CFDictionary via IOKIt command

I'm looking for a universal method to configure parameters from userspace agent to kernel since there is no Mac equivalent to windows registry where driver can directly access any key in this table using ZwQueryValueKey command. Therefore, I'd…
Zohar81
  • 4,554
  • 5
  • 29
  • 82
1
vote
0 answers

Cannot run execve on files that are blocked to /usr/libexec/amfid

I wanted to use Kauth in order to block some files from being executed by other processes except mine. However, it seems like even I cannot run the process since I also block the file from amfid (The mobile file integrity daemon, funny it's also…
Irad K
  • 867
  • 6
  • 20
1
vote
1 answer

Where is the kprintf (kernel printf) log on Sierra?

There are lots of pages that explain it but I can't find it. Many of the articles I find only work on El Capitan and older systems. I cannot use the fwkpfv right now as I don't have the right dongles. My client is getting me a used MacBook that…
Mike Crawford
  • 2,232
  • 2
  • 18
  • 28
1
vote
0 answers

Memory profiler/analyzer for macOS kext

Before I start inventing the wheel, I've decided to do some searching to look if my desired feature is already implemented somewhere. Generally, I'd like to analyze my macOS kext and look for any memory issues (especially leaked memory). More…
Zohar81
  • 4,554
  • 5
  • 29
  • 82
1
vote
1 answer

is there a workqueue feature in xnu kernel?

I need to use workqueue-like feature on Mac OSX (kernel mode driver) and am looking for a way to add work into a queue to be processed by a kernel thread later. Conceptually this is the same thing as workqueue feature available in Linux kernel. Is…
musfiqniaz
  • 11
  • 1
1
vote
1 answer

Which KPI Library Is IODeviceMemory Declared In?

Google yields no insight. I wasn't able to figure it out by searching around in the kernel source. I'm using the open source IOProxyVideoFamily to implement a virtual framebuffer. I just replaced a C-style cast to IODeviceMemory with…
Mike Crawford
  • 2,232
  • 2
  • 18
  • 28
1
vote
1 answer

nvram doesn't remember my boot-args settings. How to fix it?

I'm working on a kernel extension - a device driver - and rely heavily on diagnostic messages that come from kprintf(). $ fwkpfv on the host machine will display log messages from kprintf() on the target, but it needs "debug=0x8" in boot-args. #…
Mike Crawford
  • 2,232
  • 2
  • 18
  • 28
1
vote
1 answer

Is it possible to sending a signal to a process in Darwin/XNU/OSX/macOS?

I've been working on a system program targeted for POSIX but I've run into the problem of not having access to sigqueue. Does Darwin/XNU have an alternative way of sending signals to another process? I've seen kill() but nothing else.
Gravis
  • 992
  • 11
  • 17
1
vote
1 answer

Checking local filesystem fsid from osx kernel extension (kext)

I've got WA for checking what is the local fsid from within kext context, simply by reading predefined local file status. static inline uint64_t get_fsid(const vfs_context_t ctx, const vnode_t vp) { struct vnode_attr vap; VATTR_INIT(&vap); …
Zohar81
  • 4,554
  • 5
  • 29
  • 82
1
vote
1 answer

Building Darwin 16.6 from source?

Put succinctly I need a base for my system, since it was built on macOS Darwin seems like the logical choice as it will require the least porting effort. I know you can download up to Darwin 8.0.1 from Apple, and the full source tree is available…
Alison E.E.
  • 196
  • 7