platform/upstream/wayland.git
26 hours agoserver: Unlock objects_mutex before locking connection_mutex to avoid deadlock 80/310580/1 accepted/tizen_unified tizen accepted/tizen/unified/20240503.070737
Seunghun Lee [Thu, 2 May 2024 06:16:36 +0000 (15:16 +0900)]
server: Unlock objects_mutex before locking connection_mutex to avoid deadlock

In wl_client_connection_data, threads may try to acquire two locks in
different orders, potentially causing deadlock.

Change-Id: I4acde7c0a93b4774632d3283a6fa1c946d498de8

8 days agoMitigate UAF crashes due to iteration over freed wl_resources 13/310313/1 accepted/tizen_unified_x accepted/tizen/unified/20240426.035457 accepted/tizen/unified/x/20240430.094803
Thomas Lukaszewicz [Mon, 8 Jan 2024 00:36:10 +0000 (00:36 +0000)]
Mitigate UAF crashes due to iteration over freed wl_resources

Currently it is possible to iterate over client-owned resources
during client destruction that have had their associated memory
released.

This can occur when client code calls wl_client_destroy(). The
following sequence illustrates how this may occur.

 1. The server initiates destruction of the connected client via
    call to wl_client_destroy().

 2. Resource destroy listeners / destructors are invoked and
    resource memory is freed one resource at a time [1].

 3. If a listener / destructor for a resource results in a call
    to wl_client_for_each_resource(), the iteration will proceed
    over resources that have been previously freed in step 2,
    resulting in UAFs / crashes.

The issue is that resources remain in the client's object map
even after they have had their memory freed, and are removed
from the map only after each individual resource has had its
memory released.

This patch corrects this by ensuring resource destruction first
invokes listeners / destructors and then removing them from the
client's object map before releasing the associated memory.

[1] https://gitlab.freedesktop.org/wayland/wayland/-/blob/main/src/wayland-server.c?ref_type=heads#L928

Change-Id: Idb48ea9d4ea5edf8572185436f15138bab4f27f3
Signed-off-by: Thomas Lukaszewicz thomaslukaszewicz@gmail.com
8 weeks agowayland-client: Fix LOCK_EVASION issue 57/307257/3 accepted/tizen/unified/20240308.174110 accepted/tizen/unified/x/20240311.100015
Junkyeong Kim [Wed, 6 Mar 2024 10:03:33 +0000 (19:03 +0900)]
wayland-client: Fix LOCK_EVASION issue

error scenario

1. thread 1 check if (display->last_error).
2. thread 2 check if (display->last_error).
3. thread 2 acquire mutex.
4. thread 1 acquire mutex.
5. thread 2 modify display->last_error.
this makes LOCK_EVASION error.

to avoid LOCK_EVASION need mutex lock before checking display->last_error.

Change-Id: I61f565ce3dc54484f715d20304a2e9d43db9d001
Signed-off-by: Junkyeong Kim <jk0430.kim@samsung.com>
8 weeks agowayland-server: Add missing mutex lock 54/307254/3
Junkyeong Kim [Wed, 6 Mar 2024 08:49:47 +0000 (17:49 +0900)]
wayland-server: Add missing mutex lock

Change-Id: I80ac85517fd7eedb36f7205fdd6db811b97f839c

2 months agoMerge branch 'upstream' into tizen 35/306235/2 accepted/tizen_unified_toolchain 1.22.0 accepted/tizen/unified/20240304.123054 accepted/tizen/unified/toolchain/20240311.070110 accepted/tizen/unified/x/20240305.021702
Joonbum Ko [Mon, 19 Feb 2024 05:15:43 +0000 (14:15 +0900)]
Merge branch 'upstream' into tizen

 Upgrade wayland version to 1.22.0

Change-Id: Ieeb88b919eb1110eb2b01636c559254ea4cee785

4 months agowayland-server: Add lock/unlock when adding resource id to wl_map 23/302323/2 accepted/tizen_unified_riscv tizen_7.0_mc accepted/tizen/8.0/unified/20231221.165511 accepted/tizen/unified/20231212.161252 accepted/tizen/unified/riscv/20231226.211148
duna.oh [Tue, 5 Dec 2023 08:33:02 +0000 (17:33 +0900)]
wayland-server: Add lock/unlock when adding resource id to wl_map

Change-Id: I17c3cff723bfc1ee2c241a2bce1180553490271b

7 months agoclient: Add proxy interface name and id in abort message 69/298969/2
Changyeon Lee [Mon, 18 Sep 2023 01:00:48 +0000 (10:00 +0900)]
client: Add proxy interface name and id in abort message

Change-Id: Ifd41cf728668a3762e270e410c251882e3e8136c

8 months agoclient: Add proxy->queue_link init in wl_display_connect_to_fd() 40/298040/2 accepted/tizen/8.0/unified/20231005.095644 accepted/tizen/unified/20230907.175303 tizen_8.0_m2_release
Junkyeong Kim [Wed, 30 Aug 2023 11:08:22 +0000 (20:08 +0900)]
client: Add proxy->queue_link init in wl_display_connect_to_fd()

Add omitted proxy->queue_link list init.

Change-Id: Ifc6ce8a7d65ec67eb2edd0c9cf38f5a85f744659
Signed-off-by: Junkyeong Kim <jk0430.kim@samsung.com>
8 months agoclient: Do not warn about attached proxies on default queue destruction. 84/296684/2 sandbox/jbko/server_devel accepted/tizen/unified/20230825.044257
Alexandros Frantzis [Tue, 28 Feb 2023 21:42:59 +0000 (23:42 +0200)]
client: Do not warn about attached proxies on default queue destruction.

If the default queue is being destroyed, the client is disconnecting
from the wl_display, so there is no possibility of subsequent events
being queued to the destroyed default queue, which is what this warning
is about.

Note that interacting with (e.g., destroying) a wl_proxy after its
wl_display is destroyed is a certain memory error, and this warning will
indirectly warn about this issue. However, this memory error should be
detected and warned about through a more deliberate mechanism.

Change-Id: Ia9235da77b1173f74c97f14f96e5ce294417fad8
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
8 months agoclient: Abort when trying to add an event to a destroyed queue 83/296683/2
Alexandros Frantzis [Tue, 15 Nov 2022 09:44:55 +0000 (11:44 +0200)]
client: Abort when trying to add an event to a destroyed queue

