A forum for reverse engineering, OS internals and malware analysis 

Ask your beginner questions here.
 #31915  by nimaarek
 Sat Jul 28, 2018 9:46 pm
Hi,
I have a beginner problem, but I can not answer and can not find it :roll:

I want to use a kernel function, one of its values is the memory address As a result, I wrote an in the user-mode program to print a variable's address. Something like this:
Code: Select all
int main()
{
	while(1)
	{
        printf("%x", &a);
	}
	return 0;
}
And I used the kernel function this way:
Code: Select all
#include <linux/module.h>
#include <linux/kernel.h>

int hello_init (void)
{
    int result = access_ok( VERIFY_WRITE, [color=#FF0000]addr[/color], 10);
    printk ("Hello, result = %d\n", result );
    return 0;
}

void hello_exit (void)
{
    printk ("Goodbye");
}

module_init(hello_init);
module_exit(hello_exit);
Now how does the output of the user-mode application that contains the variable address is entered as a parameter(addr) to the access_ok function like this?
 #31960  by nimaarek
 Fri Aug 10, 2018 8:40 am
Thank you, but I was wondering something else
The code I provided was an example
I wanted to know if the parameter of this function is an address
How does the kernel determine which address is for which processor?