From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/10979 Path: news.gmane.org!.POSTED!not-for-mail From: He X Newsgroups: gmane.linux.lib.musl.general Subject: Re: Re: a bug in bindtextdomain() and strip '.UTF-8' Date: Sun, 29 Jan 2017 22:48:34 +0800 Message-ID: References: <20170129133946.GT17692@port70.net> <20170129140747.GJ1533@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=94eb2c0b771047ff3205473ccc3a X-Trace: blaine.gmane.org 1485701351 29678 195.159.176.226 (29 Jan 2017 14:49:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 29 Jan 2017 14:49:11 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-10994-gllmg-musl=m.gmane.org@lists.openwall.com Sun Jan 29 15:49:04 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1cXqmt-00077X-PI for gllmg-musl@m.gmane.org; Sun, 29 Jan 2017 15:49:03 +0100 Original-Received: (qmail 17930 invoked by uid 550); 29 Jan 2017 14:49:07 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 17903 invoked from network); 29 Jan 2017 14:49:06 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=Zua32qJHpu4V3ciU+DBfHnTcBbFa1xaSXUV7kYxKJ+o=; b=IHt3hQZnuuJdo+XTwEjH50MrxZIVLWmnNnHcagqwVNA7dsA+8RFuAdivTHEHLcwpDC rt4pIVckmjWWs6zIvLH6EAT8bZpuebiFwOrx+jClxsmOhoT5x48LhdTA4KAUGTMTlMnv Wv45JdHxoL3A5xTg3YraZG7dMRuHRzn559JT7E18gSFf9o/eQTANoGUfN9NYn5teqd+B KfhM/DZEzkKk+JdTeYYiNvFD48YnBHLLRWPrwGCxXEEyBg7XFVW0nfq9j+u7+/MuzRtC Hwpdgzn3wRJ0G9qaai73m9RzOhr7OOD6PKu/uA4Dx6lKSOhoR/+1wHTukHKTt/hwFbMO Zozg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=Zua32qJHpu4V3ciU+DBfHnTcBbFa1xaSXUV7kYxKJ+o=; b=O9SEur4DX0mbTPzLaliTXWuws7CUUzJa8eEyfvO9K38b2ljsl/uzefmZhNU0HgNFqb +S+p1aaMtkf/qoGqw8ZIgZV91VLOsVBg4H9TWyJl3+d2e8edspB+PunRFx9Rwi2DkCwC n5/riDW2nG2KhY1T04EECBcUijkCk0+zWjbk/Vpz+4yiOQUJNrkVsIfUUwfAnQlun7Vn 0WE+t5H7OdAvAKAiWUWYpYQrL2OTQviYD/U3eh54x7lSSuM7INKKmK7ugXX+mRYx7B3Q pX2yPrdMxBpBjI3pUNSscWRMgULBLKi4xhUQtd26YFuNDa6B68husPVXm8S0mFRvhZtg jNRA== X-Gm-Message-State: AIkVDXLQTi4yorV761Wbe0ivRHj1t5CPjxStMzWfGBjwPvV11t/hQ4pr2X0lnavBM534HAmQOgvW+fMkc3jBHA== X-Received: by 10.159.32.195 with SMTP id 61mr7584379uaa.147.1485701334431; Sun, 29 Jan 2017 06:48:54 -0800 (PST) In-Reply-To: <20170129140747.GJ1533@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:10979 Archived-At: --94eb2c0b771047ff3205473ccc3a Content-Type: text/plain; charset=UTF-8 1. agreed with rich, nplurals is important too; compiling the kernel, cannot update the patch 2. no other ways, musl will use generic config 100%, and then the exception, the run time error is hardcoded there; but i doubt if this really breaks binaries, the function is only called by libstdc++ itself. you cant only update the config, but does not update libstdc++. libstdc++ exported the same abi for common binaries, wont break most dynamic-loaded binary in my view. btw, with 'p-> to q->', 'strip .UTF-8'(these two in the first thread), and these two patches, fcitx, chromium are working well. but there're some names like 'de_DE@euro', 'zh_CN.GBK', these should be stripped, either, any good ideas? 2017-01-29 22:07 GMT+08:00 Rich Felker : > On Sun, Jan 29, 2017 at 02:39:47PM +0100, Szabolcs Nagy wrote: > > * He X [2017-01-29 12:52:56 +0800]: > > > 1. no memset after malloc, caused chromium crash: > > > http://www.openwall.com/lists/musl/2017/01/28/1 > > > --- musl-1.1.16/src/locale/dcngettext.c 2017-01-29 04:42:49.002221317 > +0000 > > > +++ musl-1.1.16/src/locale/dcngettext.c 2017-01-29 04:42:49.002221317 > +0000 > > > @@ -180,6 +180,7 @@ > > > __munmap((void *)map, map_size); > > > goto notrans; > > > } > > > + memset(p, 0, sizeof *p + namelen + 1); > > > p->map = map; > > > p->map_size = map_size; > > > memcpy(p->name, name, namelen+1); > > > > if you want to zero the entire allocation, then use calloc. > > but i think initializing plural_rule is enough. > > Conceptually it seems nice to avoid filling name[] twice, but since > namelen is bounded in size (note: we should be using strnlen elsewhere > where it first gets introduced, but strlen is already checked) it's > not such a practical issue. I would be ok with just zeroing > plural_rule and nplurals (the latter doesn't seem necessary but > leaving it uninitialized until later seems to be a poor choice w.r.t. > future-proofing the code) but just calling calloc for these > allocations is probably the cleanest fix. > > > > 2. musl uses generic config of libstdc++, which blocked the support of > > > locale, patch is there: > > > https://github.com/xhebox/noname-linux/issues/2#issuecomment-275704150 > > > > this breaks the abi of libstdc++ because the definition of > > a type in the public api is changed. > > > > so existing c++ binaries break if the toolchain is patched. > > I'm not sufficiently familiar with this code to understand why right > away. Do you see an easy fix to avoid ABI breakage while fixing the > bug? > > Rich > --94eb2c0b771047ff3205473ccc3a Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
1. agreed with rich,=C2=A0nplurals is important too; compi= ling the kernel, cannot update the patch
2. no other ways, musl will us= e generic config 100%, and then the exception, the run time error is hardco= ded there; but i doubt if this really breaks binaries, the function is only= called by libstdc++ itself. you cant only update the config, but does not = update libstdc++. libstdc++ exported the same abi for common binaries, wont= break most dynamic-loaded binary in my view.

btw,= with 'p-> to q->', 'strip .UTF-8'(these two in the f= irst thread), =C2=A0and these two patches, fcitx, chromium are working well= .

but there're some names like 'de_DE@euro= ', 'zh_CN.GBK', these should be stripped, either, any good idea= s?

2017-01-2= 9 22:07 GMT+08:00 Rich Felker <dalias@libc.org>:
On Sun, Jan 29, 2017 at 02:39:47PM +0= 100, Szabolcs Nagy wrote:
> * He X <xw897002528@gmail.= com> [2017-01-29 12:52:56 +0800]:
> > 1. no memset after malloc, caused chromium crash:
> > http://www.openwall.com/lists/musl/2= 017/01/28/1
> > --- musl-1.1.16/src/locale/dcngettext.c 2017-01-29 04:42:49.= 002221317 +0000
> > +++ musl-1.1.16/src/locale/dcngettext.c 2017-01-29 04:42:49.= 002221317 +0000
> > @@ -180,6 +180,7 @@
> >=C2=A0 =C2=A0__munmap((void *)map, map_size);
> >=C2=A0 =C2=A0goto notrans;
> >=C2=A0 =C2=A0}
> > + memset(p, 0, sizeof *p + namelen + 1);
> >=C2=A0 =C2=A0p->map =3D map;
> >=C2=A0 =C2=A0p->map_size =3D map_size;
> >=C2=A0 =C2=A0memcpy(p->name, name, namelen+1);
>
> if you want to zero the entire allocation, then use calloc.
> but i think initializing plural_rule is enough.

Conceptually it seems nice to avoid filling name[] twice, but since<= br> namelen is bounded in size (note: we should be using strnlen elsewhere
where it first gets introduced, but strlen is already checked) it's
not such a practical issue. I would be ok with just zeroing
plural_rule and nplurals (the latter doesn't seem necessary but
leaving it uninitialized until later seems to be a poor choice w.r.t.
future-proofing the code) but just calling calloc for these
allocations is probably the cleanest fix.

> > 2. musl uses generic config of libstdc++, which blocked the suppo= rt of
> > locale, patch is there:
> > https://github.com/x= hebox/noname-linux/issues/2#issuecomment-275704150
>
> this breaks the abi of libstdc++ because the definition of
> a type in the public api is changed.
>
> so existing c++ binaries break if the toolchain is patched.

I'm not sufficiently familiar with this code to understand why r= ight
away. Do you see an easy fix to avoid ABI breakage while fixing the
bug?

Rich

--94eb2c0b771047ff3205473ccc3a--