Detect when we are trying to add an event to a destroyed queue,
and abort instead of causing a use-after-free memory error.

This situation can occur when an wl_event_queue is destroyed before
its attached wl_proxy objects.

Change-Id: I53b1eb04f6b51cd5d603f202b3ae4d8924e9c4fe
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
8 months agotests: Support tests that check for client failure 82/296682/2
Alexandros Frantzis [Tue, 15 Nov 2022 09:21:37 +0000 (11:21 +0200)]
tests: Support tests that check for client failure

Add the display_destroy_expect_signal() function to check that test
clients exit due to a particular signal. This is useful for checking
that clients fail in an expected way.

Change-Id: Ib7eb2e313f39b04672a45b3a9d39cde0960ef833
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
8 months agoclient: Warn when a queue is destroyed with attached proxies 81/296681/2
Alexandros Frantzis [Tue, 15 Nov 2022 08:50:53 +0000 (10:50 +0200)]
client: Warn when a queue is destroyed with attached proxies

Log a warning if the queue is destroyed while proxies are still
attached, to help developers debug and fix potential memory errors.

Change-Id: I0bd8b036bb46f2346336b80cb450c4bda2f2bd53
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
8 months agotests: Capture the test client log 80/296680/2
Alexandros Frantzis [Thu, 1 Dec 2022 18:02:43 +0000 (20:02 +0200)]
tests: Capture the test client log

Capture the test client log to a temporary fd, so that is accessible by both
the test server process and the test client process.

Change-Id: I7db33e374556239e0c1bc6ebe91ed0460ce2751f
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
8 months agoclient: Track the proxies attached to a queue 79/296679/3
Alexandros Frantzis [Tue, 15 Nov 2022 08:42:55 +0000 (10:42 +0200)]
client: Track the proxies attached to a queue

Maintain a list of all wl_proxy objects that are attached to a
wl_event_queue. We will use this information in upcoming commits to warn
about improper object destruction order that can lead to memory errors.

Change-Id: I3b9c5548d46a2b1704134880c00838b71a741cf3
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
8 months agoxcursor: Add missing header file 46/296746/1 accepted/tizen/unified/20230807.014657
Junkyeong Kim [Fri, 4 Aug 2023 02:57:22 +0000 (11:57 +0900)]
xcursor: Add missing header file

Change-Id: I068c774514bcd7079752fa4db8eb957898e3da4a
Signed-off-by: Junkyeong Kim <jk0430.kim@samsung.com>
9 months agoxcursor: Add protection code to do not override sign-bit 93/296693/3
Junkyeong Kim [Thu, 3 Aug 2023 06:42:07 +0000 (15:42 +0900)]
xcursor: Add protection code to do not override sign-bit

Change-Id: I02d2f5382aa84adb534322c9cb9f5c1cdcd97eb7

9 months agoserver: add comments TIZEN_ONLY for client's connection & object mutex 64/296364/2 accepted/tizen/unified/20230728.155803
Joonbum Ko [Wed, 26 Jul 2023 06:50:52 +0000 (15:50 +0900)]
server: add comments TIZEN_ONLY for client's connection & object mutex

Change-Id: I5495ac781f46d0ec9fff844173ae61b37ba74555
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
9 months agoserver: protect the client_list for thread safety 16/296316/3
Joonbum Ko [Tue, 25 Jul 2023 10:38:06 +0000 (19:38 +0900)]
server: protect the client_list for thread safety

 - If the client_list is not protected with mutex in the multi-thread situation,
 there may be a problem of accessing an invalid client address.

Change-Id: I2b55b74f1d5dd3f74e6d370e9f5fabf1248edb59
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
9 months agoserver: Fix possible thread deadlock 04/295904/1
Seunghun Lee [Mon, 17 Jul 2023 05:11:38 +0000 (14:11 +0900)]
server: Fix possible thread deadlock

The connection_mutex and objects_mutex must be locked in order to avoid
deadlock. This patch makes the range of lock and unlock for
objects_mutex be reduced to avoid lock the connection_mutex while the
objects_mutex is locked.

Change-Id: I329f1e00c69f6380099db57fbe6c866064d8a3a7

9 months agoserver: Fix dereference after null check 03/295903/1
Seunghun Lee [Mon, 17 Jul 2023 04:33:23 +0000 (13:33 +0900)]
server: Fix dereference after null check

The closure could be referenced after null check.

Change-Id: Icf49ed92f0000de2e28777e449eb5093a8b1a293

9 months agoserver: Fix uninitialized lock use 02/295902/1
Seunghun Lee [Mon, 17 Jul 2023 04:01:50 +0000 (13:01 +0900)]
server: Fix uninitialized lock use

Change-Id: I1490a00c02a6e83e8d2d58c8fd2871afa3622539

9 months agowayland-server: Fix issue detected by static analysis tool 17/295517/1 accepted/tizen/unified/20230713.143456
Inhong Han [Mon, 10 Jul 2023 06:46:50 +0000 (15:46 +0900)]
wayland-server: Fix issue detected by static analysis tool

double_initialization: pthread_mutex_init initializes client->objects_mutex while it is already initialized.

Change-Id: I5241c681ad4615605419a142bd5800b6d38b1072

9 months agowayland-server: fix missing mutex unlock issue 60/295460/1
Jihoon Kim [Fri, 7 Jul 2023 10:54:18 +0000 (19:54 +0900)]
wayland-server: fix missing mutex unlock issue

Change-Id: I3a8e1d50a86d8f8b7719165668393553f2ecd834
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
10 months agoserver: Remove superfluous goto label 39/295139/3 accepted/tizen/unified/20230706.152204
Seunghun Lee [Mon, 3 Jul 2023 08:01:27 +0000 (17:01 +0900)]
server: Remove superfluous goto label

The goto label was introduced by 1c4afff, and is no longer necessary
after 812e138.

Change-Id: If3735215a8f16c4530cc1270562d6999dd0ce5f7

10 months agowayland-server: Fix hangup issue 38/295138/3
Jihoon Kim [Fri, 19 May 2023 08:29:15 +0000 (17:29 +0900)]
wayland-server: Fix hangup issue

