Bug#613642: bus error in ps2pdf
On Wed, Feb 16, 2011 at 11:47:15 +0100, Stéphane Glondu wrote:
> Package: ghostscript
> Version: 9.01~dfsg-1
> Severity: serious
> Tags: sid
>
> Hello,
>
> ocaml-melt currently FTBFS on sparc [1] because of a bus error
> provoked by ps2pdf. The bus error is easily reproduced by running
> ps2pdf on the file available at [2]. This bug is not present with the
> previous version, 8.71~dfsg2-10.
>
> [1] https://buildd.debian.org/fetch.cgi?pkg=ocaml-melt&arch=sparc&ver=1.3.0-2&stamp=1297644449&file=log&as=raw
> [2] http://glondu.net/tmp/doc.ps
>
(gdb) bt
#0 __pthread_cond_init (cond=0x28a8c, cond_attr=0x0) at pthread_cond_init.c:38
#1 0xf760d27c in __pthread_cond_init (cond=0x28a8c, cond_attr=0x0)
at forward.c:117
#2 0xf78b1ce0 in gp_semaphore_open (sema=0x28a6c) at ./base/gp_psync.c:71
#3 0xf7a633c0 in gx_semaphore_alloc (memory=0x22870) at ./base/gxsync.c:59
#4 0xf786d23c in gsicc_cache_new (memory=0x224a8) at ./base/gsicc_cache.c:111
#5 0xf7a14dec in gs_imager_state_initialize (pis=0x3d4b8, mem=0x224a8)
at ./base/gsistate.c:141
#6 0xf7a20c9c in gs_state_alloc (mem=0x224a8) at ./base/gsstate.c:234
#7 0xf780a0e4 in int_gstate_alloc (dmem=0xffd42050) at ./psi/zgstate.c:114
#8 0xf77d21bc in context_state_alloc (ppcst=0xffd41f3c,
psystem_dict=0xffd41fe8, dmem=0xffd42050) at ./psi/icontext.c:131
#9 0xf77d9748 in gs_interp_init (pi_ctx_p=0x221e4, psystem_dict=0xffd41fe8,
dmem=0xffd42050) at ./psi/interp.c:286
#10 0xf77d609c in obj_init (pi_ctx_p=0x221e4, idmem=0xffd42050)
at ./psi/iinit.c:243
#11 0xf77ce42c in gs_main_init1 (minst=0x22190) at ./psi/imain.c:199
#12 0xf77cf784 in swproc (minst=0x22190, arg=<value optimized out>,
pal=0xffd427a4) at ./psi/imainarg.c:571
#13 0xf77d0854 in gs_main_init_with_args (minst=0x22190, argc=18,
argv=0xffd431d4) at ./psi/imainarg.c:200
#14 0x00010928 in main (argc=18, argv=0xffd431d4) at ./psi/dxmainc.c:84
cond needs to be 8-byte aligned, but isn't.
>From what I can tell the problem is this:
/* base/gpsync.h */
typedef struct {
void *dummy_;
} gp_semaphore;
/* base/gxsync.h */
typedef struct gx_semaphore_s {
gs_memory_t *memory; /* allocator to free memory */
gp_semaphore native; /* MUST BE LAST last since length is undef'd */
/* platform-dep impl, len is gp_semaphore_sizeof() */
} gx_semaphore_t;
/* base/gp_psync.c */
typedef struct pt_semaphore_t {
int count;
pthread_mutex_t mutex;
pthread_cond_t cond;
} pt_semaphore_t;
gx_semaphore_alloc() allocates a 8-byte-aligned gx_semaphore_t, which
means that sema->native is *not* 8-byte-aligned (its offset is 4),
whereas alignof(pt_semaphore_t) == 8. The easiest fix is probably to
make sure gp_semaphore has maximal alignment.
Cheers,
Julien
Reply to: