Re: regarding const variables/structures

2018-09-14 Thread Kenneth Adam Miller
Don't be discouraged! So, if you only read the code, it may appear to you that "in the small" you are understanding the code. But, the possible states and paths are a large combinatorial, and lots of things can happen at runtime that you will not be able to predict, even after only reading the

Re: Fwd: Custom Linux Kernel Scheduler issue

2016-11-24 Thread Kenneth Adam Miller
, "Greg KH" <g...@kroah.com> wrote: > On Thu, Nov 24, 2016 at 01:05:47PM -0500, Kenneth Adam Miller wrote: > > So, I ran perf on my host and it came back far more true. The top > consumers of > > time were all atomics and some function called sse3, which I be

Re: Fwd: Custom Linux Kernel Scheduler issue

2016-11-24 Thread Kenneth Adam Miller
of the kernel as designed and it used additional extensions and features. I just thought of something-what if there is some kind of page size difference between my host and my Linux kernel causing the performance problems? On Nov 24, 2016 11:33 AM, "Kenneth Adam Miller" <kennethadammil...@gma

Fwd: Custom Linux Kernel Scheduler issue

2016-11-24 Thread Kenneth Adam Miller
On Nov 24, 2016 2:18 AM, "Greg KH" <g...@kroah.com> wrote: > > On Thu, Nov 24, 2016 at 02:01:41AM -0500, Kenneth Adam Miller wrote: > > Hello, > > > > > > I have a scheduler issue in two different respects: > > > > 1) I have a process that

Re: Fwd: Custom Linux Kernel Scheduler issue

2016-11-24 Thread Kenneth Adam Miller
On Thu, Nov 24, 2016 at 11:13 AM, Greg KH <g...@kroah.com> wrote: > On Thu, Nov 24, 2016 at 10:31:18AM -0500, Kenneth Adam Miller wrote: >> On Nov 24, 2016 2:18 AM, "Greg KH" <g...@kroah.com> wrote: >> > >> > On Thu, Nov 24, 2016 at 02:01:41

Custom Linux Kernel Scheduler issue

2016-11-23 Thread Kenneth Adam Miller
Hello, I have a scheduler issue in two different respects: 1) I have a process that is supposed to tight loop, and it is being given very very little time on the system. I don't want that - I want those who would use the processor to be given the resources to run as fast as they each can. 2)

Re: PCI drivers and interrupts

2016-11-04 Thread Kenneth Adam Miller
Oh! It's just a particular memory addressed, and that's what is being memory mapped into user land. Then I could just write a value in the kernel land, just as I would from the user land, to the address that is being memory mapped in. I should just read the device spec better and test how to write

PCI drivers and interrupts

2016-11-04 Thread Kenneth Adam Miller
Hello, I'm trying to author a driver that communicates over shared memory within the kernel land between concurrent userland processes. I'm using this as a base: https://github.com/henning-schild/ivshmem-guest-code/blob/master/kernel_module/uio/uio_ivshmem.c I've been able to build it and to

Re: QEMU?

2016-10-19 Thread Kenneth Adam Miller
That doesn't work for our use case. We have special hardware for our use case. On Oct 19, 2016 12:21 PM, "Daniel." <danielhi...@gmail.com> wrote: > Why not use networking? > > 2016-10-19 8:53 GMT-02:00 Kenneth Adam Miller <kennethadammil...@gmail.com > >:

QEMU?

2016-10-19 Thread Kenneth Adam Miller
So, we can use qemu within our development system here, but the problem is we have something that is a bit specialized in that the machines talk to one another over a special interface. It's a bit like named pipes, and to our applications, named pipes are a sufficient interface to test over. In

Re: Char device write repeating

2016-10-05 Thread Kenneth Adam Miller
, "Martin Kletzander" <mklet...@redhat.com> wrote: > On Tue, Oct 04, 2016 at 05:05:57PM +0200, Greg KH wrote: > >> On Tue, Oct 04, 2016 at 10:58:16AM -0400, Kenneth Adam Miller wrote: >> >>> I have a character device that I am calling write on and which is

Char device write repeating