Change-Id: Ib175e0e239b63e6f6ec5a23d3960fe92deef0c14
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
10 months agowayland-server: Add mutex for wl_client's resources 35/295135/3
Seunghun Lee [Thu, 18 May 2023 05:21:28 +0000 (14:21 +0900)]
wayland-server: Add mutex for wl_client's resources

This patch is to prevent threads from accessing wl_client's resources at
the same time.

Change-Id: I5da933efd426b8535ba1cb6144ad0f47fe2e4415

12 months agoserver: Remove ucred of wl_client 60/291760/5 accepted/tizen/unified/20230531.151929
Changyeon Lee [Fri, 21 Apr 2023 02:38:55 +0000 (11:38 +0900)]
server: Remove ucred of wl_client

ucred of wl_client is removed after below patch
and it is not initialized.

54b237a61257a41d35d018c5871331bdf1df77a6

Change-Id: I8b45fdab6bdc8e7d340ad301e1fed6ba53f5ac45

12 months agoclient: Do not poll when flushing display fails if it's for roundtrip 22/290922/6
Seunghun Lee [Wed, 5 Apr 2023 04:40:57 +0000 (13:40 +0900)]
client: Do not poll when flushing display fails if it's for roundtrip

It was observed that a process was stuck at somewhere in the
wl_display_roundtrip_queue().

I've looked into log messages recorded on the issue situation, and found
out that the compositor didn't get any messages from the process. So I
highly suspect that wl_display_flush() failed for some reason with EPIPE
errno and the process blocked on polling until there is data to read.

Let's find out if it's true with display_roundtrip_queue_ensure_flush().
This is the same as wl_display_roundtrip_queue() except it will return
-1 on failure flushing display with EPIPE.

Change-Id: Id97039e0722cdc591cde8e2b78927940b8db8634

12 months agobuild: bump to version 1.22.0 for the official release upstream upstream/1.22.0
Simon Ser [Tue, 4 Apr 2023 07:58:31 +0000 (09:58 +0200)]
build: bump to version 1.22.0 for the official release

13 months agobuild: bump to version 1.21.93 for the RC1 release
Simon Ser [Tue, 28 Mar 2023 18:02:48 +0000 (20:02 +0200)]
build: bump to version 1.21.93 for the RC1 release

13 months agoAdd a .mailmap file
Faith Ekstrand [Sat, 25 Mar 2023 16:04:32 +0000 (11:04 -0500)]
Add a .mailmap file

This will let command-line Git tools re-map my name and e-mail address properly.
I'm using my personal e-mail address and not my Collabora address because I'm
not actively contributing to Wayland anymore and this is mostly for letting
people find me should they dig me up in the project history.

Signed-off-by: Faith Ekstrand <faith@gfxstrand.net>
13 months agobuild: bump version to 1.21.92 for the beta release
Simon Ser [Thu, 16 Mar 2023 00:08:44 +0000 (01:08 +0100)]
build: bump version to 1.21.92 for the beta release

13 months agoclient: fix wl_display_disconnect() documentation
Simon Ser [Wed, 1 Mar 2023 14:14:37 +0000 (15:14 +0100)]
client: fix wl_display_disconnect() documentation

Signed-off-by: Simon Ser <contact@emersion.fr>
Closes: https://gitlab.freedesktop.org/wayland/wayland/-/issues/361

14 months agoclient: Do not warn about attached proxies on default queue destruction.
Alexandros Frantzis [Tue, 28 Feb 2023 21:42:59 +0000 (23:42 +0200)]
client: Do not warn about attached proxies on default queue destruction.

If the default queue is being destroyed, the client is disconnecting
from the wl_display, so there is no possibility of subsequent events
being queued to the destroyed default queue, which is what this warning
is about.

Note that interacting with (e.g., destroying) a wl_proxy after its
wl_display is destroyed is a certain memory error, and this warning will
indirectly warn about this issue. However, this memory error should be
detected and warned about through a more deliberate mechanism.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
14 months agobuild: bump version to 1.21.91 for the alpha release
Simon Ser [Tue, 28 Feb 2023 16:15:31 +0000 (17:15 +0100)]
build: bump version to 1.21.91 for the alpha release

14 months agoclient: Abort when trying to add an event to a destroyed queue
Alexandros Frantzis [Tue, 15 Nov 2022 09:44:55 +0000 (11:44 +0200)]
client: Abort when trying to add an event to a destroyed queue

Detect when we are trying to add an event to a destroyed queue,
and abort instead of causing a use-after-free memory error.

This situation can occur when an wl_event_queue is destroyed before
its attached wl_proxy objects.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
14 months agotests: Support tests that check for client failure
Alexandros Frantzis [Tue, 15 Nov 2022 09:21:37 +0000 (11:21 +0200)]
tests: Support tests that check for client failure

Add the display_destroy_expect_signal() function to check that test
clients exit due to a particular signal. This is useful for checking
that clients fail in an expected way.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
14 months agoclient: Warn when a queue is destroyed with attached proxies
Alexandros Frantzis [Tue, 15 Nov 2022 08:50:53 +0000 (10:50 +0200)]
client: Warn when a queue is destroyed with attached proxies

Log a warning if the queue is destroyed while proxies are still
attached, to help developers debug and fix potential memory errors.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
14 months agotests: Capture the test client log
Alexandros Frantzis [Thu, 1 Dec 2022 18:02:43 +0000 (20:02 +0200)]
tests: Capture the test client log

Capture the test client log to a temporary fd, so that is accessible by both
the test server process and the test client process.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
14 months agoclient: Track the proxies attached to a queue
Alexandros Frantzis [Tue, 15 Nov 2022 08:42:55 +0000 (10:42 +0200)]
client: Track the proxies attached to a queue

Maintain a list of all wl_proxy objects that are attached to a
wl_event_queue. We will use this information in upcoming commits to warn
about improper object destruction order that can lead to memory errors.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
14 months agoshm: fix segfault when accessing destroyed pool resource
Simon Ser [Fri, 16 Sep 2022 07:53:39 +0000 (09:53 +0200)]
shm: fix segfault when accessing destroyed pool resource

With wl_shm_buffer_ref_pool(), it's possible for a wl_shm_pool
to outlive its wl_resource. We need to be careful not to access
wl_shm_pool.resource if it's been destroyed.

Reset resource to NULL in the resource destroy handler, and add
NULL checks.

