public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/10283] New: localedef fails to generate locale-archive on SH4 arch
@ 2009-06-15 10:12 masaki dot chikama at gmail dot com
  2009-06-15 14:03 ` [Bug libc/10283] " drepper at redhat dot com
  2009-06-16 10:12 ` masaki dot chikama at gmail dot com
  0 siblings, 2 replies; 8+ messages in thread
From: masaki dot chikama at gmail dot com @ 2009-06-15 10:12 UTC (permalink / raw)
  To: glibc-bugs

When building locale-archive on SH4 arch, localdef fail to mmap files 
with this message.

+ /builddir/build/BUILD/glibc-20090510T1842/build-sh4-linuxnptl/elf/ld.so
--library-path /builddir/build/BUILD/glibc-20090510T1842/build-sh4-linuxnptl/ 
/builddir/build/BUILD/glibc-20090510T1842/build-sh4-linuxnptl/locale/localedef
--prefix /builddir/build/BUILDROOT/glibc-2.10.1-1.fs1.sh4 --add-to-archive aa_DJ
....
uctw zh_TW.utf8 zu_ZA zu_ZA.utf8
cannot map archive header: Invalid argument

The failed point is mmap64() in locale/programs/locarchive.c .
On sh4 architecture, mmaped address must be aligned on 16KB boundary
instead of getpagesize() when mmapping with MAP_SHARED|MAP_FIXED.

It will be needed a patch something like this.
I think my patch may not be correct. Please fix it in proper way.
Thanks.

--- locale/programs/locarchive.c.org    2009-06-13 23:54:47.000000000 +0900
+++ locale/programs/locarchive.c        2009-06-14 22:09:26.000000000 +0900
@@ -143,6 +143,9 @@
       reserved = total;
     }
  
+#ifdef __SH4__
+  p = ((int)p + 0x4000) & ~(0x4000 -1);
+#endif
   /* Map the header and all the administration data structures.  */
   p = mmap64 (p, total, PROT_READ | PROT_WRITE, MAP_SHARED | xflags, fd, 0);
   if (p == MAP_FAILED)
@@ -260,7 +263,13 @@
     return false;
  
   const size_t pagesz = getpagesize ();
-  size_t start = ah->mmaped & ~(pagesz - 1);
+#ifdef __SH4__
+#define SHM_ALIGN_SIZE 0x4000
+#else
+#define SHM_ALIGN_SIZE pagesz
+#endif
+//  size_t start = ah->mmaped & ~(pagesz - 1);
+  size_t start = ah->mmaped & ~(SHM_ALIGN_SIZE - 1);
   void *p = mmap64 (ah->addr + start, st.st_size - start,
                    PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED,
                    ah->fd, start);
@@ -405,6 +414,9 @@
       reserved = total;
     }
  
+#ifdef __SH4__
+  p = ((int)p + 0x4000) & ~(0x4000 -1);
+#endif
   /* Map the header and all the administration data structures.  */
   p = mmap64 (p, total, PROT_READ | PROT_WRITE, MAP_SHARED | xflags, fd, 0);

-- 
           Summary: localedef fails to generate locale-archive on SH4 arch
           Product: glibc
           Version: 2.10
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: masaki dot chikama at gmail dot com
                CC: glibc-bugs at sources dot redhat dot com
 GCC build triplet: sh4-redhat-linux
  GCC host triplet: sh4-redhat-linux
GCC target triplet: sh4-redhat-linux


http://sourceware.org/bugzilla/show_bug.cgi?id=10283

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/10283] localedef fails to generate locale-archive on SH4 arch
  2009-06-15 10:12 [Bug libc/10283] New: localedef fails to generate locale-archive on SH4 arch masaki dot chikama at gmail dot com
@ 2009-06-15 14:03 ` drepper at redhat dot com
  2009-06-16 10:12 ` masaki dot chikama at gmail dot com
  1 sibling, 0 replies; 8+ messages in thread
From: drepper at redhat dot com @ 2009-06-15 14:03 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2009-06-15 14:03 -------
(In reply to comment #0)
> The failed point is mmap64() in locale/programs/locarchive.c .
> On sh4 architecture, mmaped address must be aligned on 16KB boundary
> instead of getpagesize() when mmapping with MAP_SHARED|MAP_FIXED.

Then fix the kernel.  It is ridiculous to make such a change since all of
userland expects page-size alignment to be sufficient.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX


http://sourceware.org/bugzilla/show_bug.cgi?id=10283

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/10283] localedef fails to generate locale-archive on SH4 arch
  2009-06-15 10:12 [Bug libc/10283] New: localedef fails to generate locale-archive on SH4 arch masaki dot chikama at gmail dot com
  2009-06-15 14:03 ` [Bug libc/10283] " drepper at redhat dot com
@ 2009-06-16 10:12 ` masaki dot chikama at gmail dot com
  1 sibling, 0 replies; 8+ messages in thread
From: masaki dot chikama at gmail dot com @ 2009-06-16 10:12 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From masaki dot chikama at gmail dot com  2009-06-16 10:12 -------
 According to this[1] thread, there are many architectures which need 
special alignment other than pagesize when mmapping with MAP_SHARED|MAP_FIXED.
They are sparc, parisc, m68k, mips, sh and a part of arm.
Do you have no interest in these arches ?

By the way, current sparc kernel still has this limitation and
hits the same problem[2] as mine.

