Bug 201226 - graphics/lcms2: crashes with SIGBUS on armv6
Summary: graphics/lcms2: crashes with SIGBUS on armv6
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: arm Any
: --- Affects Only Me
Assignee: Po-Chuan Hsieh
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-30 18:29 UTC by Mikael Urankar
Modified: 2015-11-29 07:07 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (sunpoet)


Attachments
sigbus fix (4.24 KB, patch)
2015-06-30 18:29 UTC, Mikael Urankar
no flags Details | Diff
sigbus fix (4.38 KB, patch)
2015-06-30 18:36 UTC, Mikael Urankar
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mikael Urankar freebsd_committer freebsd_triage 2015-06-30 18:29:53 UTC
Created attachment 158195 [details]
sigbus fix

Hi,

I hit the following sigbus on armv6 (texstudio is triggering the sigbus):

gdb texstudio
<snip>

Program received signal SIGBUS, Bus error.
[Switching to Thread 2c462300 (LWP 100271/texstudio)]
cmsMLUsetWide (mlu=0x2cc381e0, Language=0x228bc91c "en", Country=0x228bc379 "US", WideString=0x228bc128)
    at cmsnamed.c:224
224	    cmsUInt16Number Cntry = _cmsAdjustEndianess16(*(cmsUInt16Number*) Country);
Current language:  auto; currently minimal

(gdb) where
#0  cmsMLUsetWide (mlu=0x2cc381e0, Language=0x228bc91c "en", Country=0x228bc379 "US", WideString=0x228bc128)
    at cmsnamed.c:224
#1  0x22897730 in SetTextTags (hProfile=0x2ccd1c00, Description=0x228bc128) at cmsvirt.c:44
#2  0x228972f8 in cmsCreateRGBProfileTHR (ContextID=0x0, WhitePoint=0xbe5f0aa0, Primaries=0xbe5f0a58, 
    TransferFunction=0xbe5f0a4c) at cmsvirt.c:141
#3  0x22898b3c in cmsCreate_sRGBProfileTHR (ContextID=0x0) at cmsvirt.c:658
#4  0x22898c8c in cmsCreate_sRGBProfile () at cmsvirt.c:672
#5  0x224dd158 in GfxColorSpace::setupColorProfiles () from /usr/local/lib/libpoppler.so.49
#6  0x224f1180 in GfxState::GfxState () from /usr/local/lib/libpoppler.so.49
#7  0x2cc3f140 in ?? ()

(gdb) disassemble $pc-18 $pc+16
Dump of assembler code from 0x2289223c to 0x2289225c:
0x2289223c <cmsMLUsetWide+64>:	str	r5, [sp, #12]
0x22892240 <cmsMLUsetWide+68>:	bl	0x2285e138 <$a+96>
0x22892244 <cmsMLUsetWide+72>:	strh	r0, [r11, #-30]
0x22892248 <cmsMLUsetWide+76>:	ldr	r0, [r11, #-24]
0x2289224c <cmsMLUsetWide+80>:	ldrh	r0, [r0]
0x22892250 <cmsMLUsetWide+84>:	bl	0x2285e138 <$a+96>
0x22892254 <cmsMLUsetWide+88>:	strh	r0, [sp, #32]
0x22892258 <cmsMLUsetWide+92>:	ldr	r0, [r11, #-16]
End of assembler dump.

(gdb) info registers
r0             0x228bc379	579584889
<snip>

r0 is not 2-byte aligned.

The attached patch (from debian [1]) fixes that. It was successfully tested by Ulrich Grey.

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=644473

Thanks.
Comment 1 Mikael Urankar freebsd_committer freebsd_triage 2015-06-30 18:36:35 UTC
Created attachment 158196 [details]
sigbus fix

I've forgot to bump PORTREVISION
Comment 2 Michael Moll freebsd_committer freebsd_triage 2015-11-28 13:45:21 UTC
@sunpoet: I tested this on armv6hf and it seems good to me, please commit if there are no objections (or ping me here, I can commit it also).
Comment 3 Po-Chuan Hsieh freebsd_committer freebsd_triage 2015-11-29 06:57:10 UTC
(In reply to Michael Moll from comment #2)

Thanks for your help! I wanna ask someone to test this patch but totally forgot it.
Comment 4 commit-hook freebsd_committer freebsd_triage 2015-11-29 07:01:34 UTC
A commit references this bug:

Author: sunpoet
Date: Sun Nov 29 07:00:43 UTC 2015
New revision: 402582
URL: https://svnweb.freebsd.org/changeset/ports/402582

Log:
  - Fix build on armv6
  - Bump PORTREVISION for package change

  PR:		201226
  Submitted by:	Mikael Urankar <mikael.urankar@gmail.com>
  Tested by:	mmoll

Changes:
  head/graphics/lcms2/Makefile
  head/graphics/lcms2/files/
  head/graphics/lcms2/files/patch-src-cmsnamed.c
Comment 5 Po-Chuan Hsieh freebsd_committer freebsd_triage 2015-11-29 07:07:08 UTC
Committed. Thanks!