Compiling Kernel Modules for Genode on iMX53 with TrustZone

2017-10-24 Thread Mauricio Gutierrez Barnett
Hello,

I have a question about adding kernel modules to the Genode OS.

So I have built and boot the tz_vmm scenario for platform hw_imx53_qsb_tz
on the i.MX53 development board using another thread on this mailing list
as a guide. I was able to get it up and running on the board with no
problems.
However, I need to install a kernel module into the normal world linux.
In order to do this I need to be able to cross compile the module for the
target kernel running in normal world from my desktop.
However, while I have access to the target compiler I do not have a target
kernel directory.
That is, only the final image of linux is provided, not the source code
used to compile it.
I know the version is provided as Linux version 2.6.35.3-01270-g9533414.
However, if I try to use the 2.6.35.3-generic version as a target I get a
symbol version error when I try to insmod:

"disagrees about version of symbol kmalloc_caches
Unknown symbol kmalloc_caches (err -22)"

I believe this is because the kernel running in the normal world has been
modified.
I am wondering if there is another way for me to compile kernel modules for
Genode. If not, would it be possible for you to release the source code of
your modified kernel which you used to create the Linux Image that runs in
the normal world?

Thank you for your time,

Mauricio Gutierrez
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
genode-main mailing list
genode-main@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/genode-main


Re: binary naming

2017-10-24 Thread Johannes Kliemann

Hi again,

I fixed the file naming and I don't need to rename the files anymore (I 
forgot to prepend the correct directory in the cpio archive).
With the cpio initramfs I chdir into /genode from the ROM session and 
correctly find the libraries. Yet the segfault and warning I described 
in the last mail still appear.


To reproduce the problem with the current state, check out [1]. The 
build configuration is the same as in the last mail.


Regards,
Johannes

[1]: 
https://github.com/jklmnn/genode/commit/2c899063f2bad1318bbde88f2472e017fc72be34


On 10/24/17 11:27, Johannes Kliemann wrote:

Hi,

while booting Genode directly on Linux I encountered the problem that
Linux requires to call `/init` in the initramfs. Unfortunately Genode
requires to call `core` which loads `init` so renaming core to init
isn't enough.


I renamed init to init2 core to init and called it with "label=init2"
which works at first (core finds all ROM sessions) but then segfaults
with "init2[45]: segfault at 7f11c473b128 ip 7f11c4645f40 sp
7ffc1c8c15f8 error 4 in ld.lib.so[7f11c45c5000+95000]" and the
warning "Warning: blocking canceled in entrypoint constructor".

This warning was addressed on Linux before in [0] and fixed in
ad2859b6b9dae96c48329eebc0a73527ba4deb9b. I have already included this
patch.

To boot Genode on Linux with this behaviour, checkout [1] and change
"KERNEL_RUN_OPT(linux) := --include power_on/linux --include log/linux"
to
"KERNEL_RUN_OPT(linux) := $(QEMU_RUN_OPT)"
in your etc/build.conf (with linux as kernel ofc).

Beside renaming I also tried to make the ROM session chdir into a sub
directory or to prepend this directory to the binary name. Neither of
made Genode correctly find the binaries. I have to say that Linux is not
booting into a real fs but is using a initramfs which consists of a cpio
archive.

What would be the way to go to either rename the binaries to a Linux
compatible scheme or to change the library search to find its binaries
in a cpio archive (both options should be changeable at build time to
still use the current linux)?

Regards,
Johannes

[0]: https://github.com/genodelabs/genode/issues/2521
[1]:
https://github.com/jklmnn/genode/commit/ef4becffcfc4bfc4079ff411872023b0362f346c

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
genode-main mailing list
genode-main@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/genode-main



--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
genode-main mailing list
genode-main@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/genode-main


Re: Qt5: Signals and QApplications inside Threads

2017-10-24 Thread Johannes Kliemann

Hi Boris,

I have a similar problem with running a Qt application from a second 
thread. In my case it segfaulted after QApplication::app.


Christian gave me a hint I wasn't able to try yet, but maybe it could be 
helpful for you, too.



On Mon, Oct 16, 2017 at 01:42:04PM +0200, Johannes Kliemann wrote:

I tried to create a provide an input session from a libc (in this case
an Qt application). If I just run it from the Main struct it will
correctly announce the session but since Main never returns, no client
will be able to use it.
I tried to circumvent this by putting the application into a separate
thread but this led to the following error:


Error: void Libc::Kernel::run(Libc::Application_code&) called from non-kernel 
context


Running this Qt application without wrapping it into with_libc makes it
segfault on initialization.

What is the correct way to do this? My current main is at [1].


Unfortunately, there is no "correct" way of implementing tasks like
the described currently. I must admit that with_libc() is the most
confusing function in Genode currently and we therefore will remove it
from the API soon. In fact, I myself did not expect that with_libc()
is needed in your context but there may be dependencies unknown to me.

I'd suggest a careful look into libports/src/app/avplay which provides
an input session too. The approach there is to create a second Genode
entrypoint for the input service and execute Qt code in the component
thread. I strongly encourage you not just to copy the avplay code as
it uses the older, low-level Rpc_entrypoint but use
Genode::Entrypoint.


