Re: [dev] surf/webkit2gtk-2.38.0 file descriptors

From: Petr Vaněk <arkamar_AT_atlas.cz>
Date: Fri, 21 Oct 2022 16:19:11 +0200

Hi,

On Sun, Oct 16, 2022 at 05:48:44PM +0200, Quentin Rameau wrote:
> I've hacked some solution to the problem of passing the socket pair
> to the web-extension.
>
> It is pushed to git but not released yet,
> please test it and report if it works or if you get any issue with it.

I have tested it with both webkit-2.{36.8,38.0} but it segfaults with
following message

** (WebKitWebProcess:30255): CRITICAL **: 15:56:37.467: const char* webkit_user_message_get_name(WebKitUserMessage*): assertion 'WEBKIT_IS_USER_MESSAGE(message)' failed

which is printed from webext-surf.so, however it is most probably
because of dying surf. The webkit_web_page_send_message_to_view_finish
function in pageusermessagereply returns NULL with an error message:
"Operation was cancelled", the following function
webkit_user_message_get_name fails because it does not expect NULL.

The segfault happens here:

   r = webkit_user_message_new_with_fd_list("surf-pipe", NULL, gfd);

because invalid gfd, which contains weird values like: 0xffffffffc376b480.

This is related to error messages from gcc-11.3.0:

surf.c: In function 'viewusrmsgrcv':
surf.c:1594:15: warning: implicit declaration of function 'g_unix_fd_list_new_from_array' [-Wimplicit-function-declaration]
 1594 | gfd = g_unix_fd_list_new_from_array(&spair[1], 1);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
surf.c:1594:13: warning: assignment to 'GUnixFDList *' {aka 'struct _GUnixFDList *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
 1594 | gfd = g_unix_fd_list_new_from_array(&spair[1], 1);
      | ^

because of missing gio/gunixfdlist.h includes. I will send fix commit
soon to hackers mailing list.

Petr
Received on Fri Oct 21 2022 - 16:19:11 CEST

This archive was generated by hypermail 2.3.0 : Fri Oct 21 2022 - 17:00:09 CEST