libXt: Changes to 'master'
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sun Jun 27 18:39:15 UTC 2021
include/X11/CallbackI.h | 6 +++++-
include/X11/Intrinsic.h | 26 ++++++++++++++++++++------
include/X11/IntrinsicP.h | 13 +++++++++----
src/Callback.c | 4 ++++
src/Convert.c | 4 ++--
src/Create.c | 4 ++--
src/Manage.c | 2 +-
src/Object.c | 2 +-
src/Popup.c | 2 +-
src/Resources.c | 2 +-
10 files changed, 46 insertions(+), 19 deletions(-)
New commits:
commit 1d5bb760ee996927dd5dfa5b3c219b3d6ef63d11
Author: Alex Richardson <Alexander.Richardson at cl.cam.ac.uk>
Date: Wed Jun 16 14:50:51 2021 +0100
Fix InternalCallbackRec layout if pointers are bigger than 64 bits
When running `xeyes` via `SSH -X` on CHERI-RISC-V FreeBSD, I was getting
a Bus Error (unaligned store) in the `cl->callback = callback;` line of
_XtAddCallback. The `cl` variable (created using `ToList(icl)`) was only
aligned to 8 bytes, but for CHERI-RISC-V pointer-type loads and stores
require 16-byte alignment.
In order to fix this, I added a C99 flexible array member to
internalCallbackRec when compiling for C99 or newer. This ensures
that sizeof(InternalCallbackRec) is 16 (since it now includes the
required 12 byte padding up to the first XtCallbackRec). This also
ensures that alignof(InternalCallbackRec) is 16, but that doesn't
matter in this case since malloc() will always return a
sufficiently-aligned pointer.
I also changed ToList(p) to use the flexible array member directly
when compiling for C99. This is not a functional change since it
will evaluate to the same pointer, but it does add additional type
checking and ensures that only a `InternalCallbackRec *` can be
passed to the macro.
Signed-off-by: Alex Richardson <Alexander.Richardson at cl.cam.ac.uk>
commit f8c7069a46af185e0bfaa43d63d450c9a44787ba
Author: Alex Richardson <Alexander.Richardson at cl.cam.ac.uk>
Date: Wed Jun 16 14:35:11 2021 +0100
Fix XrmResource layout if pointers are bigger than long
On CHERI-enabled architectures (e.g. Arm's Morello), pointers are twice
the size of addresses (i.e. 128 bits for Morello, 64 bits for 32-bit
RISC-V). However, XtArgVal is currently defined as long, so it cannot
be used to store pointers on these architectures.
Also add a _Static_assert() when compiling with C11 support to check
that the offset of the last member matches that of XtResource.
Signed-off-by: Alex Richardson <Alexander.Richardson at cl.cam.ac.uk>
commit dd3e028d2a1bc5daf87865ca1e5e923000186af8
Author: Alex Richardson <Alexander.Richardson at cl.cam.ac.uk>
Date: Wed Jun 16 14:33:31 2021 +0100
Cast via intptr_t when converting integers to pointers
I found these by compiling libXt with the CHERI Clang compiler, as it
warns about conversions from integer to pointer that do not use intptr_t.
Signed-off-by: Alex Richardson <Alexander.Richardson at cl.cam.ac.uk>
commit 38e89c8582efc8cd1e49205b5d02a10511738120
Author: Alex Richardson <Alexander.Richardson at cl.cam.ac.uk>
Date: Wed Jun 16 14:32:44 2021 +0100
Use XtUIntPtr for integer types that can hold pointers
Various Xt*Id types are integer types that are used to hold pointers.
Use uintptr_t for standards-compliant conversion and to support
architectures where long cannot hold pointers (e.g. CHERI).
I found these by compiling libXt with the CHERI Clang compiler, as it
warns about conversions from integer to pointer that do not use intptr_t.
Signed-off-by: Alex Richardson <Alexander.Richardson at cl.cam.ac.uk>
commit cfa8e152141367edb7b53e90da4ad80e995f3607
Author: Alex Richardson <Alexander.Richardson at cl.cam.ac.uk>
Date: Wed Jun 16 14:29:28 2021 +0100
XtArgVal: Support architectures where pointers are bigger than long
On CHERI-enabled architectures (e.g. Arm's Morello), pointers are twice
the size of addresses (i.e. 128 bits for Morello, 64 bits for 32-bit
RISC-V). However, XtArgVal is currently defined as long, so it cannot
be used to store pointers on these architectures.
This commit changes XtArgVal to use intptr_t instead, which should be
long on most architectures but is larger for CHERI.
It also introduces XtIntPtr/XtUIntPtr which will be used in follow-up
changes. This commit should also help on LLP64 ABIs where long is 32
bits but pointers are 64 bits.
I am not sure what the compiler and C standard requirements are, so I've
guarded the use of stdint.h with `#if __STDC_VERSION__ >= 199901L`.
I've also added a _Static_assert() when compiling in C11 mode to
statically verify that the XtArgVal type requirements are met.
Signed-off-by: Alex Richardson <Alexander.Richardson at cl.cam.ac.uk>
More information about the xorg-commit
mailing list