[GSoC 2024] Fixing IPC in WebKit | Haiku Project

Probably would be sufficient to make this a 64bit Integer and use randomization to allocate them.

It will be huge ABI break that will require to recompile everything.

Randomizing on itā€™s own would not be a abi break I think. Would maybe be sufficient.

Yes, randomization will reduce a risk of intentional attack, but not completely solve issue.

1 Like

So, the approach of creating a BLooper when creating the BMessenger turns out to be messier than I would like. So Iā€™m going to go with the approach of expanding Haikuā€™s API slightly. I built a simple test, and it looks like this approach will work!

image

9 Likes

These changes are relatively minor and will not create any ABI compatibility problem. Therefore, the simplest solution is to change the classes where they are in Haiku, there is no reason so far to copy them. If we end up having ABI problems, sure, we can change our mind, but I donā€™t see why that would be the case here.

2 Likes

And it works!

image

In the first line WebProcess sends a message and in the third line NetworkProcess receives it! :tada:

I used a pair of two ports, each going the opposite direction, to communicate. It works well, I think I didnā€™t have to modify any of WebKitā€™s code, and the code is clean. Now itā€™s time to upload that Haiku API change.

22 Likes

Exciting! : D

2 Likes

Ganbare_!.png_

1 Like

So, after a lot more thought about connections, I realized that it could actually be quite simple to use UNIX sockets. Previously, I thought that in order to use UNIX sockets, I would have to figure out how to make them work with BLoopers, but it now looks like that isnā€™t necessary.

Anyway, after some discussion, Iā€™ve decided to try using them. If it works, then weā€™ll have little to no Haiku-specific code for connections, yielding a maintenance cost of very near zero!

12 Likes

IIRC we already have private accessor classes for these functions, i.e. have a look at BMessengerPrivate etc.

Yes, thatā€™s what I used in the demo :slight_smile:

Of course, itā€™s not ideal to use a private API outside of Haiku. Ideally, we would make that public.

WebKit is on the borderline of Haiku. It is a separate codebase due to its size, but the goal is to have it as integrated in the OS as the other ā€œkitsā€ eventually. So, it would be acceptable in this case.

New APIs also tend to stay private (but exposed) for some time anyways (for example in libshared, although this has additional safeguards). This allows to experiment with them before committing to a stable API. At the moment the application ecosystem is small enough that rebuilding all the ones using private APIs is still acceptable. Someday that wonā€™t be the case anymore.

Anyways, letā€™s see if using UNIX sockets can work, this would be the solution with less maintenance and, as far as I can see, no downsides.

9 Likes

And UNIX sockets do indeed work :slight_smile:

Time to clean up the code!

28 Likes

Great news !

:cowboy_hat_face:

The pull request has been merged!

Now I want to figure out what it takes to get things to display.

15 Likes

Now WebKit is trying to display things. Itā€™s just encountering errors as it tries to do so. So here I go trying to fix them.

Iā€™m also watching for a good place to write a blog post, since this is no longer about fixing IPC :wink:.

16 Likes

ā€¦ and we await for that new blog post !

3 Likes