Signed-off-by: Simon Ser <contact@emersion.fr>
14 months agoprotocol: Clarify meaning of input region for cursors, DnD icons
Mikhail Gusarov [Thu, 20 Oct 2022 21:53:13 +0000 (23:53 +0200)]
protocol: Clarify meaning of input region for cursors, DnD icons

Input region is ignored for cursors, DnD icons. Current wording
implies that this state is temporary, but surfaces never lose the
role once assigned, so reword to make it clearer.

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
14 months agoprotocol: reorder wl_data_offer.source_actions and wl_data_device.enter
Vlad Zahorodnii [Wed, 21 Sep 2022 14:42:58 +0000 (17:42 +0300)]
protocol: reorder wl_data_offer.source_actions and wl_data_device.enter

Most compositors send the wl_data_offer.source_actions event before the
wl_data_device.enter event, i.e. after creation of the data offer. This
contradicts to the wayland spec.

On the other hand, it's reasonable to send all the information useful to
the client before the enter event, rather than send mime types before the
enter event and source actions (that don't depend on drop target) after
the enter event.

On the client side, toolkits such as Qt and GTK already expect to see the
source actions before receiving the enter event.

Given all of that, this change adjusts the spec to match the behavior
observed in the compositors in the wild.

Signed-off-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
14 months agoprotocol: do not change pending x and y when attaching a buffer
Sebastian Wick [Tue, 14 Feb 2023 12:33:22 +0000 (13:33 +0100)]
protocol: do not change pending x and y when attaching a buffer

Attaching a buffer with interface version 5 requires clients to pass
zero to x and y but it still affects the pending surface state.
Attaching a buffer after a request to offset therefore sets the pending
x and y to zero. The intent of version 5 was to allow exactly this
sequence of requests to work so let's just make sure the protocol
actually spells it out.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
14 months agoclient: Remove superfluous display lock 00/288700/9 accepted/tizen/unified/20230309.035148
Seunghun Lee [Tue, 14 Feb 2023 00:23:16 +0000 (09:23 +0900)]
client: Remove superfluous display lock

The wl_display_{connect_to_fd/disconnect}() cannot be raced.

Even if a race condition happened, it'd have to be handled as an
application's fault. There is no way to completely prevent such race
condition in wayland-client.

Change-Id: Ia8c767f56081e27cee7d6694f46bccdd89ffdb5e

14 months agoclient: Remove struct wl_thread_data 99/288699/9
Seunghun Lee [Mon, 13 Feb 2023 23:27:51 +0000 (08:27 +0900)]
client: Remove struct wl_thread_data

The wl_thread_data was introduced to prevent deadlock as explained by
the following commit message.

Since the problem described by the commit message seems to have
disappeared, let's remove it and observe the results.
If we decided to keep this code, we will need to add a reference count
mechanism or something to prevent use after free and memory leaks. I
believe this code will only add complexity and increase the likelihood
of errors.

Wayland specification says clearly that if a thread successfully calls
wl_display_prepare_read_queue(), it must either call
wl_display_read_events() when it's ready or cancel the read intention by
calling wl_display_cancel_read().

So even if a deadlock occur again around this APIs, I believe we should
still handle it as the application's responsibility.

commit 409d548f6d3b43b8a4991619c3effeeed809f789
Author: Boram Park <boram1288.park@samsung.com>
Date:   Fri Apr 8 08:14:42 2016 +0900

    client: use the thread reader_count to fix deadlock.

        Let's see the below scenario.

          1. A thread polls several fds including the wayland's fd.
          2. This thread probably calls wl_display_prepare_read()
             before polling fds.
          3. This thread could be awake by other event source which
             isn't related with wayland fd.
          4. After wake up, this thread could call wl_display_dispatch
             or wl_display_roundtrip for sync operation.

        Then, when this thread got a done event. this thread will fall
        in deadlock because this thread increases +2 reader_count in the
        sam thread. The read_event or cancel_read for the first
        prepare_read is not going to happen because this thread sleeps
        in pthread_cond_wait() line of read_event.

        This problem can be solved by using the reader_count per thread.

        The reader_count of thread will be increased/decreased whenever
        prepare_read, cancel_read and read_event are called.

        However, the original reader_count of display will be increased
        only once per thread. And, when cancel_read and read_event are
        called, it will be decreased to read event from fd and wake up
        other threads. And that, if the thread reader_count is still
        more than 0, it will be increased because it means the thread
        is still polling in somewhere.

    Change-Id: I2e881a6222e5ad380ace7a6d9571d5463cf701d9

Change-Id: Id77a4468fafaafe0fa79fbe186767adb8b09cde1

14 months agoprotocol: add wl_pointer's axis relative physical direction
Peter Hutterer [Sat, 29 Jul 2017 11:34:49 +0000 (12:34 +0100)]
protocol: add wl_pointer's axis relative physical direction

This event adds the physical direction of the axis motion, relative to the
axis event we get. Right now, when natural scrolling is enabled things like
virtual volume sliders move the wrong way round.

By adding the axis motion direction, we can have toolkits swap the scroll
direction for applicable widgets, getting the right behavior on all widgets.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
14 months agoPackaging: upgrade to 1.21.0 tizen_work_20230216 accepted/tizen/unified/20230221.085044
Junkyeong Kim [Thu, 16 Feb 2023 11:46:27 +0000 (20:46 +0900)]
Packaging: upgrade to 1.21.0

Signed-off-by: Junkyeong Kim <jk0430.kim@samsung.com>
14 months agocursor: Fix build error by unmatching function name
Junkyeong Kim [Thu, 16 Feb 2023 11:44:20 +0000 (20:44 +0900)]
cursor: Fix build error by unmatching function name

14 months agoLog creating and destroying of queue for debugging
Seunghun Lee [Thu, 10 Nov 2022 09:58:52 +0000 (18:58 +0900)]
Log creating and destroying of queue for debugging

Crashes has been observed several times in libwayland-client.so with the
following backtrace.

 #0 0x44ff4b56 in wl_list_insert (list=0xb1c03678, elm=elm@entry=0x207c1f8) at /usr/src/debug/wayland-1.20.0/builddir/../src/wayland-util.c:60
 #1 0x44ff6de0 in queue_event (len=8, display=<optimized out>) at /usr/src/debug/wayland-1.20.0/builddir/../src/wayland-client.c:1940
 #2 read_events (display=0x20733b0) at /usr/src/debug/wayland-1.20.0/builddir/../src/wayland-client.c:2184
 #3 wl_display_read_events (display=0x20733b0) at /usr/src/debug/wayland-1.20.0/builddir/../src/wayland-client.c:2380
 ...

I've tried to investigate it and I suppose there is high possibility
that somewhere using libwayland-client could destroy a wl_event_queue
first before all wayland proxies that the queue is associated with.

So, this patch adds log message in where creating and destroying a queue
in the hope that it would help us find the cause of problem next time.

Change-Id: If6a35ec738c2cf88b9ef7dea46bcd1b2fb4821ba

14 months agowayland-client: add missed mutex_destroy for threads_mutex
Joonbum Ko [Thu, 22 Sep 2022 09:43:24 +0000 (18:43 +0900)]
wayland-client: add missed mutex_destroy for threads_mutex

Change-Id: I088b3fbd64a3a077f832f5e4bc70e17f2915d9fa
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
14 months agoprint thread_count under display->threads_mutex
SooChan Lim [Wed, 29 Dec 2021 05:48:00 +0000 (14:48 +0900)]
print thread_count under display->threads_mutex

Change-Id: I179e0690ada8da7e216c49cf7e10daebcd0c1eef
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
14 months agowayland-client: add mutex protection to destroy_thread_data
Joonbum Ko [Wed, 29 Dec 2021 02:06:04 +0000 (11:06 +0900)]
wayland-client: add mutex protection to destroy_thread_data

 In multi threads situation,
 at the same time that the newly created thread performs
 wl_list_for_each_safe() in get_thread_data(),
 the destroyed thread may cause a conflict problem
 in an attempt to erase its link with wl_list_remove.

 Added threads_mutex to struct wl_display to protect
  accessing display->threads.

Change-Id: I673c3f9a63794d514e871839049257425bd06bc2
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
14 months agoRevert two commits as an attempt to avoid crash
Seunghun Lee [Thu, 22 Sep 2022 06:58:47 +0000 (15:58 +0900)]
Revert two commits as an attempt to avoid crash

This reverts following two commits.

    "wayland-client: Delete pthread_key before iterating thread_data"
    commit c4a2e5dbe2d6d371de814c24b578e9d3196ec971.

    "wayland-client: Destroy all thread data on disconnect"
    commit d5f09227a4d62c48ade0905be13b4645fde02cd0.

And this is the backtrace.

    (gdb)bt full
    0  0xb56937f8 in wl_list_remove (elm=elm@entry=0xa40520) at
    /usr/src/debug/wayland-1.20.0/builddir/../src/wayland-util.c:67
    No locals.
    1  0xb5693a86 in destroy_thread_data (data=0xa40520) at
    /usr/src/debug/wayland-1.20.0/builddir/../src/wayland-client.c:1195
            display = 0x913d80
            thread_data = 0xa40520
            __PRETTY_FUNCTION__ = "destroy_thread_data"
    2  0xb5e1634c in __nptl_deallocate_tsd () at
    /usr/src/debug/glibc-2.30/nptl/pthread_create.c:301
            data = <optimized out>
            inner = <optimized out>
            level2 = 0x9b9731ac
            idx = <optimized out>
            round = 0
            cnt = <optimized out>
            self = 0x9b973120
    3  0xb5e164d4 in start_thread (arg=0x9b973120) at
    /usr/src/debug/glibc-2.30/nptl/pthread_create.c:490
            pd = 0x9b973120
            unwind_buf = {cancel_jmp_buf = {{jmp_buf = {1530611246,
    1967982998, -1684590304, -1552949728, -1552943648, 338, -1552949818, 0,
    -1684590304, -1684591524, 0 <repeats 54 times>}, mask_was_saved = 0}},
    priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0,
    canceltype = 0}}}
            not_first_call = <optimized out>
    4  0xb5f3c988 in __inet_pton_length () at
    /usr/src/debug/glibc-2.30/misc/../sysdeps/unix/sysv/linux/arm/clone.S:73
    No locals.
    5  0x00000000 in ?? ()