2016-10-04 Thread Kenneth Adam Miller
I have a character device that I am calling write on and which is succeeding, but which is repeatedly executing. I have hard coded the return value to one, so I don't think the userland standard library is retrying but I could be wrong. Can anybody tell me why write would be re-executed by the

Re: Driver duplicate?

2016-03-07 Thread Kenneth Adam Miller
On Mon, Mar 7, 2016 at 4:49 PM, <valdis.kletni...@vt.edu> wrote: > On Mon, 07 Mar 2016 16:08:01 -0500, Kenneth Adam Miller said: > > > Can't release it. It looks a lot like this though: > > Note that you're going to have a *really* hard time shipping hardware > with a l

Re: Driver duplicate?

2016-03-07 Thread Kenneth Adam Miller
On Mon, Mar 7, 2016 at 3:53 PM, Greg KH <g...@kroah.com> wrote: > On Mon, Mar 07, 2016 at 03:37:24PM -0500, Kenneth Adam Miller wrote: > > > > > > On Mon, Mar 7, 2016 at 3:29 PM, Greg KH <g...@kroah.com> wrote: > > > > On Mon, Mar 07, 2016 a

Re: Driver duplicate?

2016-03-07 Thread Kenneth Adam Miller
On Mon, Mar 7, 2016 at 3:29 PM, Greg KH <g...@kroah.com> wrote: > On Mon, Mar 07, 2016 at 03:21:44PM -0500, Kenneth Adam Miller wrote: > > > > > > On Mon, Mar 7, 2016 at 3:17 PM, Greg KH <g...@kroah.com> wrote: > > > > On Mon, Mar 07, 2016 a

Re: Driver duplicate?

2016-03-07 Thread Kenneth Adam Miller
On Mon, Mar 7, 2016 at 3:17 PM, Greg KH <g...@kroah.com> wrote: > On Mon, Mar 07, 2016 at 03:00:50PM -0500, Kenneth Adam Miller wrote: > > I have a driver that manages three sets of identical data structures that > > differ only in address values. Currently, I pray that the d

Re: Driver duplicate?

2016-03-07 Thread Kenneth Adam Miller
Actually, I just realized that there is probably a way to look up the character device name with the file* that is passed in with the mmap call. Can anybody say how? On Mon, Mar 7, 2016 at 3:00 PM, Kenneth Adam Miller < kennethadammil...@gmail.com> wrote: > I have a driver that mana

Driver duplicate?

2016-03-07 Thread Kenneth Adam Miller
I have a driver that manages three sets of identical data structures that differ only in address values. Currently, I pray that the device file to which I have callbacks mapped for the driver gets called sequentially, because there are pairs of mmap's that need to be made. I know that this isn't

Re: Books Regarding Linux Kernel

2016-02-21 Thread Kenneth Adam Miller
Those are the popular three, but the documentation provided by kernel authors themselves as well as source code is also expected. Lastly, semantics of the machine are often a required read. The intel manual might be something that belongs on your list, if you want to truly understand. But no

How to statically build kernel module?

2016-01-22 Thread Kenneth Adam Miller
Is there a guidance anywhere? I know my question is simple and straightforward, but I've looked around a bit and I can't find a direct way to statically build a kernel module into the kernel. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org

Re: Inexplicable PROT_EXEC flag set on mmap callback

2016-01-16 Thread Kenneth Adam Miller
dependency issues between my host machine and the target machine. I had no idea that settings like this would carry over to my task at hand. On Sat, Jan 16, 2016 at 1:08 PM, Mike Krinkin <krinkin@gmail.com> wrote: > On Sat, Jan 16, 2016 at 12:45:17PM -0500, Kenneth Adam Miller wrote:

Re: Inexplicable PROT_EXEC flag set on mmap callback

2016-01-16 Thread Kenneth Adam Miller
The particular non-C binary that I'm using is rust with musl support, so that I can statically compile the binary in order to eliminate all library dependencies and then run it on a buildroot based linux. On Sat, Jan 16, 2016 at 1:32 PM, Kenneth Adam Miller < kennethadammil...@gmail.com>

Re: Inexplicable PROT_EXEC flag set on mmap callback