[1] http://lkml.org/lkml/2003/8/29/6
[2] http://sparc.koji.fedoraproject.org/koji/getfile?taskID=174754&name=build.log

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=10283

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/10283] localedef fails to generate locale-archive on SH4 arch
       [not found] <bug-10283-131@http.sourceware.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2013-06-26 16:50 ` vapier at gentoo dot org
@ 2014-07-01 16:37 ` fweimer at redhat dot com
  4 siblings, 0 replies; 8+ messages in thread
From: fweimer at redhat dot com @ 2014-07-01 16:37 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=10283

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|                            |security-

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

* [Bug libc/10283] localedef fails to generate locale-archive on SH4 arch
       [not found] <bug-10283-131@http.sourceware.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2013-05-23 16:47 ` vapier at gentoo dot org
@ 2013-06-26 16:50 ` vapier at gentoo dot org
  2014-07-01 16:37 ` fweimer at redhat dot com
  4 siblings, 0 replies; 8+ messages in thread
From: vapier at gentoo dot org @ 2013-06-26 16:50 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=10283

Mike Frysinger <vapier at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Mike Frysinger <vapier at gentoo dot org> ---
should be fixed in master (for glibc-2.18) with these three commits:
http://sourceware.org/git/?p=glibc.git;a=commit;h=d605071ebf1fbbba5998a349540d4ad4e667f65e
http://sourceware.org/git/?p=glibc.git;a=commit;h=17db6e8d6b12f55e312fcab46faf5d332c806fb6
http://sourceware.org/git/?p=glibc.git;a=commit;h=1d17fa5f8e3d5fb84d9b944d5fe3712cde83db48

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

* [Bug libc/10283] localedef fails to generate locale-archive on SH4 arch
       [not found] <bug-10283-131@http.sourceware.org/bugzilla/>
  2013-05-23  4:56 ` vapier at gentoo dot org
  2013-05-23 12:33 ` carlos at redhat dot com
@ 2013-05-23 16:47 ` vapier at gentoo dot org
  2013-06-26 16:50 ` vapier at gentoo dot org
  2014-07-01 16:37 ` fweimer at redhat dot com
  4 siblings, 0 replies; 8+ messages in thread
From: vapier at gentoo dot org @ 2013-05-23 16:47 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=10283

Mike Frysinger <vapier at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://bugs.gentoo.org/sho
                   |                            |w_bug.cgi?id=471020
   Target Milestone|---                         |2.18

--- Comment #5 from Mike Frysinger <vapier at gentoo dot org> 2013-05-23 16:47:23 UTC ---
i'll post an updated patch shortly

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/10283] localedef fails to generate locale-archive on SH4 arch
       [not found] <bug-10283-131@http.sourceware.org/bugzilla/>
  2013-05-23  4:56 ` vapier at gentoo dot org
@ 2013-05-23 12:33 ` carlos at redhat dot com
  2013-05-23 16:47 ` vapier at gentoo dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: carlos at redhat dot com @ 2013-05-23 12:33 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=10283

--- Comment #4 from Carlos O'Donell <carlos at redhat dot com> 2013-05-23 12:33:14 UTC ---
(In reply to comment #3)
> this is still happening on parisc, and i suspect it'll happen on other arches
> like sparc and sh4
> 
> is the correct fix to use the SHMBLA define rather than getpagesize() ?

Yes, that's right.

The kernel is never going to change. 

There is both a correctness and performance issue.

You can't expect MAP_FIXED to work correctly and quickly unless you follow
certain per-architecture rules.

In this case it's correct to map at intervals of SHMLBA.

This still impacts parisc, sh, mips, arm and sparc.

I'd accept a patch that does that.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/10283] localedef fails to generate locale-archive on SH4 arch
       [not found] <bug-10283-131@http.sourceware.org/bugzilla/>
@ 2013-05-23  4:56 ` vapier at gentoo dot org
  2013-05-23 12:33 ` carlos at redhat dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: vapier at gentoo dot org @ 2013-05-23  4:56 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=10283

Mike Frysinger <vapier at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |carlos at redhat dot com,
                   |                            |davem at davemloft dot net,
                   |                            |vapier at gentoo dot org
         Resolution|WONTFIX                     |
         AssignedTo|drepper.fsp at gmail dot    |unassigned at sourceware
                   |com                         |dot org

--- Comment #3 from Mike Frysinger <vapier at gentoo dot org> 2013-05-23 04:56:23 UTC ---
this is still happening on parisc, and i suspect it'll happen on other arches
like sparc and sh4

is the correct fix to use the SHMBLA define rather than getpagesize() ?

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

end of thread, other threads:[~2014-07-01 16:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-15 10:12 [Bug libc/10283] New: localedef fails to generate locale-archive on SH4 arch masaki dot chikama at gmail dot com
2009-06-15 14:03 ` [Bug libc/10283] " drepper at redhat dot com
2009-06-16 10:12 ` masaki dot chikama at gmail dot com
     [not found] <bug-10283-131@http.sourceware.org/bugzilla/>
2013-05-23  4:56 ` vapier at gentoo dot org
2013-05-23 12:33 ` carlos at redhat dot com
2013-05-23 16:47 ` vapier at gentoo dot org
2013-06-26 16:50 ` vapier at gentoo dot org
2014-07-01 16:37 ` fweimer at redhat dot com

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).