Regards,
Johannes

On 10/23/17 15:51, Boris Mulder wrote:

Dear Genode folks,

I have built an application with Qt5. I want it to also be able to read
ROM modules from a report_rom server and to be able to handle updates to
that ROM using signals.

When I run QApplication::exec() however, it does not return and the
entrypoint cannot listen to signals, causing them to be ignored.

So I created another QThread and run my QApplication in there. Now I get
the following error:

     WARNING: QApplication was not created in the main() thread.

And the application does not do anything and does not react to events.

What can I do to be able to run both the qt event loop and the genode
event loop?


regards,

Boris



--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
genode-main mailing list
genode-main@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/genode-main


binary naming

2017-10-24 Thread Johannes Kliemann
Hi,

while booting Genode directly on Linux I encountered the problem that
Linux requires to call `/init` in the initramfs. Unfortunately Genode
requires to call `core` which loads `init` so renaming core to init
isn't enough.


I renamed init to init2 core to init and called it with "label=init2"
which works at first (core finds all ROM sessions) but then segfaults
with "init2[45]: segfault at 7f11c473b128 ip 7f11c4645f40 sp
7ffc1c8c15f8 error 4 in ld.lib.so[7f11c45c5000+95000]" and the
warning "Warning: blocking canceled in entrypoint constructor".

This warning was addressed on Linux before in [0] and fixed in
ad2859b6b9dae96c48329eebc0a73527ba4deb9b. I have already included this
patch.

To boot Genode on Linux with this behaviour, checkout [1] and change
"KERNEL_RUN_OPT(linux) := --include power_on/linux --include log/linux"
to
"KERNEL_RUN_OPT(linux) := $(QEMU_RUN_OPT)"
in your etc/build.conf (with linux as kernel ofc).

Beside renaming I also tried to make the ROM session chdir into a sub
directory or to prepend this directory to the binary name. Neither of
made Genode correctly find the binaries. I have to say that Linux is not
booting into a real fs but is using a initramfs which consists of a cpio
archive.

What would be the way to go to either rename the binaries to a Linux
compatible scheme or to change the library search to find its binaries
in a cpio archive (both options should be changeable at build time to
still use the current linux)?

Regards,
Johannes

[0]: https://github.com/genodelabs/genode/issues/2521
[1]:
https://github.com/jklmnn/genode/commit/ef4becffcfc4bfc4079ff411872023b0362f346c

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
genode-main mailing list
genode-main@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/genode-main


Re: Restoring child with checkpointed state

2017-10-24 Thread David Werner

Hi Stefan,

i modified the request semaphore call and changed the constructor of the 
Signal_source_client as follows:



[/repos/base-foc/src/lib/base/signal_source_client.cc] :

Signal_source_client::Signal_source_client(Capability cap)
:
Rpc_client(static_cap_cast(cap))
{
/* request mapping of semaphore capability selector */
_sem = call(Thread::myself()->cap());
}



[/repos/base-foc/src/include/signal_source/rpc_object.h] :

Native_capability _request_semaphore(Thread_capability tcap) {

Fiasco::l4_irq_detach(_blocking_semaphore.data()->kcap());

Fiasco::l4_msgtag_t tag = 
Fiasco::l4_irq_attach(_blocking_semaphore.data()->kcap(), 0,

tcap.data()->cap());
if (l4_error(tag))
Genode::raw("l4_irq_attach failed with ", l4_error(tag));

return _blocking_semaphore;

}


Unfortunately i run into problems if a component uses a timer. As soon 
as timer.sleep is called the component waits forever.


After taking a look at some code (especially Platform_thread) I think 
the problem might be that i now use the kcap of the thread capability 
for the l4_irq_attach call instead of the kcap of the corresponding gate 
capability.


Is that right or might there be another reason for my timer problem?


Kind Regards,

David


Am 24.07.2017 um 14:18 schrieb Stefan Kalkowski:

On 07/05/2017 02:00 PM, David Werner wrote:

Hi,

it seems to work if i use .data()->kcap(). Is that correct?

Yes.

Regards
Stefan


Kind Regards,
David

Am 05.07.2017 um 13:46 schrieb David Werner:

Hi Stefan,

Am 29.06.2017 um 18:18 schrieb Stefan Kalkowski:

What I meant with:

"... the signal handler thread transfers its identity to core via
request_semaphore..."

was that you add an additional argument to the request_semaphore call,
which is the CPU session's thread capability of the calling thread, like
this:

Thread::myself()->cap()

Core can therewith retrieve the "real" thread capability, in terms of
the kernel's thread capability, and attach that to the IRQ object.
I hope I could get my ideas across to you.

Best regards
Stefan


Thank you! I modified the request semaphore call according to your
suggestion.

My only problem is that i don't get how to use the transfered thread
capability to retrieve the kernel's thread capability.
More precisely, i'm not able to figure out how to determine the
correct kcap which i have to use in the l4_irq_attach call (which is
now on core's side).

Could you give me some more advise on that?

Kind Regards,
David



--

Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
genode-main mailing list
genode-main@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/genode-main



--

Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
genode-main mailing list
genode-main@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/genode-main



--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
genode-main mailing list
genode-main@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/genode-main