* [PATCH 1/3] mini-os: tpm: fix array access in locality_enabled
2014-07-22 7:19 [PATCH 0/3] tools: vtpm compile fixes Olaf Hering
@ 2014-07-22 7:19 ` Olaf Hering
2014-07-22 7:28 ` Samuel Thibault
2014-07-22 7:19 ` [PATCH 2/3] mini-os: tpm: remove usage of inline keyword Olaf Hering
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Olaf Hering @ 2014-07-22 7:19 UTC (permalink / raw)
To: Daniel De Graaf, Stefano Stabellini, Samuel Thibault
Cc: Olaf Hering, Ian Campbell, xen-devel
gcc-4.3 fails to prove that array indices will remain positive. Add a
hint for the compiler and check the index value before using it.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
| 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--git a/extras/mini-os/tpm_tis.c b/extras/mini-os/tpm_tis.c
index e8ca69f..dc4134a 100644
--- a/extras/mini-os/tpm_tis.c
+++ b/extras/mini-os/tpm_tis.c
@@ -611,7 +611,7 @@ s_time_t tpm_calc_ordinal_duration(struct tpm_chip *chip,
static int locality_enabled(struct tpm_chip* tpm, int l) {
- return tpm->enabled_localities & (1 << l);
+ return l >= 0 && tpm->enabled_localities & (1 << l);
}
static int check_locality(struct tpm_chip* tpm, int l) {
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 1/3] mini-os: tpm: fix array access in locality_enabled
2014-07-22 7:19 ` [PATCH 1/3] mini-os: tpm: fix array access in locality_enabled Olaf Hering
@ 2014-07-22 7:28 ` Samuel Thibault
0 siblings, 0 replies; 8+ messages in thread
From: Samuel Thibault @ 2014-07-22 7:28 UTC (permalink / raw)
To: Olaf Hering; +Cc: Daniel De Graaf, xen-devel, Ian Campbell, Stefano Stabellini
Olaf Hering, le Tue 22 Jul 2014 09:19:15 +0200, a écrit :
> gcc-4.3 fails to prove that array indices will remain positive. Add a
> hint for the compiler and check the index value before using it.
>
> Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> ---
> extras/mini-os/tpm_tis.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/extras/mini-os/tpm_tis.c b/extras/mini-os/tpm_tis.c
> index e8ca69f..dc4134a 100644
> --- a/extras/mini-os/tpm_tis.c
> +++ b/extras/mini-os/tpm_tis.c
> @@ -611,7 +611,7 @@ s_time_t tpm_calc_ordinal_duration(struct tpm_chip *chip,
>
>
> static int locality_enabled(struct tpm_chip* tpm, int l) {
> - return tpm->enabled_localities & (1 << l);
> + return l >= 0 && tpm->enabled_localities & (1 << l);
> }
>
> static int check_locality(struct tpm_chip* tpm, int l) {
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
>
--
Samuel
"2 + 2 = 5 pour d'assez grandes valeurs de 2"
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/3] mini-os: tpm: remove usage of inline keyword
2014-07-22 7:19 [PATCH 0/3] tools: vtpm compile fixes Olaf Hering
2014-07-22 7:19 ` [PATCH 1/3] mini-os: tpm: fix array access in locality_enabled Olaf Hering
@ 2014-07-22 7:19 ` Olaf Hering
2014-07-22 7:30 ` Samuel Thibault
2014-07-22 7:19 ` [PATCH 3/3] stubdom: fix -Wextra usage in vtpm_emulator Olaf Hering
2014-07-24 15:52 ` [PATCH 0/3] tools: vtpm compile fixes Ian Campbell
3 siblings, 1 reply; 8+ messages in thread
From: Olaf Hering @ 2014-07-22 7:19 UTC (permalink / raw)
To: Daniel De Graaf, Stefano Stabellini, Samuel Thibault
Cc: Olaf Hering, Ian Campbell, xen-devel
Compilation fails with gcc-4.3:
tpmback.c: In function 'tpmback_resp':
tpmback.c:148: error: inlining failed in call to 'tpmdev_check_req': call is unlikely and code size would grow
tpmback.c:165: error: called from here
tpmback.c: In function 'new_tpmif':
tpmback.c:384: error: inlining failed in call to '__init_tpmif': call is unlikely and code size would grow
tpmback.c:425: error: called from here
Adjust code to use static instead of inline, it has the same effect.
Change also tpmif_req_ready and tpmif_req_finished before they start to
cause failures.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
| 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--git a/extras/mini-os/tpmback.c b/extras/mini-os/tpmback.c
index 31da8d5..00b66e8 100644
--- a/extras/mini-os/tpmback.c
+++ b/extras/mini-os/tpmback.c
@@ -140,12 +140,12 @@ int globalinit = 0;
* Duplicates are not allowed
* **********************************/
-inline void tpmif_req_ready(tpmif_t* tpmif) {
+static void tpmif_req_ready(tpmif_t* tpmif) {
tpmif->flags |= TPMIF_REQ_READY;
gtpmdev.flags |= TPMIF_REQ_READY;
}
-inline void tpmdev_check_req(void) {
+static void tpmdev_check_req(void) {
int i;
int flags;
local_irq_save(flags);
@@ -160,7 +160,7 @@ inline void tpmdev_check_req(void) {
local_irq_restore(flags);
}
-inline void tpmif_req_finished(tpmif_t* tpmif) {
+static void tpmif_req_finished(tpmif_t* tpmif) {
tpmif->flags &= ~TPMIF_REQ_READY;
tpmdev_check_req();
}
@@ -382,7 +382,7 @@ int tpmif_change_state(tpmif_t* tpmif, enum xenbus_state state)
/**********************************
* TPMIF CREATION AND DELETION
* *******************************/
-inline tpmif_t* __init_tpmif(domid_t domid, unsigned int handle)
+static tpmif_t* __init_tpmif(domid_t domid, unsigned int handle)
{
tpmif_t* tpmif;
tpmif = malloc(sizeof(*tpmif));
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 2/3] mini-os: tpm: remove usage of inline keyword
2014-07-22 7:19 ` [PATCH 2/3] mini-os: tpm: remove usage of inline keyword Olaf Hering
@ 2014-07-22 7:30 ` Samuel Thibault
0 siblings, 0 replies; 8+ messages in thread
From: Samuel Thibault @ 2014-07-22 7:30 UTC (permalink / raw)
To: Olaf Hering; +Cc: Daniel De Graaf, xen-devel, Ian Campbell, Stefano Stabellini
Olaf Hering, le Tue 22 Jul 2014 09:19:16 +0200, a écrit :
> Compilation fails with gcc-4.3:
>
> tpmback.c: In function 'tpmback_resp':
> tpmback.c:148: error: inlining failed in call to 'tpmdev_check_req': call is unlikely and code size would grow
> tpmback.c:165: error: called from here
> tpmback.c: In function 'new_tpmif':
> tpmback.c:384: error: inlining failed in call to '__init_tpmif': call is unlikely and code size would grow
> tpmback.c:425: error: called from here
>
> Adjust code to use static instead of inline, it has the same effect.
> Change also tpmif_req_ready and tpmif_req_finished before they start to
> cause failures.
>
> Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> ---
> extras/mini-os/tpmback.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/extras/mini-os/tpmback.c b/extras/mini-os/tpmback.c
> index 31da8d5..00b66e8 100644
> --- a/extras/mini-os/tpmback.c
> +++ b/extras/mini-os/tpmback.c
> @@ -140,12 +140,12 @@ int globalinit = 0;
> * Duplicates are not allowed
> * **********************************/
>
> -inline void tpmif_req_ready(tpmif_t* tpmif) {
> +static void tpmif_req_ready(tpmif_t* tpmif) {
> tpmif->flags |= TPMIF_REQ_READY;
> gtpmdev.flags |= TPMIF_REQ_READY;
> }
>
> -inline void tpmdev_check_req(void) {
> +static void tpmdev_check_req(void) {
> int i;
> int flags;
> local_irq_save(flags);
> @@ -160,7 +160,7 @@ inline void tpmdev_check_req(void) {
> local_irq_restore(flags);
> }
>
> -inline void tpmif_req_finished(tpmif_t* tpmif) {
> +static void tpmif_req_finished(tpmif_t* tpmif) {
> tpmif->flags &= ~TPMIF_REQ_READY;
> tpmdev_check_req();
> }
> @@ -382,7 +382,7 @@ int tpmif_change_state(tpmif_t* tpmif, enum xenbus_state state)
> /**********************************
> * TPMIF CREATION AND DELETION
> * *******************************/
> -inline tpmif_t* __init_tpmif(domid_t domid, unsigned int handle)
> +static tpmif_t* __init_tpmif(domid_t domid, unsigned int handle)
> {
> tpmif_t* tpmif;
> tpmif = malloc(sizeof(*tpmif));
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
>
--
Samuel
void packerFlushTheToiletFirstThingInTheMorning( void* arg )
-+- chromium's source code -+-
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/3] stubdom: fix -Wextra usage in vtpm_emulator
2014-07-22 7:19 [PATCH 0/3] tools: vtpm compile fixes Olaf Hering
2014-07-22 7:19 ` [PATCH 1/3] mini-os: tpm: fix array access in locality_enabled Olaf Hering
2014-07-22 7:19 ` [PATCH 2/3] mini-os: tpm: remove usage of inline keyword Olaf Hering
@ 2014-07-22 7:19 ` Olaf Hering
2014-07-22 7:29 ` Samuel Thibault
2014-07-24 15:52 ` [PATCH 0/3] tools: vtpm compile fixes Ian Campbell
3 siblings, 1 reply; 8+ messages in thread
From: Olaf Hering @ 2014-07-22 7:19 UTC (permalink / raw)
To: Daniel De Graaf, Stefano Stabellini, Samuel Thibault
Cc: Olaf Hering, Ian Campbell, xen-devel
If -Wextra is appended to CFLAGS it will enable all warnings. Previous
options such as -Wno-unused-parameters have no effect anymore. As a
result compilation will fail with gcc-4.3. Newer versions of gcc will
appearently remember -Wno-* options before -Wextra.
Rearrange warning options for gcc so that -Wextra comes before other -W
options. This fixes compilation of stubdom in SLES11.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
stubdom/Makefile | 1 +
| 21 +++++++++++++++++++++
2 files changed, 22 insertions(+)
create mode 100644 stubdom/vtpm-cmake-Wextra.patch
diff --git a/stubdom/Makefile b/stubdom/Makefile
index 5f25c20..333112c 100644
--- a/stubdom/Makefile
+++ b/stubdom/Makefile
@@ -210,6 +210,7 @@ tpm_emulator-$(XEN_TARGET_ARCH): tpm_emulator-$(TPMEMU_VERSION).tar.gz
patch -d $@ -p1 < vtpm-locality.patch
patch -d $@ -p1 < vtpm-parent-sign-ek.patch
patch -d $@ -p1 < vtpm-deepquote.patch
+ patch -d $@ -p1 < vtpm-cmake-Wextra.patch
mkdir $@/build
cd $@/build; CC=${CC} $(CMAKE) .. -DCMAKE_C_FLAGS:STRING="-std=c99 -DTPM_NO_EXTERN $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Wno-declaration-after-statement"
touch $@
--git a/stubdom/vtpm-cmake-Wextra.patch b/stubdom/vtpm-cmake-Wextra.patch
new file mode 100644
index 0000000..a603654
--- /dev/null
+++ b/stubdom/vtpm-cmake-Wextra.patch
@@ -0,0 +1,21 @@
+---
+ CMakeLists.txt | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+Index: tpm_emulator-x86_64/CMakeLists.txt
+===================================================================
+--- tpm_emulator-x86_64.orig/CMakeLists.txt
++++ tpm_emulator-x86_64/CMakeLists.txt
+@@ -40,10 +40,11 @@ set(TPM_STORAGE_NAME "/var/lib/tpm/tpm_e
+ set(TPM_DEVICE_NAME "/dev/tpm")
+ endif()
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
+-add_definitions(-Wall -Werror -Wno-unused-parameter -Wpointer-arith -Wcast-align -Wwrite-strings)
++add_definitions(-Wall -Werror)
+ if("${CMAKE_SYSTEM}" MATCHES "Linux")
+ add_definitions(-Wextra)
+ endif()
++add_definitions(-Wno-unused-parameter -Wpointer-arith -Wcast-align -Wwrite-strings)
+ if(USE_OPENSSL)
+ add_definitions(-DUSE_OPENSSL)
+ endif()
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 3/3] stubdom: fix -Wextra usage in vtpm_emulator
2014-07-22 7:19 ` [PATCH 3/3] stubdom: fix -Wextra usage in vtpm_emulator Olaf Hering
@ 2014-07-22 7:29 ` Samuel Thibault
0 siblings, 0 replies; 8+ messages in thread
From: Samuel Thibault @ 2014-07-22 7:29 UTC (permalink / raw)
To: Olaf Hering; +Cc: Daniel De Graaf, xen-devel, Ian Campbell, Stefano Stabellini
Olaf Hering, le Tue 22 Jul 2014 09:19:17 +0200, a écrit :
> If -Wextra is appended to CFLAGS it will enable all warnings. Previous
> options such as -Wno-unused-parameters have no effect anymore. As a
> result compilation will fail with gcc-4.3. Newer versions of gcc will
> appearently remember -Wno-* options before -Wextra.
> Rearrange warning options for gcc so that -Wextra comes before other -W
> options. This fixes compilation of stubdom in SLES11.
>
> Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> ---
> stubdom/Makefile | 1 +
> stubdom/vtpm-cmake-Wextra.patch | 21 +++++++++++++++++++++
> 2 files changed, 22 insertions(+)
> create mode 100644 stubdom/vtpm-cmake-Wextra.patch
>
> diff --git a/stubdom/Makefile b/stubdom/Makefile
> index 5f25c20..333112c 100644
> --- a/stubdom/Makefile
> +++ b/stubdom/Makefile
> @@ -210,6 +210,7 @@ tpm_emulator-$(XEN_TARGET_ARCH): tpm_emulator-$(TPMEMU_VERSION).tar.gz
> patch -d $@ -p1 < vtpm-locality.patch
> patch -d $@ -p1 < vtpm-parent-sign-ek.patch
> patch -d $@ -p1 < vtpm-deepquote.patch
> + patch -d $@ -p1 < vtpm-cmake-Wextra.patch
> mkdir $@/build
> cd $@/build; CC=${CC} $(CMAKE) .. -DCMAKE_C_FLAGS:STRING="-std=c99 -DTPM_NO_EXTERN $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Wno-declaration-after-statement"
> touch $@
> diff --git a/stubdom/vtpm-cmake-Wextra.patch b/stubdom/vtpm-cmake-Wextra.patch
> new file mode 100644
> index 0000000..a603654
> --- /dev/null
> +++ b/stubdom/vtpm-cmake-Wextra.patch
> @@ -0,0 +1,21 @@
> +---
> + CMakeLists.txt | 3 ++-
> + 1 file changed, 2 insertions(+), 1 deletion(-)
> +
> +Index: tpm_emulator-x86_64/CMakeLists.txt
> +===================================================================
> +--- tpm_emulator-x86_64.orig/CMakeLists.txt
> ++++ tpm_emulator-x86_64/CMakeLists.txt
> +@@ -40,10 +40,11 @@ set(TPM_STORAGE_NAME "/var/lib/tpm/tpm_e
> + set(TPM_DEVICE_NAME "/dev/tpm")
> + endif()
> + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
> +-add_definitions(-Wall -Werror -Wno-unused-parameter -Wpointer-arith -Wcast-align -Wwrite-strings)
> ++add_definitions(-Wall -Werror)
> + if("${CMAKE_SYSTEM}" MATCHES "Linux")
> + add_definitions(-Wextra)
> + endif()
> ++add_definitions(-Wno-unused-parameter -Wpointer-arith -Wcast-align -Wwrite-strings)
> + if(USE_OPENSSL)
> + add_definitions(-DUSE_OPENSSL)
> + endif()
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
>
--
Samuel
<A> sauf que le firewall bloque tout sauf internet
-+- ben ouais, il bloque ipx/spx ! -+-
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/3] tools: vtpm compile fixes
2014-07-22 7:19 [PATCH 0/3] tools: vtpm compile fixes Olaf Hering
` (2 preceding siblings ...)
2014-07-22 7:19 ` [PATCH 3/3] stubdom: fix -Wextra usage in vtpm_emulator Olaf Hering
@ 2014-07-24 15:52 ` Ian Campbell
3 siblings, 0 replies; 8+ messages in thread
From: Ian Campbell @ 2014-07-24 15:52 UTC (permalink / raw)
To: Olaf Hering
Cc: Samuel Thibault, Daniel De Graaf, xen-devel, Stefano Stabellini
On Tue, 2014-07-22 at 09:19 +0200, Olaf Hering wrote:
> Fix compilation of vtpm in mini-os and stubdom.
> This is a result of the discussion in the thread "xen-unstable stubdom
> build-failure when debug=n".
All applied with Samuel's acks.
Ian.
^ permalink raw reply [flat|nested] 8+ messages in thread