2016-01-16 Thread Kenneth Adam Miller
Wait, are you assuming that I'm using the latest kernel? Because I'm using 3.14.56... On Sat, Jan 16, 2016 at 1:31 PM, Mike Krinkin <krinkin@gmail.com> wrote: > On Sat, Jan 16, 2016 at 01:16:42PM -0500, Kenneth Adam Miller wrote: > > Ok, so you think that the format of t

Re: Inexplicable PROT_EXEC flag set on mmap callback

2016-01-16 Thread Kenneth Adam Miller
Astonishing. I changed my non-C based binary to remove PROT_READ, and I found that the mmap test completed successfully! Now I just have to figure out how to edit the binary headers to remove the READ_IMPLIES_EXEC option and then test it. On Sat, Jan 16, 2016 at 1:33 PM, Kenneth Adam Miller

Re: Inexplicable PROT_EXEC flag set on mmap callback

2016-01-16 Thread Kenneth Adam Miller
or any type of binary that's not using my device file? On Thu, Jan 14, 2016 at 12:28 PM, Kenneth Adam Miller < kennethadammil...@gmail.com> wrote: > > > On Thu, Jan 14, 2016 at 12:00 PM, Mike Krinkin <krinkin@gmail.com> > wrote: > >> Hi, i have a couple of questi

Inexplicable PROT_EXEC flag set on mmap callback

2016-01-14 Thread Kenneth Adam Miller
I have a custom drive and userland program pair that I'm using for a very special use case at my workplace where we are mapping specific physical address ranges into userland memory with a mmap callback. Everything works together well with a C userland program that calls into our driver's ioctl

Re: Inexplicable PROT_EXEC flag set on mmap callback

2016-01-14 Thread Kenneth Adam Miller
On Thu, Jan 14, 2016 at 12:00 PM, Mike Krinkin <krinkin@gmail.com> wrote: > Hi, i have a couple of questions to clarify, if you don't mind > > On Thu, Jan 14, 2016 at 11:04:28AM -0500, Kenneth Adam Miller wrote: > > I have a custom drive and userland program pair that

Re: Inexplicable PROT_EXEC flag set on mmap callback

2016-01-14 Thread Kenneth Adam Miller
In fact, it's being set to 0xff exactly, not just the VM_EXEC flag being set. vma->vm_flags & VM_EXEC resolves true, because vma->vm_flags is 0xff On Thu, Jan 14, 2016 at 11:04 AM, Kenneth Adam Miller < kennethadammil...@gmail.com> wrote: > I have a custom drive and us

Re: Mapping IO memory read-write

2016-01-13 Thread Kenneth Adam Miller
In this case, have you tried reading and writing to the memory segment being mmap'd from userland? Here's an example mmap'ing device driver if you need to see that: https://github.com/claudioscordino/mmap_alloc On Tue, Jan 12, 2016 at 6:10 PM, Jethro Beekman wrote: > I'm

Re: Customizing UIO mmap'ing

2015-12-18 Thread Kenneth Adam Miller
On Fri, Dec 18, 2015 at 9:20 AM, Henry Gomersall < henry.gomers...@smartacoustics.co.uk> wrote: > On 18/12/15 14:15, Kenneth Adam Miller wrote: > > > On Fri, Dec 18, 2015 at 7:05 AM, Henry Gomersall < > henry.gomers...@smartacoustics.co.uk> wrote: > >> On 17/12

Re: Customizing UIO mmap'ing

2015-12-18 Thread Kenneth Adam Miller
On Fri, Dec 18, 2015 at 7:05 AM, Henry Gomersall < henry.gomers...@smartacoustics.co.uk> wrote: > On 17/12/15 21:35, Kenneth Adam Miller wrote: > > Generally uio_dmem_genirq.c builds on top of uio.c, which provides a > common module basis for isolating code common to the other

Customizing UIO mmap'ing

2015-12-17 Thread Kenneth Adam Miller
So, previously I think I misunderstood how to use uio_dmem_genirq. Let me explain the way I think it currently works (bare with me, I departed from looking at this driver after only about a week of looking at it): Generally uio_dmem_genirq.c builds on top of uio.c, which provides a common module

Query Hard Memory Addresses

