Skip to contentSkip to conversation

Fix build failures.

PATCH Applied Gerd Hoffmann 4 participants 8 messages Sep 7, 2011 – Sep 22, 2011

lore
Share & tools
lore
#3 lore raw

PATCH 2/3 Use hex instead of binary.

In reply to Gerd Hoffmann

Older gcc versions don't understand 0b<bits>,
use hex representation instead.

Fixes build failure on RHEL-5.

---
 target-unicore32/translate.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
target-unicore32/translate.c +8 -8
index 4ecb0f1..4d0aa43 100644
@@ -1788,7 +1788,7 @@ static void disas_uc32_insn(CPUState *env, DisasContext *s)
      * E    : 5
      */
     switch (insn >> 29) {
-    case 0b000:
+    case 0x0:
         if (UCOP_SET(5) && UCOP_SET(8) && !UCOP_SET(28)) {
             do_mult(env, s, insn);
             break;
@@ -1798,7 +1798,7 @@ static void disas_uc32_insn(CPUState *env, DisasContext *s)
             do_misc(env, s, insn);
             break;
         }
-    case 0b001:
+    case 0x1:
         if (((UCOP_OPCODES >> 2) == 2) && !UCOP_SET_S) {
             do_misc(env, s, insn);
             break;
@@ -1806,7 +1806,7 @@ static void disas_uc32_insn(CPUState *env, DisasContext *s)
         do_datap(env, s, insn);
         break;
 
-    case 0b010:
+    case 0x2:
         if (UCOP_SET(8) && UCOP_SET(5)) {
             do_ldst_hwsb(env, s, insn);
             break;
@@ -1814,24 +1814,24 @@ static void disas_uc32_insn(CPUState *env, DisasContext *s)
         if (UCOP_SET(8) || UCOP_SET(5)) {
             ILLEGAL;
         }
-    case 0b011:
+    case 0x3:
         do_ldst_ir(env, s, insn);
         break;
 
-    case 0b100:
+    case 0x4:
         if (UCOP_SET(8)) {
             ILLEGAL; /* extended instructions */
         }
         do_ldst_m(env, s, insn);
         break;
-    case 0b101:
+    case 0x5:
         do_branch(env, s, insn);
         break;
-    case 0b110:
+    case 0x6:
         /* Coprocessor.  */
         disas_coproc_insn(env, s, insn);
         break;
-    case 0b111:
+    case 0x7:
         if (!UCOP_SET(28)) {
             disas_coproc_insn(env, s, insn);
             break;
Signature · 1 line
1.7.1
#1 lore raw

PATCH 1/3 Don't use g_thread_get_initialized.

In reply to Gerd Hoffmann

Initialize glib threads unconditionally in main() instead of using g_thread_get_initialized in the 9p code.

Fixes a build failure on RHEL-5, which ships glib 2.12. g_thread_get_initialized was added in 2.20.

---
 hw/9pfs/virtio-9p-coth.c |    4 ----
 vl.c                     |    1 +
 2 files changed, 1 insertions(+), 4 deletions(-)
hw/9pfs/virtio-9p-coth.c +0 -4
index ae05658..25556cc 100644
@@ -67,10 +67,6 @@ int v9fs_init_worker_threads(void)
     /* Leave signal handling to the iothread.  */
     pthread_sigmask(SIG_SETMASK, &set, &oldset);
 
-    /* init thread system if not already initialized */
-    if (!g_thread_get_initialized()) {
-        g_thread_init(NULL);
-    }
     if (qemu_pipe(notifier_fds) == -1) {
         ret = -1;
         goto err_out;
vl.c +1 -0
index 5ba9b35..6e998af 100644
@@ -2200,6 +2200,7 @@ int main(int argc, char **argv, char **envp)
     error_set_progname(argv[0]);
 
     g_mem_set_vtable(&mem_trace);
+    g_thread_init(NULL);
 
     init_clocks();
 
Signature · 1 line
1.7.1
#4 lore raw

PATCH 3/3 vns/tls: don't use depricated gnutls functions

In reply to Gerd Hoffmann

Avoid using depricated gnutls functions with recent gnutls versions. Fixes build failure on Fedora 16. Keep the old way for compatibility with old installations such as RHEL-5 (gnutls 1.4.x).

Based on a patch from Raghavendra D Prabhu <[email protected]>

---
 ui/vnc-tls.c |   62 ++++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 43 insertions(+), 19 deletions(-)
ui/vnc-tls.c +43 -19
index 2e2456e..276e127 100644
@@ -283,13 +283,51 @@ int vnc_tls_validate_certificate(struct VncState *vs)
     return 0;
 }
 
+#if defined(GNUTLS_VERSION_NUMBER) && \
+    GNUTLS_VERSION_NUMBER >= 0x020200 /* 2.2.0 */
+
+static int vnc_set_gnutls_priority(struct VncState *vs, int needX509Creds)
+{
+    const char *priority = needX509Creds ? "NORMAL" : "NORMAL:+ANON-DH";
+
+    if (gnutls_priority_set_direct(vs->tls.session, priority, NULL) < 0) {
+        return -1;
+    }
+    return 0;
+}
+
+#else
+
+static int vnc_set_gnutls_priority(struct VncState *vs, int x509)
+{
+    static const int cert_types[] = { GNUTLS_CRT_X509, 0 };
+    static const int protocols[] = {
+        GNUTLS_TLS1_1, GNUTLS_TLS1_0, GNUTLS_SSL3, 0
+    };
+    static const int kx_anon[] = { GNUTLS_KX_ANON_DH, 0 };
+    static const int kx_x509[] = {
+        GNUTLS_KX_DHE_DSS, GNUTLS_KX_RSA,
+        GNUTLS_KX_DHE_RSA, GNUTLS_KX_SRP, 0
+    };
+
+    if (gnutls_kx_set_priority(vs->tls.session, x509 ? kx_x509 : kx_anon) < 0) {
+        return -1;
+    }
+
+    if (gnutls_certificate_type_set_priority(vs->tls.session, cert_types) < 0) {
+        return -1;
+    }
+
+    if (gnutls_protocol_set_priority(vs->tls.session, protocols) < 0) {
+        return -1;
+    }
+    return 0;
+}
+
+#endif
 
 int vnc_tls_client_setup(struct VncState *vs,
                          int needX509Creds) {
-    static const int cert_type_priority[] = { GNUTLS_CRT_X509, 0 };
-    static const int protocol_priority[]= { GNUTLS_TLS1_1, GNUTLS_TLS1_0, GNUTLS_SSL3, 0 };
-    static const int kx_anon[] = {GNUTLS_KX_ANON_DH, 0};
-    static const int kx_x509[] = {GNUTLS_KX_DHE_DSS, GNUTLS_KX_RSA, GNUTLS_KX_DHE_RSA, GNUTLS_KX_SRP, 0};
 
     VNC_DEBUG("Do TLS setup\n");
     if (vnc_tls_initialize() < 0) {
@@ -310,21 +348,7 @@ int vnc_tls_client_setup(struct VncState *vs,
             return -1;
         }
 
-        if (gnutls_kx_set_priority(vs->tls.session, needX509Creds ? kx_x509 : kx_anon) < 0) {
-            gnutls_deinit(vs->tls.session);
-            vs->tls.session = NULL;
-            vnc_client_error(vs);
-            return -1;
-        }
-
-        if (gnutls_certificate_type_set_priority(vs->tls.session, cert_type_priority) < 0) {
-            gnutls_deinit(vs->tls.session);
-            vs->tls.session = NULL;
-            vnc_client_error(vs);
-            return -1;
-        }
-
-        if (gnutls_protocol_set_priority(vs->tls.session, protocol_priority) < 0) {
+        if (vnc_set_gnutls_priority(vs, needX509Creds) < 0) {
             gnutls_deinit(vs->tls.session);
             vs->tls.session = NULL;
             vnc_client_error(vs);
Signature · 1 line
1.7.1
#0 lore raw

cover Fix build failures.

Hi,

This patch series fixes a bunch of build failures.

please apply,
Gerd

Gerd Hoffmann (3):
Don't use g_thread_get_initialized.
Use hex instead of binary.
vns/tls: don't use depricated gnutls functions

 hw/9pfs/virtio-9p-coth.c     |    4 ---
 target-unicore32/translate.c |   16 +++++-----
 ui/vnc-tls.c                 |   62 +++++++++++++++++++++++++++++-------------
 vl.c                         |    1 +
 4 files changed, 52 insertions(+), 31 deletions(-)
#5 lore raw

Re: [Qemu-devel] [PATCH 3/3] vns/tls: don't use depricated gnutls functions

In reply to Gerd Hoffmann

See inline comments below.

Am 07.09.2011 15:02, schrieb Gerd Hoffmann:

Quoted 1 line

Avoid using depricated gnutls functions with recent gnutls versions.

deprecated?

Quoted 16 lines

Fixes build failure on Fedora 16. Keep the old way for compatibility with old installations such as RHEL-5 (gnutls 1.4.x).

Based on a patch from Raghavendra D Prabhu <[email protected]>

---
ui/vnc-tls.c | 62
++++++++++++++++++++++++++++++++++++++++-----------------

1 files changed, 43 insertions(+), 19 deletions(-)
ui/vnc-tls.c +0 -0
index 2e2456e..276e127 100644

ui/vnc-tls.c int vnc_tls_validate_certificate(struct VncState · line 291

Quoted 9 lines
ui/vnc-tls.c +4 -0
@@ -283,13 +283,51 @@ int vnc_tls_validate_certificate(struct VncState 
 *vs)
 return 0;
 }
 
+#if defined(GNUTLS_VERSION_NUMBER) && \
+ GNUTLS_VERSION_NUMBER >= 0x020200 /* 2.2.0 */
+
+static int vnc_set_gnutls_priority(struct VncState *vs, int 
 needX509Creds)

Replace the first argument by gnutls_session_t /session/. This simplifies the code.

ui/vnc-tls.c int vnc_tls_validate_certificate(struct VncState *vs) · line 293

Quoted 4 lines
ui/vnc-tls.c +4 -0
+{
+ const char *priority = needX509Creds ? "NORMAL" : "NORMAL:+ANON-DH";
+
+ if (gnutls_priority_set_direct(vs->tls.session, priority, NULL) < 0) {

Even if this works, testing for != GNUTLS_E_SUCCESS would be better because GNUTLS_E_SUCCESS is the return value for success according to the manual.

The same applies to the other function calls below as well.

ui/vnc-tls.c int vnc_tls_validate_certificate(struct VncState *vs) · line 301

Quoted 8 lines
ui/vnc-tls.c +8 -0
+ return -1;
+ }
+ return 0;
+}
+
+#else
+
+static int vnc_set_gnutls_priority(struct VncState *vs, int x509)

Replace the first argument by gnutls_session_t /session/.

Quoted 53 lines
ui/vnc-tls.c +26 -0
+{
+ static const int cert_types[] = { GNUTLS_CRT_X509, 0 };
+ static const int protocols[] = {
+ GNUTLS_TLS1_1, GNUTLS_TLS1_0, GNUTLS_SSL3, 0
+ };
+ static const int kx_anon[] = { GNUTLS_KX_ANON_DH, 0 };
+ static const int kx_x509[] = {
+ GNUTLS_KX_DHE_DSS, GNUTLS_KX_RSA,
+ GNUTLS_KX_DHE_RSA, GNUTLS_KX_SRP, 0
+ };
+
+ if (gnutls_kx_set_priority(vs->tls.session, x509 ? kx_x509 : 
 kx_anon) < 0) {
+ return -1;
+ }
+
+ if (gnutls_certificate_type_set_priority(vs->tls.session, 
 cert_types) < 0) {
+ return -1;
+ }
+
+ if (gnutls_protocol_set_priority(vs->tls.session, protocols) < 0) {
+ return -1;
+ }
+ return 0;
+}
+
+#endif
 
 int vnc_tls_client_setup(struct VncState *vs,

int needX509Creds) {
- static const int cert_type_priority[] = { GNUTLS_CRT_X509, 0 };
- static const int protocol_priority[]= { GNUTLS_TLS1_1, GNUTLS_TLS1_0, GNUTLS_SSL3, 0 };
- static const int kx_anon[] = {GNUTLS_KX_ANON_DH, 0};
- static const int kx_x509[] = {GNUTLS_KX_DHE_DSS, GNUTLS_KX_RSA, GNUTLS_KX_DHE_RSA, GNUTLS_KX_SRP, 0};

VNC_DEBUG("Do TLS setup\n");
if (vnc_tls_initialize() < 0) {

ui/vnc-tls.c +0 -8
@@ -310,21 +348,7 @@ int vnc_tls_client_setup(struct VncState *vs,
 return -1;
 }
 
- if (gnutls_kx_set_priority(vs->tls.session, needX509Creds ? kx_x509 
 : kx_anon) < 0) {
- gnutls_deinit(vs->tls.session);
- vs->tls.session = NULL;
- vnc_client_error(vs);
- return -1;
- }
-
- if (gnutls_certificate_type_set_priority(vs->tls.session, 

ui/vnc-tls.c int vnc_tls_client_setup(struct VncState *vs, · line 354

Quoted 10 lines
ui/vnc-tls.c +1 -7
 cert_type_priority) < 0) {
- gnutls_deinit(vs->tls.session);
- vs->tls.session = NULL;
- vnc_client_error(vs);
- return -1;
- }
-
- if (gnutls_protocol_set_priority(vs->tls.session, protocol_priority) 
 < 0) {
+ if (vnc_set_gnutls_priority(vs, needX509Creds) < 0) {

Use vs->tls.session as first argument.

Quoted 3 lines

gnutls_deinit(vs->tls.session);
vs->tls.session = NULL;
vnc_client_error(vs);

#6 lore raw

PATCH v2 1/1 vns/tls: don't use depricated gnutls functions

Avoid using deprecated gnutls functions with recent gnutls versions. Fixes build failure on Fedora 16. Keep the old way for compatibility with old installations such as RHEL-5 (gnutls 1.4.x).

Based on a patch from Raghavendra D Prabhu <[email protected]>

---
 ui/vnc-tls.c |   68 +++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 49 insertions(+), 19 deletions(-)
ui/vnc-tls.c +49 -19
index 2e2456e..ffbd172 100644
@@ -283,13 +283,57 @@ int vnc_tls_validate_certificate(struct VncState *vs)
     return 0;
 }
 
+#if defined(GNUTLS_VERSION_NUMBER) && \
+    GNUTLS_VERSION_NUMBER >= 0x020200 /* 2.2.0 */
+
+static int vnc_set_gnutls_priority(gnutls_session_t s, int x509)
+{
+    const char *priority = x509 ? "NORMAL" : "NORMAL:+ANON-DH";
+    int rc;
+
+    rc = gnutls_priority_set_direct(s, priority, NULL);
+    if (rc != GNUTLS_E_SUCCESS) {
+        return -1;
+    }
+    return 0;
+}
+
+#else
+
+static int vnc_set_gnutls_priority(gnutls_session_t s, int x509)
+{
+    static const int cert_types[] = { GNUTLS_CRT_X509, 0 };
+    static const int protocols[] = {
+        GNUTLS_TLS1_1, GNUTLS_TLS1_0, GNUTLS_SSL3, 0
+    };
+    static const int kx_anon[] = { GNUTLS_KX_ANON_DH, 0 };
+    static const int kx_x509[] = {
+        GNUTLS_KX_DHE_DSS, GNUTLS_KX_RSA,
+        GNUTLS_KX_DHE_RSA, GNUTLS_KX_SRP, 0
+    };
+    int rc;
+
+    rc = gnutls_kx_set_priority(s, x509 ? kx_x509 : kx_anon);
+    if (rc != GNUTLS_E_SUCCESS) {
+        return -1;
+    }
+
+    rc = gnutls_certificate_type_set_priority(s, cert_types);
+    if (rc != GNUTLS_E_SUCCESS) {
+        return -1;
+    }
+
+    rc = gnutls_protocol_set_priority(s, protocols);
+    if (rc != GNUTLS_E_SUCCESS) {
+        return -1;
+    }
+    return 0;
+}
+
+#endif
 
 int vnc_tls_client_setup(struct VncState *vs,
                          int needX509Creds) {
-    static const int cert_type_priority[] = { GNUTLS_CRT_X509, 0 };
-    static const int protocol_priority[]= { GNUTLS_TLS1_1, GNUTLS_TLS1_0, GNUTLS_SSL3, 0 };
-    static const int kx_anon[] = {GNUTLS_KX_ANON_DH, 0};
-    static const int kx_x509[] = {GNUTLS_KX_DHE_DSS, GNUTLS_KX_RSA, GNUTLS_KX_DHE_RSA, GNUTLS_KX_SRP, 0};
 
     VNC_DEBUG("Do TLS setup\n");
     if (vnc_tls_initialize() < 0) {
@@ -310,21 +354,7 @@ int vnc_tls_client_setup(struct VncState *vs,
             return -1;
         }
 
-        if (gnutls_kx_set_priority(vs->tls.session, needX509Creds ? kx_x509 : kx_anon) < 0) {
-            gnutls_deinit(vs->tls.session);
-            vs->tls.session = NULL;
-            vnc_client_error(vs);
-            return -1;
-        }
-
-        if (gnutls_certificate_type_set_priority(vs->tls.session, cert_type_priority) < 0) {
-            gnutls_deinit(vs->tls.session);
-            vs->tls.session = NULL;
-            vnc_client_error(vs);
-            return -1;
-        }
-
-        if (gnutls_protocol_set_priority(vs->tls.session, protocol_priority) < 0) {
+        if (vnc_set_gnutls_priority(vs->tls.session, needX509Creds) < 0) {
             gnutls_deinit(vs->tls.session);
             vs->tls.session = NULL;
             vnc_client_error(vs);
Signature · 1 line
1.7.1
#7 lore raw
In reply to Gerd Hoffmann
Quoted 6 lines · Gerd Hoffmann
   Hi,

This patch series fixes a bunch of build failures.

please apply,
Gerd

Applied all. Thanks.

Regards,

Anthony Liguori

Quoted 14 lines

Gerd Hoffmann (3):
Don't use g_thread_get_initialized.
Use hex instead of binary.
vns/tls: don't use depricated gnutls functions

  hw/9pfs/virtio-9p-coth.c     |    4 ---
  target-unicore32/translate.c |   16 +++++-----
  ui/vnc-tls.c                 |   62 +++++++++++++++++++++++++++++-------------
  vl.c                         |    1 +
  4 files changed, 52 insertions(+), 31 deletions(-)
#2 lore raw

Re: [Qemu-devel] [PATCH 1/3] Don't use g_thread_get_initialized.

In reply to Gerd Hoffmann
Quoted 32 lines · Gerd Hoffmann

Initialize glib threads unconditionally in main() instead of using g_thread_get_initialized in the 9p code.

Fixes a build failure on RHEL-5, which ships glib 2.12. g_thread_get_initialized was added in 2.20.

---
 hw/9pfs/virtio-9p-coth.c |    4 ----
 vl.c                     |    1 +

 2 files changed, 1 insertions(+), 4 deletions(-)
hw/9pfs/virtio-9p-coth.c +0 -4
index ae05658..25556cc 100644
@@ -67,10 +67,6 @@ int v9fs_init_worker_threads(void)
     /* Leave signal handling to the iothread.  */
     pthread_sigmask(SIG_SETMASK, &set, &oldset);
 
-    /* init thread system if not already initialized */
-    if (!g_thread_get_initialized()) {
-        g_thread_init(NULL);
-    }
     if (qemu_pipe(notifier_fds) == -1) {
         ret = -1;
         goto err_out;
vl.c +0 -0
index 5ba9b35..6e998af 100644

vl.c int main(int argc, char **argv, char **envp) · line 2203

Quoted 4 lines
vl.c +1 -0
@@ -2200,6 +2200,7 @@ int main(int argc, char **argv, char **envp)
     error_set_progname(argv[0]);
 
     g_mem_set_vtable(&mem_trace);
+    g_thread_init(NULL);

It breaks slirp on Win32. Who knows this reason?

Quoted 7 lines
vl.c +0 -1
     init_clocks();
 
--

1.7.1