Not sure this crash happened because of the patches to be reverted but
let just the leak happen and let's see if crash happen again.

Change-Id: I478fe965ae5b633039b31e103203c733948abda1

14 months agowayland-client: Delete pthread_key before iterating thread_data
Seunghun Lee [Wed, 8 Jun 2022 10:06:39 +0000 (19:06 +0900)]
wayland-client: Delete pthread_key before iterating thread_data

As iterating the list of thread_data on disconnect, if a thread_data
referred by 'th_data_next' got freed by a thread exiting, then illegal
access would have happened.

To prevent destroy_thread_data() from calling by a thread exiting while
iterating the list of thread_data, this patch deletes pthread_key before
iterating the list.

Change-Id: I1b1616ec02bd3a7a45157b51e1913f9fea79388f

14 months agowayland-client: Destroy all thread data on disconnect
Seunghun Lee [Wed, 27 Apr 2022 07:01:47 +0000 (16:01 +0900)]
wayland-client: Destroy all thread data on disconnect

This fixes memory leak.

The leak could be observed if you call wl_display_disconnect() from
a different thread than the thread that creates wl_display object
calling wl_display_connect().

That's because the thread-specific object which is created at
wl_display_connect would remain permanently not being destroyed.
Since thread-specific data key is also deleted at wl_display_disconnect,
we can't rely on an associated destructor of thread-specific data key.

So, all associated thread data should be destroyed along with a
wl_display.

Change-Id: Icb363b8895d5618868c8332c469ee09343a12814

14 months agoPackaging: upgrade to 1.20.0
Junseok Kim [Wed, 16 Feb 2022 05:57:22 +0000 (14:57 +0900)]
Packaging: upgrade to 1.20.0

Change-Id: I55f15e741325061e4e9fec3e8e8053c5c278dcf0

14 months agowayland-shm: fix build warning
Junseok Kim [Fri, 11 Feb 2022 05:07:38 +0000 (14:07 +0900)]
wayland-shm: fix build warning

Change-Id: If0a5cde6254bfcedacaa3e20e89ee0dad55b450f

14 months agoxcursor: fix memory leak
Junseok Kim [Fri, 11 Feb 2022 05:06:08 +0000 (14:06 +0900)]
xcursor: fix memory leak

