linux-insides | A little bit about a linux kernel
kandi X-RAY | linux-insides Summary
kandi X-RAY | linux-insides Summary
A little bit about a linux kernel
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Read files from the given path .
- Checks whether the given URL is a live URL .
linux-insides Key Features
linux-insides Examples and Code Snippets
Community Discussions
Trending Discussions on linux-insides
QUESTION
The first function will work when on its own.
Function:
...ANSWER
Answered 2021-Jan-29 at 11:03Write-Host
"
Options:
Want to explore a 'Git-README'? Type 1
Want to load a 'Git-Repo'? Type 2
Want to make a new search? Type 3
"
QUESTION
To initialize a spinlock in kernel v4.19-rc5 one must use the spin_lock_init
macro defined as follows:
ANSWER
Answered 2018-Sep-29 at 12:30It doesn't need any if
statements because it exists for compile time checking.
You can see here that most spinlock operations are defined as macros, so they are not able to restrict type of their argument.
Consider the following example:
QUESTION
I'm trying to learn more about operating systems and I am currently taking a look how the Linux kernel is loaded and initialized.
Thanks to several related questions and this book, I was mostly able to understand how the transition from real mode to protected mode works.
However, the one thing I don't understand is, how and when the rest of the cores are switched to protected mode for multi-core processors (as far as I know, every core has its own set of control registers and the switch seems only to happen once in the booting process).
(I only found this somehow related question with an (short) answer that it is not possible to have two cores in different modes, however there was no source given.) This answer is wrong (thanks to e.g. n.m. in the comments for pointing that out).
Edit: As the comments already pointed out, the kernel might do this later in the initialization process, however when does that happen?
...ANSWER
Answered 2018-Jul-19 at 15:21Thanks to the input by sawdust, Peter Cordes and Michael Petch I was able to find the solution to my question (here for Linux v4.16):
Basically the transition from real mode to protected mode happens on every startup of a core (if hotplug is supported, that can happen at any time).
The first time a startup of a secondary processor happens, is during the SMP (Symmetric Multiprocessing) initialization (which is part of the kernel initialization). There, cpu_up()
is called for all CPUs present during initialization:
QUESTION
I am studying the code in Linux Kernel. Especially, Per-CPU variables.
I have a question about section
in the following part.
ANSWER
Answered 2017-Oct-15 at 00:37In this particular case section
is a variable attribute. It's a compiler-specific construct, not a symbol name to look for on the site.
Roughly, it just allows one to choose in what exact section shall the object be placed. I.e., normally the compiler (gcc
) places the generated objects in data
or bss
section of the program, but the attribute section
will help you to customise that.
A more comprehensive explanation can be found in GCC documentation.
QUESTION
I would like to implement a fanotify (supported by kernel > 2.6.37 - shipped in Android 5+) interface for the Android x86 - at first for goldfish emulator. I like to use the tool fsmon to start the filesystem monitor (a C program with basic structure to use the fanotify syscalls fanotify_init(2)
and fanotify_mark(2)
). I extended the fsmon code by own access-permissions. This permissions should be able to edited later by an system app in Android. (For example: I can choose later, which file types are denied)
The problem is following:
"The other big drawback of fanotify is that it currently is root-only (CAP_SYS_ADMIN-only to be more specific). This means that only the root user can request to use the monitoring capabilities provided by fanotify [...]" [source]
A rooted phone is a must have? But is there not another way to run on/after kernel boot the fsmon binary without rooting the device?
My first thought was to execute a file/service after every boot by init.d
. But to use it, you need a rooted phone. Then I found this: init.d scripts support:
"If your device is rooted the scripts can be executed using superuser permissions, but normal users can do also."
But I cant't understand how this can work (I didn't test it yet) Could this be a possible solution? For running it on other devices (without installing this app), I need to understand how the app bypass the problem. And init.d
gets executed in the user-space, is it even possible to run the monitor there as root?
Next thought was to run a crontab, but same story - rooted phone.
Now I go one level deeper - linking/execute the binary (or the c code) in the kernel boot sequence.. I have to be honest - I'm not a professional kernel developer. I know, that I need the execve systemcall to run a file in kernel. But is my approach right? If this could be the right way, how can I communicate later with the system app? Do I need to create a small "database" from where both sides can access? Which way is the best to access the provided data from the system app? (kernel-userspace-communication: Procfs, Sysfs, Configfs, ...) Where is the right place to start the monitor? (sure - after setting up the filesystem)
Or is it absolutely not possible to use fanotify without rooting the phone?
I would be very happy if someone can give me some tips...
...ANSWER
Answered 2017-Mar-28 at 13:01You are trying to use a feature that requires a permission (CAP_SYS_ADMIN or root) that is withheld from user and application processes by design. You either need a phone that provides this capability to designated applications or you need to root the phone. I do not know of any phones phones providing this capability, because it would enable an app to subvert the security of the system.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install linux-insides
You can use linux-insides like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page