2015-10-22 Thread Kenneth Adam Miller
So, previously it was discussed that /dev/mem could be used to mmap a specific hardware memory into a process. Now I need to unit test some userland code that does exactly that, but I need to make sure that the unit test selects a small page that is always free in kernel land. How can I query mem

Re: Query Hard Memory Addresses

2015-10-22 Thread Kenneth Adam Miller
On Thu, Oct 22, 2015 at 3:38 PM, Jeff Haran <jeff.ha...@citrix.com> wrote: > > > > > *From:* kernelnewbies-boun...@kernelnewbies.org [mailto: > kernelnewbies-boun...@kernelnewbies.org] *On Behalf Of *Kenneth Adam > Miller > *Sent:* Thursday, October 22, 2015

UIO Kernel Driver with Buildroot and QEMU

2015-10-20 Thread Kenneth Adam Miller
So I'm building a uio kernel driver with buildroot, and I've gotten the driver to compile, installed it and can insmod it in the final buildroot target after booting the image with QEMU. I'm on linux kernel version 3.14, and I followed the guide here:

Re: UIO Kernel Driver with Buildroot and QEMU

2015-10-20 Thread Kenneth Adam Miller
driver and rely on the services or functions that these provide. But it doesn't explicitly say that anywhere in the guide that I read; if this were the case, why wouldn't it? On Tue, Oct 20, 2015 at 11:58 AM, Kenneth Adam Miller < kennethadammil...@gmail.com> wrote: > So I'm building a u

Re: UIO Kernel Driver with Buildroot and QEMU

2015-10-20 Thread Kenneth Adam Miller
Thanks! To anyone else that might know the answer thanks also (in advance) :D On Tue, Oct 20, 2015 at 5:56 PM, Mandeep Sandhu wrote: > >> I'm on linux kernel version 3.14, and I followed the guide here: > >> > >>

Re: UIO Kernel Driver with Buildroot and QEMU

2015-10-20 Thread Kenneth Adam Miller
On Tue, Oct 20, 2015 at 8:17 PM, Greg KH <g...@kroah.com> wrote: > On Tue, Oct 20, 2015 at 07:40:37PM -0400, Kenneth Adam Miller wrote: > > > > On Tue, Oct 20, 2015 at 6:54 PM, Greg KH <g...@kroah.com> wrote: > > > > On Tue, Oct 20, 2015 at 11:5

Re: UIO Kernel Driver with Buildroot and QEMU

2015-10-20 Thread Kenneth Adam Miller
On Tue, Oct 20, 2015 at 8:43 PM, Greg KH <g...@kroah.com> wrote: > On Tue, Oct 20, 2015 at 08:28:20PM -0400, Kenneth Adam Miller wrote: > > On Tue, Oct 20, 2015 at 8:17 PM, Greg KH <g...@kroah.com> wrote: > > On Tue, Oct 20, 2015 at 07:40:37PM -0400, Kenneth Ada

Re: UIO Kernel Driver with Buildroot and QEMU

2015-10-20 Thread Kenneth Adam Miller
On Tue, Oct 20, 2015 at 6:54 PM, Greg KH <g...@kroah.com> wrote: > On Tue, Oct 20, 2015 at 11:58:21AM -0400, Kenneth Adam Miller wrote: > > So I'm building a uio kernel driver with buildroot, and I've gotten the > driver > > to compile, installed it and can insmod it in th

Re: How to reserve physical address space region

2015-10-19 Thread Kenneth Adam Miller
Have you looked at the uio driver examples? Also, LDD3 may be old, but the API is at least still relevant. The explanation is too long to include here, but the book is free :D On Thu, Oct 15, 2015 at 11:53 PM, sahlot arvind wrote: > Hi, > > Is there an API kernel exposes to

Re: UIO Devices and user processes

2015-10-07 Thread Kenneth Adam Miller
ring buffers for that. On Wed, Oct 7, 2015 at 1:02 PM, Greg KH <g...@kroah.com> wrote: > On Tue, Oct 06, 2015 at 10:46:49AM -0400, Kenneth Adam Miller wrote: > > Let me be more precise in general to the overall original question: > > > > I want a userland process t

Re: UIO Devices and user processes