Change-Id: I6739a6c95c2f8e479d906fd47bf6ad67fb125bc2
Signed-off-by: Junseok Kim <juns.kim@samsung.com>
14 months agowayland-client: cleanup thread specific data when disconnect, leave logs
Sung-Jin Park [Mon, 20 Dec 2021 06:40:15 +0000 (15:40 +0900)]
wayland-client: cleanup thread specific data when disconnect, leave logs

Change-Id: I04e4ed9265bc9b3377c683ec891069060e85143c
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
14 months agowayland-client: init a thread_data item before insert to a list
Sung-Jin Park [Wed, 8 Dec 2021 04:22:37 +0000 (13:22 +0900)]
wayland-client: init a thread_data item before insert to a list

Change-Id: Ib03c2bbbc454a383ab5abdc9504457cee041310f
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
14 months agowayland-client: fix to check if thread_data is valid before accessing it
Sung-Jin Park [Tue, 7 Dec 2021 11:17:04 +0000 (20:17 +0900)]
wayland-client: fix to check if thread_data is valid before accessing it

Change-Id: Id620472d91f5e493a4de77538ef5e49a3966cefb
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
14 months agofix null dereference
Changyeon Lee [Fri, 19 Mar 2021 03:00:01 +0000 (12:00 +0900)]
fix null dereference

Change-Id: Id9961fd6d504fd389059b6b9739b33de3b2ed7af

14 months agowayland-client : do not abort when there is an EBADF error on marshalling request
Changyeon Lee [Wed, 10 Mar 2021 10:28:46 +0000 (19:28 +0900)]
wayland-client : do not abort when there is an EBADF error on marshalling request

wayland-tbm create wl_buffer with fd but it is sometimes failed  because
fd duplication is failed with EBADF error.
we guess another thread close fd of wayland-tbm.
wayland-tbm retry to create wl_buffer with key when it is failed with fd
but process is aborted in wayland-client.
so this patch allows wayland-tbm create wl_buffer proxy with key
when fd duplication is failed in wayland-client.

Change-Id: Id56e0ff87784678a5a192a0bc6f0aabae39da5df

14 months agoPackaging: remove TODO from %doc
Sung-Jin Park [Mon, 11 Jan 2021 22:52:52 +0000 (07:52 +0900)]
Packaging: remove TODO from %doc

Change-Id: Ie13a3c337a5e94b04706d0ee2fbb75a400823d99
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
14 months agowayland-client: handled case where pthread_setspecific failed.
Joonbum Ko [Thu, 3 Sep 2020 04:36:31 +0000 (13:36 +0900)]
wayland-client: handled case where pthread_setspecific failed.

 - The thread_data of wayland-client is managed in
  pthread specific and wl_list.
 - When pthread_setspecific fails, the returned
  error number will be printed.
 - If pthread_setspecific fails, pthread_getspecific
  in get_thread_data called next will also return null,
  but thread_data has been registered in wl_list.
 - In that case, it should be able to use thread_data in wl_list.

Change-Id: Ib4e436427715d0cc23bdcf0d8b6417212530803d
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
14 months agowayland-util: calls wl_log_handler only when dlog is not available or when there...
Sung-Jin Park [Tue, 28 Jul 2020 09:26:52 +0000 (18:26 +0900)]
wayland-util: calls wl_log_handler only when dlog is not available or when there is new wl_log_handler set

Change-Id: If3ebe372467d528f96554790de9defb657b710f8
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
14 months agowayland-client: add NULL check
Junkyeong Kim [Mon, 20 Jul 2020 08:59:17 +0000 (17:59 +0900)]
wayland-client: add NULL check

Change-Id: Iceba83f91a51ca000c3868379f6bf3b189610344
Signed-off-by: Junkyeong Kim <jk0430.kim@samsung.com>
14 months agowayland-client: add APIs for setting/getting name of a display
Sung-Jin Park [Sat, 16 May 2020 12:42:20 +0000 (21:42 +0900)]
wayland-client: add APIs for setting/getting name of a display

Change-Id: I5c136ceb65d1fbdc64a5419c1ec317fbb20ab815
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
14 months agowayland-client: enhance log when connection has been failed
Sung-Jin Park [Tue, 19 May 2020 07:55:13 +0000 (16:55 +0900)]
wayland-client: enhance log when connection has been failed

Change-Id: I8fde364f585083b4c3ea39ac19e18e6b64eae0f0
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
(cherry picked from commit 905fdf47ee45e7afa8409689ed2ab29bed3a5d46)

14 months agocompositor-introspection-test: fix build warning
Junseok, Kim [Tue, 19 May 2020 07:24:26 +0000 (16:24 +0900)]
compositor-introspection-test: fix build warning

Change-Id: I0e4cf18dcb7b2775aa915bfb207b548cc6e033c5
Signed-off-by: Junseok, Kim <juns.kim@samsung.com>
14 months agowayland: change strerror() to %m to ensure thread-safety
Junseok, Kim [Tue, 19 May 2020 07:16:33 +0000 (16:16 +0900)]
wayland: change strerror() to %m to ensure thread-safety

Change-Id: If6b64cca09022ccc268df455906ebab6ab93cdf0
Signed-off-by: Junseok, Kim <juns.kim@samsung.com>
14 months agowayland-client: added null check for intf->version for logging
Sung-Jin Park [Sat, 16 May 2020 07:01:41 +0000 (16:01 +0900)]
wayland-client: added null check for intf->version for logging

Change-Id: I6ef7e5aa7bccd2b246f275b8ad7e83ea3fc28174
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
14 months agowayland-client: added null check for logging
Gwanglim Lee [Sat, 16 May 2020 06:28:36 +0000 (15:28 +0900)]
wayland-client: added null check for logging

Change-Id: I6cefc3507863ae5d05b5fce65c49e79bd5d4ea51

14 months agowayland-client: fix not to repeat logs regarding errno and display->last_error
Sung-Jin Park [Fri, 15 May 2020 12:37:03 +0000 (21:37 +0900)]
wayland-client: fix not to repeat logs regarding errno and display->last_error

Change-Id: I3e914f0d134a01fbc77ef9d4c03970cf9885492a
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
14 months agowayland-client : do abort when there is an error on marshalling request
Sung-Jin Park [Fri, 6 Mar 2020 04:49:25 +0000 (13:49 +0900)]
wayland-client : do abort when there is an error on marshalling request

