unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#10862: [PATCH] Fix a segfault when /dev/urandom is not accessible
@ 2012-02-21 15:11 Giuseppe Scrivano
  2012-03-02  9:15 ` bug#10862: (no subject) Giuseppe Scrivano
  2012-03-07 22:10 ` bug#10862: [PATCH] Fix a segfault when /dev/urandom is not accessible Ludovic Courtès
  0 siblings, 2 replies; 3+ messages in thread
From: Giuseppe Scrivano @ 2012-02-21 15:11 UTC (permalink / raw)
  To: 10862

Hello schemers,

The function `fresh_syntax_session_id' defined macros.c assumes the
random module is loaded by calling `scm_i_random_bytes_from_platform'.
There are no symptoms when `read_dev_urandom' (random.c) works correctly
but the fallback method causes a segfault.

This patch fixes it.


Cheers,
Giuseppe



From a8707a154c401bfad91678556342ca698bf873cf Mon Sep 17 00:00:00 2001
From: Giuseppe Scrivano <giuseppe@southpole.se>
Date: Tue, 21 Feb 2012 15:55:44 +0100
Subject: [PATCH] Fix a segfault when /dev/urandom is not accessible

* libguile/init.c (scm_i_init_guile): Call `scm_init_random' before
`scm_init_macros'.
---
 libguile/init.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libguile/init.c b/libguile/init.c
index 7dec116..fbf8c7f 100644
--- a/libguile/init.c
+++ b/libguile/init.c
@@ -443,7 +443,8 @@ scm_i_init_guile (void *base)
   scm_init_ioext ();
   scm_init_keywords ();    /* Requires smob_prehistory */
   scm_init_list ();
-  scm_init_macros ();      /* Requires smob_prehistory */
+  scm_init_random ();      /* Requires smob_prehistory */
+  scm_init_macros ();      /* Requires smob_prehistory and random */
   scm_init_mallocs ();     /* Requires smob_prehistory */
   scm_init_modules ();     /* Requires smob_prehistory */
   scm_init_numbers ();
@@ -501,7 +502,6 @@ scm_i_init_guile (void *base)
   scm_init_eval_in_scheme ();
   scm_init_evalext ();
   scm_init_debug ();	/* Requires macro smobs */
-  scm_init_random ();   /* Requires smob_prehistory */
   scm_init_simpos ();
 #if HAVE_MODULES
   scm_init_dynamic_linking (); /* Requires smob_prehistory */
-- 
1.7.7.6






^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#10862: (no subject)
  2012-02-21 15:11 bug#10862: [PATCH] Fix a segfault when /dev/urandom is not accessible Giuseppe Scrivano
@ 2012-03-02  9:15 ` Giuseppe Scrivano
  2012-03-07 22:10 ` bug#10862: [PATCH] Fix a segfault when /dev/urandom is not accessible Ludovic Courtès
  1 sibling, 0 replies; 3+ messages in thread
From: Giuseppe Scrivano @ 2012-03-02  9:15 UTC (permalink / raw)
  To: 10862


this is the backtrace when the call to read_dev_urandom fails:

#0  0x00000000 in ?? ()
#1  0xb7f21b27 in scm_c_make_rstate (seed=0x804ac00 "%
~z\204{=\377\377w'\363\350\024\220`", n=16) at random.c:173
#2  0xb7f22ccd in random_state_of_last_resort () at random.c:702
#3  0xb7f22da9 in scm_i_random_bytes_from_platform (buf=0xbfffef76 "",
len=22) at random.c:735
#4  0xb7eefd3b in fresh_syntax_session_id () at macros.c:197
#5  0xb7ef006a in scm_init_macros () at macros.c:218
#6  0xb7ee5788 in scm_i_init_guile (base=0xbffff05c) at init.c:446
#7  0xb7f51c8e in scm_i_init_thread_for_guile (base=0xbffff05c,
parent=0x0) at threads.c:825
#8  0xb7f51db3 in with_guile_and_parent (base=0xbffff05c,
data=0xbffff084) at threads.c:891
#9  0x4a18b33f in GC_call_with_stack_base () from /usr/lib/libgc.so.1
#10 0xb7f51edb in scm_i_with_guile_and_parent (func=0xb7ee551f
<invoke_main_func>, data=0xbffff0dc, parent=0x0) at threads.c:941
#11 0xb7f51f0f in scm_with_guile (func=0xb7ee551f <invoke_main_func>,
data=0xbffff0dc) at threads.c:947
#12 0xb7ee54fe in scm_boot_guile (argc=3, argv=0xbffff1b4,
main_func=0x8048874 <inner_main>, closure=0x0) at init.c:318
#13 0x08048903 in main (argc=3, argv=0xbffff1b4) at guile.c:81





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#10862: [PATCH] Fix a segfault when /dev/urandom is not accessible
  2012-02-21 15:11 bug#10862: [PATCH] Fix a segfault when /dev/urandom is not accessible Giuseppe Scrivano
  2012-03-02  9:15 ` bug#10862: (no subject) Giuseppe Scrivano
@ 2012-03-07 22:10 ` Ludovic Courtès
  1 sibling, 0 replies; 3+ messages in thread
From: Ludovic Courtès @ 2012-03-07 22:10 UTC (permalink / raw)
  To: Giuseppe Scrivano; +Cc: 10862-done

Hi Giuseppe,

I was finally able to reproduce the problem by changing
‘scm_i_random_bytes_from_platform’ to force use of
‘random_state_of_last_resort’.

Your patch is applied as 3658a3744bcc7c75db24143db1dae1bd13554515.

Thanks!

Ludo’.





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-03-07 22:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-21 15:11 bug#10862: [PATCH] Fix a segfault when /dev/urandom is not accessible Giuseppe Scrivano
2012-03-02  9:15 ` bug#10862: (no subject) Giuseppe Scrivano
2012-03-07 22:10 ` bug#10862: [PATCH] Fix a segfault when /dev/urandom is not accessible Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).