2015-10-06 Thread Kenneth Adam Miller
On Tue, Oct 6, 2015 at 11:04 AM, Yann Droneaud <ydrone...@opteya.com> wrote: > Hi, > > Le mardi 06 octobre 2015 à 10:46 -0400, Kenneth Adam Miller a écrit : > > Let me be more precise in general to the overall original question: > > > > I want a userland pro

Re: UIO Devices and user processes

2015-10-06 Thread Kenneth Adam Miller
, Kenneth Adam Miller < kennethadammil...@gmail.com> wrote: > > On Tue, Oct 6, 2015 at 10:32 AM, Yann Droneaud <ydrone...@opteya.com> > wrote: > >> Le mardi 06 octobre 2015 à 10:13 -0400, Kenneth Adam Miller a écrit : >> > >> > >> > On Tue, Oc

Re: UIO Devices and user processes

2015-10-06 Thread Kenneth Adam Miller
On Tue, Oct 6, 2015 at 10:32 AM, Yann Droneaud <ydrone...@opteya.com> wrote: > Le mardi 06 octobre 2015 à 10:13 -0400, Kenneth Adam Miller a écrit : > > > > > > On Tue, Oct 6, 2015 at 9:58 AM, Yann Droneaud <ydrone...@opteya.com> > > wrote: > > >

Re: UIO Devices and user processes

2015-10-06 Thread Kenneth Adam Miller
, and then once that's done it gets all it's memory from a specific region. On Tue, Oct 6, 2015 at 1:21 AM, Greg KH <g...@kroah.com> wrote: > On Mon, Oct 05, 2015 at 07:07:51PM -0400, Kenneth Adam Miller wrote: > > So, I'm reading about UIO devices and user processes for mapping memory >

Re: UIO Devices and user processes

2015-10-06 Thread Kenneth Adam Miller
On Tue, Oct 6, 2015 at 9:58 AM, Yann Droneaud <ydrone...@opteya.com> wrote: > Le mardi 06 octobre 2015 à 09:26 -0400, Kenneth Adam Miller a écrit : > > > Any body know about the issue of assigning a process a region of > > physical memory to use for it's malloc and free? I

UIO Devices and user processes

2015-10-05 Thread Kenneth Adam Miller
So, I'm reading about UIO devices and user processes for mapping memory into userland, and basically I have just a couple questions: What happens when a userland processes has allocated some resource from a driver that is facilitating UIO, but then subsequently crashes? I'd like to know that the

Re: Accessing pointers inside struct passed as argument to ioctl calls

2015-09-28 Thread Kenneth Adam Miller
You are right, and thank you for bringing this to the mailing list to be sure about it. There are several catastrophic vulnerabilities I can see waiting to happen. First, you should be sure that the pointer that they passed in is checked, as in the pointer to the buffer should only reside in the

Re: Accessing pointers inside struct passed as argument to ioctl calls

2015-09-28 Thread Kenneth Adam Miller
I'm pretty sure that exchanging ownership of memory pages between the kernel and userland is a really huge no-go for security as well. If you do that, you've implicitly given the user control of the memory map table contents, so you have to think like a malicious abuser of your api would. Copy

Re: Planning to write a patch

2015-08-26 Thread Kenneth Adam Miller
you could use that facility of the monitor to retain the setting. On Wed, Aug 26, 2015 at 2:16 PM, Umair Khan omerj...@gmail.com wrote: On Wed, Aug 26, 2015 at 11:21 PM, Kenneth Adam Miller kennethadammil...@gmail.com wrote: Well, it's probably worth doing for the sake of your learning

Re: Planning to write a patch

2015-08-26 Thread Kenneth Adam Miller
Well, it's probably worth doing for the sake of your learning. However, if you are going to get into the source, I think it's highly likely that you are going to see that the driver provides such a feature to userspace code through means of an ioctl, and in that case, you will probably be able to

Placement Allocation within the kernel

2015-08-20 Thread Kenneth Adam Miller
Suppose I want to do something analogous to C++'s new in userspace. But instead, I want an entirely new page table to be constructed at the location of my choosing. In addition, I want a specific region for that page table to manage, and this requires that this region no longer be available to the

Re: Safety in Kernel Development