Change-Id: I012cdbdaa9e2059475cc78f91e77febe409c8ee1
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
14 months agoconnection: fix to use %m and to include fd number in log when dup failed
Sung-Jin Park [Fri, 6 Mar 2020 04:47:43 +0000 (13:47 +0900)]
connection: fix to use %m and to include fd number in log when dup failed

Change-Id: Ia48b7ee50e1eed6311cdc1e6b19259f098e9bf83
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
14 months agoPackaging: version up to 1.18.92
Sung-Jin Park [Fri, 21 Feb 2020 08:53:36 +0000 (17:53 +0900)]
Packaging: version up to 1.18.92

Change-Id: I19174c628d38d91bcb03a9f5e9f8c25adecbf733
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
14 months agowayland-shm: fix a build warning (seals variable)
Sung-Jin Park [Fri, 21 Feb 2020 06:43:35 +0000 (15:43 +0900)]
wayland-shm: fix a build warning (seals variable)

Change-Id: I8a006ee664e346c39f3ac84b8220d37c02d1fa60
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
14 months agowayland-client: reuse the existing map entry for the new_id of object from server
Sung-Jin Park [Wed, 12 Feb 2020 07:59:48 +0000 (16:59 +0900)]
wayland-client: reuse the existing map entry for the new_id of object from server

This change will make a wayland client reuse an existing map entry for the new id
of object in an event coming from server. To sum up, this is an error recovery code
that occurs when a wayland client doesn't destroy both the server-side resource and
the client-side proxy object in critical section that is guaranteed with the display
lock(mutex).

There is an error about the reservation of an entry in server_entries of the map of
a client. It will be caused when there is data of a wl_object stored already in the
map entry associated with the new object id coming from the server as an event.
Actually this issue will happen in a multi-threaded wayland client. Now let me give
you an example associate with a wl_buffer object created in the display server.

Suppose there are two threads in the client process. A thread(TA) is dispatching
events in its event queue and the other thread(TB) called wl_display_prepare_read()
to prepare for reading the display. And then thread(TA) called wl_buffer_destroy()
to destroy a wl_buffer object and then it finished to send the "WL_BUFFER_DESTROY"
request to the server via wl_proxy_marshal(). At the same time, thread(TB) polled
the display fd, returned from the polling function by the events coming from the
server and then called wl_display_read_events() to read/queue events.

In this situation, thread(TB) will be waiting for getting the display lock(mutex)
and will get it soon as there is no threads which holds the display lock.
thread(TB) will soon read events from the display fd and will queue the events
to the queue(s). At the same time, thread(TA) will call wl_proxy_destroy() to
destroy the proxy object, it'll try to hold the display lock. But it'll stop at the
part where it waits for the lock because thread(TB) holds the lock.

In the server side, it'll release the wl_buffer resource associate with the
id given from the destroy request from the client. And then the id will be reused
when it creates a new wl_buffer resource and will send the event contains the id as
a new_id of object. While thread(TB) is reading events and creating/queuing events,
the event from the server will also be handled.

In the process of demarshalling an event and calling wl_map_reserve_new() to reserve
a map entry for a new id of object on the map, the wayland client sets an error(EINVAL).
It's because the client finds that there is already data in the map entry corresponding
to the new object id coming from the server. Once the error is set, the error value will
be set to display->last_error and then the wayland client doesn't work properly.

In this change of code, the additional flag(WL_PROXY_FLAG_ID_OVERRIDEN) for wl_proxy
object will be appeared newly. When a new object id that is already associated with the
map entry where data exists come from the server, the wayland client adds the flag
(WL_PROXY_FLAG_ID_OVERRIDEN) to the proxy object stored int he map entry.
And this allows only the proxy object itself to be destroyed without destroying the data
of the linked map entry when the proxy object is destroyed in the future. Of course,
the data (in the map entry associated with the object id) has been being reused for a new
proxy object created in queue_event().

Change-Id: I62e762e94d081ef3d2ce2f54a0cc5d54c371327c
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
14 months agowayland-client: check fd is a valid value
jeon [Fri, 31 Jan 2020 07:55:39 +0000 (16:55 +0900)]
wayland-client: check fd is a valid value

  - fix a svace issue: tainted integer

Change-Id: I1aaf98f93f06383599643d1febd8315901a7f438

14 months agowayland-client: fix not to cancel reading events when destroying a thread
Sung-Jin Park [Wed, 20 Nov 2019 04:22:11 +0000 (13:22 +0900)]
wayland-client: fix not to cancel reading events when destroying a thread

Change-Id: Ib3b0dae56c3d70b9cf675da1f6fd14d966476632
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
14 months agotests: fix NULL_RETURNS issues in tests
Sung-Jin Park [Thu, 7 Nov 2019 03:33:04 +0000 (12:33 +0900)]
tests: fix NULL_RETURNS issues in tests

Change-Id: I0c2307a788ed6d58985c3ae042147cfd7a4b8b66
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
14 months agowayland-client: leave log when the reader counts are invalid during destroying a...
Sung-Jin Park [Tue, 5 Nov 2019 05:23:29 +0000 (14:23 +0900)]
wayland-client: leave log when the reader counts are invalid during destroying a thread

Change-Id: I6ca626431a976a2d67104fc750b925d8642b0b01
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
14 months agowayland-client: abort when the reader_count is invalid and cancel read when a thread...
Sung-Jin Park [Thu, 31 Oct 2019 02:52:52 +0000 (11:52 +0900)]
wayland-client: abort when the reader_count is invalid and cancel read when a thread is being destroyed if necessary

display->reader_count must be equal or smaller than the number of threads
already prepared to read events. If it is larger than the number of threads,
most threads will wait for the last reader to wake them up, which can create
a blocking situation. In this case, we will do abort().

If a thread that was preparing to read the event(s) suddenly ends, we must
check if the reader_count_in_thread is greater than zero and call cancel_read()
if necessary. Otherwise, a blocking situation may occur.

Change-Id: Id496c83c244b03f97106d350b44b8798c9a6c0a9
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
14 months agowayland-client: do wl_abort() when reader_count becomes negative
Sung-Jin Park [Wed, 24 Jul 2019 09:41:45 +0000 (18:41 +0900)]
wayland-client: do wl_abort() when reader_count becomes negative

