[Xcb-commit] xcb/proto: 9 commits - src
Christian Linhart
clinhart at kemper.freedesktop.org
Mon Oct 26 09:46:30 PDT 2015
src/randr.xml | 3 +++
src/render.xml | 1 +
src/sync.xml | 1 +
src/xprint.xml | 5 +++--
src/xproto.xml | 2 ++
src/xselinux.xml | 2 ++
src/xv.xml | 2 ++
7 files changed, 14 insertions(+), 2 deletions(-)
New commits:
commit 259a6f122f905e1d702af9d355356df8c3f462f5
Author: Christian Linhart <chris at demorecorder.com>
Date: Sun Sep 13 15:45:17 2015 +0200
xv: struct "AttributeInfo": add explicit align pad
The align pad is needed so that a in list of struct "AttributeInfo",
the 32-bit fields in subsequent "AttributeInfo" are aligned.
(all fields except "name" are 32-bit values)
The xv-protocol-spec does not contain the protocol encoding.
(it specifies the protocol on a higher level)
The X-Server uses function "WriteToClient" to write the list "name"
to the connection:
http://cgit.freedesktop.org/xorg/xserver/tree/Xext/xvdisp.c?id=xorg-server-1.17.99.901#n809
Function "WriteToClient" does 4-byte alignment padding:
http://cgit.freedesktop.org/xorg/xserver/tree/os/io.c?id=xorg-server-1.17.99.901#n804
BTW, With the current server impl, the alignpad is not strictly needed
because the field "size", which describes the length of list "name"
is set to a multiple of 4:
http://cgit.freedesktop.org/xorg/xserver/tree/Xext/xvdisp.c?id=xorg-server-1.17.99.901#n805
Signed-off-by: Christian Linhart <chris at demorecorder.com>
Reviewed-by: Peter Harris <pharris at opentext.com>
diff --git a/src/xv.xml b/src/xv.xml
index d99711c..6db133f 100644
--- a/src/xv.xml
+++ b/src/xv.xml
@@ -147,6 +147,7 @@ authorization from the authors.
<list type="char" name="name">
<fieldref>size</fieldref>
</list>
+ <pad align="4" />
</struct>
<struct name="ImageFormatInfo">
commit 306c0a2d9636b6687fb679196b08e53231f11e4e
Author: Christian Linhart <chris at demorecorder.com>
Date: Sun Sep 13 15:45:16 2015 +0200
xv: struct "EncodingInfo": add explicit align pad
The align pad is needed so that a in list of struct "EncodingInfo",
the 32-bit fiels in subsequent "EncodingInfo" are aligned.
(the field "encoding" is a 32-bit value, and the field "rate"
contains two 32-bit values)
The xv-protocol-spec does not contain the protocol encoding.
(it specifies the protocol on a higher level)
The X-Server uses function "WriteToClient" to write the list "name"
to the connection:
http://cgit.freedesktop.org/xorg/xserver/tree/Xext/xvdisp.c?id=xorg-server-1.17.99.901#n456
Function "WriteToClient" does 4-byte alignment padding:
http://cgit.freedesktop.org/xorg/xserver/tree/os/io.c?id=xorg-server-1.17.99.901#n804
Signed-off-by: Christian Linhart <chris at demorecorder.com>
Reviewed-by: Peter Harris <pharris at opentext.com>
diff --git a/src/xv.xml b/src/xv.xml
index 47a05d0..d99711c 100644
--- a/src/xv.xml
+++ b/src/xv.xml
@@ -118,6 +118,7 @@ authorization from the authors.
<list type="char" name="name">
<fieldref>name_size</fieldref>
</list>
+ <pad align="4" />
</struct>
<struct name="Image">
commit f4348694c939f83e7135df4779d1bd138836c4db
Author: Christian Linhart <chris at demorecorder.com>
Date: Sun Sep 13 15:45:15 2015 +0200
xselinux: add explicit padding for struc "ListItem"
This is needed so that subsequent list-items in a list are aligned
to 4 bytes which is necessary because ListItem contains 32-bit values
of types ATOM and CARD32. (Actually, only the final align-pad
is needed for that.)
The xserver makes sure that the length of both char-lists is a multiple of 4:
http://cgit.freedesktop.org/xorg/xserver/tree/Xext/xselinux_ext.c?id=xorg-server-1.17.99.901#n360
So, instead of a explicit padding we could add something like an assertion
or precondition that the fields "object_context_len" and "data_context_len"
have to be a multiple of 4.
Unfortunately I couldn't find a protocol specification of the xselinux
extension, to see whether the multiple of 4 is mandated by the protocol spec
or whether there should be align-pads. (and whether there should
be an align pad between "object_context" and "data_context"
Does anybody know where the spec for the xselinux protocol is?
There ought to be a spec somewhere for this because this is
security relevant.
Signed-off-by: Christian Linhart <chris at demorecorder.com>
Reviewed-by: Peter Harris <pharris at opentext.com>
diff --git a/src/xselinux.xml b/src/xselinux.xml
index 7751470..a97a146 100644
--- a/src/xselinux.xml
+++ b/src/xselinux.xml
@@ -111,9 +111,11 @@ authorization from the authors.
<list type="char" name="object_context">
<fieldref>object_context_len</fieldref>
</list>
+ <pad align="4" />
<list type="char" name="data_context">
<fieldref>data_context_len</fieldref>
</list>
+ <pad align="4" />
</struct>
<request name="SetPropertyCreateContext" opcode="8">
commit 1601efa74cf128ac53cb507cc0392d7554f25c1a
Author: Christian Linhart <chris at demorecorder.com>
Date: Sun Sep 13 15:45:14 2015 +0200
xproto: struct "HOST": add explicit align pad
This pad is defined in the spec:
http://cgit.freedesktop.org/xorg/proto/xproto/tree/specs/encoding.xml?id=xproto-7.0.28#n534
The server adds this pad in function GetHosts at:
http://cgit.freedesktop.org/xorg/xserver/tree/os/access.c?id=xorg-server-1.17.99.901#n1426
Function GetHosts is called in function ProcListHosts at:
http://cgit.freedesktop.org/xorg/xserver/tree/dix/dispatch.c?id=xorg-server-1.17.99.901#n3166
Signed-off-by: Christian Linhart <chris at demorecorder.com>
Reviewed-by: Peter Harris <pharris at opentext.com>
diff --git a/src/xproto.xml b/src/xproto.xml
index 7aca2e2..da9ec01 100644
--- a/src/xproto.xml
+++ b/src/xproto.xml
@@ -5465,6 +5465,7 @@ sensitive!
<list type="BYTE" name="address">
<fieldref>address_len</fieldref>
</list>
+ <pad align="4" />
</struct>
<request name="ListHosts" opcode="110">
commit 54d489f4d725e287de20a57983c88ade03261599
Author: Christian Linhart <chris at demorecorder.com>
Date: Sun Sep 13 15:45:13 2015 +0200
xproto: add explicit align-pad in struct Setup
This pad is defined in the spec:
http://cgit.freedesktop.org/xorg/proto/xproto/tree/specs/encoding.xml?id=xproto-7.0.28#n875
And it is also implemented in the Server:
http://cgit.freedesktop.org/xorg/xserver/tree/dix/dispatch.c?id=xorg-server-1.17.99.901#n532
Signed-off-by: Christian Linhart <chris at demorecorder.com>
Reviewed-by: Peter Harris <pharris at opentext.com>
diff --git a/src/xproto.xml b/src/xproto.xml
index d50a428..7aca2e2 100644
--- a/src/xproto.xml
+++ b/src/xproto.xml
@@ -255,6 +255,7 @@ authorization from the authors.
<list type="char" name="vendor">
<fieldref>vendor_len</fieldref>
</list>
+ <pad align="4" />
<list type="FORMAT" name="pixmap_formats">
<fieldref>pixmap_formats_len</fieldref>
</list>
commit 8a7096ce7375b1840aa350a27a092dd4a22f4c6e
Author: Christian Linhart <chris at demorecorder.com>
Date: Sun Sep 13 15:45:12 2015 +0200
xprint: make padding explicit
Add explicit padding for:
* the struct "PRINTER":
- between list "name" and field "descLen"
I cannot read any of the formats that the xproto-spec is provided in.
(the postscript file is broken)
Therefore I provide the Xlib implementation as a reference:
The list "name" is read with _XReadPad or _XEatData:
http://cgit.freedesktop.org/xorg/lib/libXp/tree/src/XpPrinter.c?id=libXp-1.0.3#n158
_XReadPad does 4-byte padding:
http://cgit.freedesktop.org/xorg/lib/libX11/tree/src/xcb_io.c?id=libX11-1.6.3#n743
_XEatData does not do 4-byte padding:
http://cgit.freedesktop.org/xorg/lib/libX11/tree/src/xcb_io.c?id=libX11-1.6.3#n755
Since _XEatData is only a fallback when malloc fails, this is usually not
used. Therefore, using _XEatData as an alternative to _XReadPad in libXp
is a bug there.
- at the end of the struct "PRINTER"
this is OK because of the same reasons as above:
http://cgit.freedesktop.org/xorg/lib/libXp/tree/src/XpPrinter.c?id=libXp-1.0.3#n181
* the reply of request "PrintInputSelected"
- add a 1-byte pad at the start.
This is needed because all replies start with a 1-byte field that occupies
a place in the reply-header.
Signed-off-by: Christian Linhart <chris at demorecorder.com>
Reviewed-by: Peter Harris <pharris at opentext.com>
diff --git a/src/xprint.xml b/src/xprint.xml
index 4da49b0..f9af65f 100644
--- a/src/xprint.xml
+++ b/src/xprint.xml
@@ -41,12 +41,12 @@ authorization from the authors.
<list type="STRING8" name="name">
<fieldref>nameLen</fieldref>
</list>
- <!-- Padding -->
+ <pad align="4" />
<field type="CARD32" name="descLen" />
<list type="STRING8" name="description">
<fieldref>descLen</fieldref>
</list>
- <!-- More padding -->
+ <pad align="4" />
</struct>
<!--<typedef oldname="CARD32" newname="PCONTEXT" />-->
@@ -219,6 +219,7 @@ authorization from the authors.
<request name="PrintInputSelected" opcode="16">
<field type="PCONTEXT" name="context" />
<reply>
+ <pad bytes="1" />
<field type="CARD32" name="event_mask" />
<field type="CARD32" name="all_events_mask" />
</reply>
commit 9add1748e9e87d74a7e5f1cf6a4aad914a9cfb0d
Author: Christian Linhart <chris at demorecorder.com>
Date: Sun Sep 13 15:45:11 2015 +0200
sync: make padding explicit
Add explicit align-padding for struct SYSTEMCOUNTER:
Added 4-byte align-pad at the end.
This is field "p" in the spec of SYSTEMCOUNTER at:
http://cgit.freedesktop.org/xorg/proto/xextproto/tree/specs/sync.xml?id=xextproto-7.3.0#n983
Signed-off-by: Christian Linhart <chris at demorecorder.com>
Reviewed-by: Peter Harris <pharris at opentext.com>
diff --git a/src/sync.xml b/src/sync.xml
index 23175cb..33ce178 100644
--- a/src/sync.xml
+++ b/src/sync.xml
@@ -53,6 +53,7 @@ for licensing information.
<list type="char" name="name">
<fieldref>name_len</fieldref>
</list>
+ <pad align="4" />
</struct>
<struct name="TRIGGER">
commit d1e79abb07b1bcde9540503ed268edded68185c6
Author: Christian Linhart <chris at demorecorder.com>
Date: Sun Sep 13 15:45:10 2015 +0200
render: make padding explicit
Add explicit align-padding for:
* the request "SetPictureFilter":
Added 4-byte align-pad between list "filter" and list "values"
The spec does not show the padding:
http://cgit.freedesktop.org/xorg/proto/renderproto/tree/renderproto.txt?id=renderproto-0.11.1#n721
But there has to be padding to make accesses to 32-bit values in list
"values" aligned.
The Xlib implementation at
http://cgit.freedesktop.org/xorg/lib/libXrender/tree/src/Filter.c?id=libXrender-0.9.9#n160
correctly does the padding:
The string "filter" is written with "Data" which does 4-byte padding at the end:
http://cgit.freedesktop.org/xorg/lib/libX11/tree/include/X11/Xlibint.h?id=libX11-1.6.3#n535
http://cgit.freedesktop.org/xorg/lib/libX11/tree/src/xcb_io.c?id=libX11-1.6.3#n484
Signed-off-by: Christian Linhart <chris at demorecorder.com>
Reviewed-by: Peter Harris <pharris at opentext.com>
diff --git a/src/render.xml b/src/render.xml
index c54608e..935fdcc 100644
--- a/src/render.xml
+++ b/src/render.xml
@@ -607,6 +607,7 @@ for licensing information.
<list type="char" name="filter">
<fieldref>filter_len</fieldref>
</list>
+ <pad align="4" />
<list type="FIXED" name="values" />
</request>
commit 4b780da25fffeb4c1c042f05d618e93407b2fe77
Author: Christian Linhart <chris at demorecorder.com>
Date: Sun Sep 13 15:45:09 2015 +0200
randr: make padding explicit
Add explicit align-padding for:
* the request "SetCrtcTransform"
Added 4-byte align-pad between list "filter_name" and list "filter_params"
The spec does not show the padding
http://cgit.freedesktop.org/xorg/proto/randrproto/tree/randrproto.txt?id=randrproto-1.5.0#n1173
But there has to be padding to make accesses to 32-bit values in list
"filter_params" aligned.
The Xlib implementation at
http://cgit.freedesktop.org/xorg/lib/libXrandr/tree/src/XrrCrtc.c?id=libXrandr-1.5.0#n327
correctly does the padding:
The string "filter" is written with "Data" which does 4-byte padding at the end:
http://cgit.freedesktop.org/xorg/lib/libX11/tree/include/X11/Xlibint.h?id=libX11-1.6.3#n535
http://cgit.freedesktop.org/xorg/lib/libX11/tree/src/xcb_io.c?id=libX11-1.6.3#n484
* the reply of request "GetCrtcTransform"
Added two 4-byte align-pads:
- between lists "pending_filter_name" and "pending_params"
the spec does not show the padding
http://cgit.freedesktop.org/xorg/proto/randrproto/tree/randrproto.txt?id=randrproto-1.5.0#n1205
But there has to be padding to make accesses to 32-bit values in list
"filter_params" aligned.
The Xlib implementation at
http://cgit.freedesktop.org/xorg/lib/libXrandr/tree/src/XrrCrtc.c?id=libXrandr-1.5.0#n434
adds the padding.
- between lists "current_filter_name" and "current_params"
the spec does not show the padding
http://cgit.freedesktop.org/xorg/proto/randrproto/tree/randrproto.txt?id=randrproto-1.5.0#n1205
But there has to be padding to make accesses to 32-bit values in list
"current_params" aligned.
The Xlib implementation at
http://cgit.freedesktop.org/xorg/lib/libXrandr/tree/src/XrrCrtc.c?id=libXrandr-1.5.0#n445
adds the padding.
Signed-off-by: Christian Linhart <chris at demorecorder.com>
Reviewed-by: Peter Harris <pharris at opentext.com>
diff --git a/src/randr.xml b/src/randr.xml
index 7dfc8a9..722f715 100644
--- a/src/randr.xml
+++ b/src/randr.xml
@@ -528,6 +528,7 @@ authorization from the authors.
<list type="char" name="filter_name">
<fieldref>filter_len</fieldref>
</list>
+ <pad align="4" />
<list type="FIXED" name="filter_params" />
</request>
@@ -547,12 +548,14 @@ authorization from the authors.
<list type="char" name="pending_filter_name" >
<fieldref>pending_len</fieldref>
</list>
+ <pad align="4" />
<list type="FIXED" name="pending_params" >
<fieldref>pending_nparams</fieldref>
</list>
<list type="char" name="current_filter_name" >
<fieldref>current_len</fieldref>
</list>
+ <pad align="4" />
<list type="FIXED" name="current_params" >
<fieldref>current_nparams</fieldref>
</list>
More information about the xcb-commit
mailing list