2015-08-19 Thread Kenneth Adam Miller
: On 08/18/2015 08:30 PM, Kenneth Adam Miller wrote: | this is not a rational approach I'm very strongly confident the approach of achieving stronger guarantees Off topic ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http

Re: Safety in Kernel Development

2015-08-18 Thread Kenneth Adam Miller
Safir ru...@mrbrklyn.com wrote: On 08/18/2015 09:25 AM, Kenneth Adam Miller wrote: Ok- so I know that C is the defacto standard for kernel development. That about sums it up. did you have some question about kernel development. This is a mailing list on mentoring and skills developments

Re: Safety in Kernel Development

2015-08-18 Thread Kenneth Adam Miller
out there such as coverity scan, coccinelle, etc. [1] https://www.kernel.org/doc/Documentation/kmemleak.txt []'s On Tue, Aug 18, 2015 at 10:45 AM, Kenneth Adam Miller kennethadammil...@gmail.com wrote: Why? That's what the vast majority of the kernel is written in (besides

Re: Safety in Kernel Development

2015-08-18 Thread Kenneth Adam Miller
, but I sure would like my kernel module to be safer. If I can get it I don't care what language it's in-it just has to work and *be secure*. On Tue, Aug 18, 2015 at 9:40 AM, Robert P. J. Day rpj...@crashcourse.ca wrote: On Tue, 18 Aug 2015, Kenneth Adam Miller wrote: Ok- so I know that C

Re: Safety in Kernel Development

2015-08-18 Thread Kenneth Adam Miller
uses Sparse in kernel for static analyze purpose. There are others out there such as coverity scan, coccinelle, etc. [1] https://www.kernel.org/doc/Documentation/kmemleak.txt []'s On Tue, Aug 18, 2015 at 10:45 AM, Kenneth Adam Miller kennethadammil...@gmail.com wrote: Why? That's what

Safety in Kernel Development

2015-08-18 Thread Kenneth Adam Miller
Ok- so I know that C is the defacto standard for kernel development. What I'm not saying is that we should all move away from it or that it should be adopted internally. What I am saying is related to security concerns in developing a kernel driver. What may come of it may generally allow for

Re: Safety in Kernel Development

2015-08-18 Thread Kenneth Adam Miller
. On Tue, Aug 18, 2015 at 9:52 AM, Victor Rodriguez vm.ro...@gmail.com wrote: On Tue, Aug 18, 2015 at 8:25 AM, Kenneth Adam Miller kennethadammil...@gmail.com wrote: Ok- so I know that C is the defacto standard for kernel development. What I'm not saying is that we should all move away from

Re: Best approach to explore the linux source code

2015-08-15 Thread Kenneth Adam Miller
Well, if you really only want to find bugs in kernel code (specifically linux drivers) there was a recent white paper that came out that used Dynamo Rio to instrument and analyze the kernel. You can (I think) trigger simulated events to the kernel and compose a sort of fuzzing environment against

Reusable Memory Manager

2015-04-22 Thread Kenneth Adam Miller
So, I have a particular use case that has a lot to do with security. Basically, we have a intended secure kernel version with grsecurity and other patches on it, and we have a specific application that has to do data filtering as an inline reference monitor. The problem is, there is throughput

Re: Kernel Mocking

2015-02-20 Thread Kenneth Adam Miller
KH g...@kroah.com wrote: On Fri, Feb 20, 2015 at 02:51:25PM -0500, Kenneth Adam Miller wrote: So, in userland development, the idea of mocking is used to isolate context management and machine configuration into a single class or set of functions that can be reused, and also facilitate

Re: Kernel Mocking

2015-02-20 Thread Kenneth Adam Miller
, 2015 at 03:26:40PM -0500, Kenneth Adam Miller wrote: Thanks for your expedient answer! So, I was discussing an alternative to mocking; function hooking. But in a benign way. Is there any way to, at runtime replace the functionality of code in order that you specify what it does for any

Kernel Mocking

2015-02-20 Thread Kenneth Adam Miller
So, in userland development, the idea of mocking is used to isolate context management and machine configuration into a single class or set of functions that can be reused, and also facilitate testing much easier. Google mock is a great example. Say I develop a kernel module, and I want that