Change-Id: I808a59f208a1af1467e94b31c815325afd0a5fcf
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
14 months agoegl: Changed to flag EGL_PACKAGE to 1 to build wayland-egl.
Joonbum Ko [Mon, 1 Jul 2019 08:00:03 +0000 (17:00 +0900)]
egl: Changed to flag EGL_PACKAGE to 1 to build wayland-egl.

 - If there are no any problems, EGL_PACKAGE flag will be deprecated.
 - This fix has dependencies on libtpl-egl-1.6.4

Change-Id: I318ed83009038c2b66e6db05247e21fec75b14f4
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
14 months agoRevert "wayland-egl: Add wl_egl_window_set_rotation / wl_egl_window_get_capabilities...
Joonbum Ko [Mon, 1 Jul 2019 07:57:28 +0000 (16:57 +0900)]
Revert "wayland-egl: Add wl_egl_window_set_rotation / wl_egl_window_get_capabilities apis for prerotation of egl_window."

This reverts commit b008ce72390677acdf388a1754e51e14c2f81551.

Change-Id: Ie0ce923eddba733a92d6b581bf826979e0e13021

14 months agoRevert "wayland-egl: Added APIs for setting buffer transform and frontbuffer rendering."
Joonbum Ko [Mon, 1 Jul 2019 07:57:23 +0000 (16:57 +0900)]
Revert "wayland-egl: Added APIs for setting buffer transform and frontbuffer rendering."

This reverts commit 321162446f28a6caf3d4a1b1b46a6f7d0cfc069c.

Change-Id: Iea341a4891331403e5f5aa9711ca03ea11f57166

14 months agowayland-client: remove tabs
Sung-Jin Park [Tue, 16 Jul 2019 11:27:21 +0000 (20:27 +0900)]
wayland-client: remove tabs

Change-Id: I17a9eb2e40954730eb2f4965b3124e13bd0ea656
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
14 months agowayland-server: remove unnecessary variable
Sung-Jin Park [Tue, 16 Jul 2019 11:13:02 +0000 (20:13 +0900)]
wayland-server: remove unnecessary variable

Change-Id: I8014208fe4c42890d2f51178ae0eb42ab893404d
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
14 months agowayland-client: force sync of display when threads are waiting for over WL_PTHREAD_CO...
Sung-Jin Park [Tue, 16 Jul 2019 10:56:11 +0000 (19:56 +0900)]
wayland-client: force sync of display when threads are waiting for over WL_PTHREAD_COND_TIMEDWAIT_TIMEOUT

Change-Id: I4973ab7794c0ea4831878f2f5e0d8141ca3d51fc
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
14 months agoPackaging: upgrade to 1.17.0
Sung-Jin Park [Mon, 25 Mar 2019 05:12:40 +0000 (14:12 +0900)]
Packaging: upgrade to 1.17.0

Change-Id: Ibba67b9352bf634e229dbda9766a2542e3cad9ce
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
14 months agowayland-util: change strerror() to strerror_r() to ensure thread-safety in wl_abort()
Sung-Jin Park [Thu, 7 Feb 2019 06:04:15 +0000 (15:04 +0900)]
wayland-util: change strerror() to strerror_r() to ensure thread-safety in wl_abort()

Change-Id: Ibf2288afcbde267b630a39de6236d98a293aa98e
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
14 months agowayland-util: leave errno in wl_abort_errno before doing abort() in wl_abort()
Sung-Jin Park [Thu, 17 Jan 2019 03:55:03 +0000 (12:55 +0900)]
wayland-util: leave errno in wl_abort_errno before doing abort() in wl_abort()

Change-Id: I90f21cac63c1828bc5557b51b0aa0b90d0edd14b
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
(cherry picked from commit 4fc6112dde0d53c90cf18e2825d90bbd6ef5438f)

14 months agowayland-cursor: fix a memory leak
jeon [Thu, 17 Jan 2019 10:33:12 +0000 (19:33 +0900)]
wayland-cursor: fix a memory leak

Change-Id: I021e69744840cfc673d787751220a5d2758f3cb9

14 months agoserver: event_source fd update if flush will be failed via EAGAIN
jeon [Thu, 22 Nov 2018 01:08:31 +0000 (10:08 +0900)]
server: event_source fd update if flush will be failed via EAGAIN

Change-Id: I5443c31b004220f27a164894f1381bacd50800a5

14 months agowayland-cursor: using old shm pool if reallocation is failed
JengHyun Kang [Tue, 2 Oct 2018 09:00:17 +0000 (18:00 +0900)]
wayland-cursor: using old shm pool if reallocation is failed

Change-Id: I7ab1b2401e5eb487a719c0a4b0dd7e3d4df2117c

14 months agoclient: use the thread reader_count to fix deadlock.
Boram Park [Thu, 7 Apr 2016 23:14:42 +0000 (08:14 +0900)]
client: use the thread reader_count to fix deadlock.

    Let's see the below scenario.

      1. A thread polls several fds including the wayland's fd.
      2. This thread probably calls wl_display_prepare_read()
         before polling fds.
      3. This thread could be awake by other event source which isn't
         related with wayland fd.
      4. After wake up, this thread could call wl_display_dispatch or
         wl_display_roundtrip for sync operation.

    Then, when this thread got a done event. this thread will fall in
    deadlock because this thread increases +2 reader_count in the same
    thread. The read_event or cancel_read for the first prepare_read
    is not going to happen because this thread sleeps in
    pthread_cond_wait() line of read_event.

    This problem can be solved by using the reader_count per thread.

    The reader_count of thread will be increased/decreased whenever
    prepare_read, cancel_read and read_event are called.

    However, the original reader_count of display will be increased
    only once per thread. And, when cancel_read and read_event are
    called, it will be decreased to read event from fd and wake up
    other threads. And that, if the thread reader_count is still more
    than 0, it will be increased because it means the thread is still
    polling in somewhere.

Change-Id: I2e881a6222e5ad380ace7a6d9571d5463cf701d9

14 months agoadd EGL_PACAKGE to disable an egl library temporarily
Boram Park [Wed, 11 Apr 2018 02:25:19 +0000 (11:25 +0900)]
add EGL_PACAKGE to disable an egl library temporarily

when ready, we have to remove this patch

Change-Id: I317e78a60fb2228dd102caa16dcd8d5913eb7c41