Debian Bug report logs - #681760
busybox: broken on s390x due to alignment issues

version graph

Package: busybox; Maintainer for busybox is Debian Install System Team <debian-boot@lists.debian.org>; Source for busybox is src:busybox.

Reported by: Aurelien Jarno <aurel32@debian.org>

Date: Mon, 16 Jul 2012 09:00:01 UTC

Severity: critical

Tags: d-i, patch, upstream

Found in version busybox/1:1.20.0-5

Fixed in version busybox/1:1.20.0-6

Done: Michael Tokarev <mjt@tls.msk.ru>

Bug is archived. No further changes may be made.

Forwarded to http://lists.busybox.net/pipermail/busybox/2012-July/078155.html

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#681760; Package busybox. (Mon, 16 Jul 2012 09:00:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Aurelien Jarno <aurel32@debian.org>:
New Bug report received and forwarded. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Mon, 16 Jul 2012 09:00:04 GMT) Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Aurelien Jarno <aurel32@debian.org>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: busybox: broken on s390x due to alignment issues
Date: Mon, 16 Jul 2012 10:57:26 +0200
Package: busybox
Version: 1:1.20.0-5
Severity: critical
Tags: d-i upstream patch

busybox is currently broken on s390x to the point of not being usable.
Depending on the configuration, some strings are replaced by empty 
strings. For the current version 1:1.20.0-5, this is the case of at 
least for the banner and the binary path, the later causing all exec
applets to fail to execute. In turns this renders the system 
unbootable:

| $ busybox sh
|
|
|  built-in shell (ash)
| Enter 'help' for a list of built-in commands.
| 
| $ switch_root
| sh: switch_root: not found

busybox-udeb is also affected, I haven't tried yet the impact on d-i, 
but at least essential applets like swapon, syslogd, realpath or uname
are not working.

This is due to aggressive size optimization by chaning the default 
strings alignement in the definitions of the strings in 
libbb/messages.c. Given it is not done in the corresponding declarations
in include/libbb.h, the compiler is free to optimize the access to these
constants with aligned access, which is what GCC does on s390x. This is
why the bug appears and disappears from version to version, as the issue
depends on the size of neighbouring constants and variables.

The patch below, also submitted upstream and adapted to the debian 
package (due to changes in shell-ash-export-HOME.patch) fixes the 
problem.



include/libbb.h: declare messages with ALIGN1

Some messages strings are defined with ALIGN1 in libbb/messages.c
to make sure strings are not aligned and thus to save some bytes. The
corresponding declaration in include/libbb.h should also use ALIGN1,
otherwise the compiler may assume they are aligned and generate wrong
code to access them. This is the case on at least s390x.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 include/libbb.h |   36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/include/libbb.h b/include/libbb.h
index 322a28c..f22e58e 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -1612,8 +1612,8 @@ unsigned get_cpu_count(void) FAST_FUNC;
 char *percent_decode_in_place(char *str, int strict) FAST_FUNC;
 
 
-extern const char bb_uuenc_tbl_base64[];
-extern const char bb_uuenc_tbl_std[];
+extern const char bb_uuenc_tbl_base64[] ALIGN1;
+extern const char bb_uuenc_tbl_std[] ALIGN1;
 void bb_uuencode(char *store, const void *s, int length, const char *tbl) FAST_FUNC;
 enum {
 	BASE64_FLAG_UU_STOP = 0x100,
@@ -1694,24 +1694,24 @@ extern const char *applet_name;
  * Therefore now we use #defines.
  */
 /* "BusyBox vN.N.N (timestamp or extra_version)" */
-extern const char bb_banner[];
-extern const char bb_msg_memory_exhausted[];
-extern const char bb_msg_invalid_date[];
+extern const char bb_banner[] ALIGN1;
+extern const char bb_msg_memory_exhausted[] ALIGN1;
+extern const char bb_msg_invalid_date[] ALIGN1;
 #define bb_msg_read_error "read error"
 #define bb_msg_write_error "write error"
-extern const char bb_msg_unknown[];
-extern const char bb_msg_can_not_create_raw_socket[];
-extern const char bb_msg_perm_denied_are_you_root[];
-extern const char bb_msg_you_must_be_root[];
-extern const char bb_msg_requires_arg[];
-extern const char bb_msg_invalid_arg[];
-extern const char bb_msg_standard_input[];
-extern const char bb_msg_standard_output[];
+extern const char bb_msg_unknown[] ALIGN1;
+extern const char bb_msg_can_not_create_raw_socket[] ALIGN1;
+extern const char bb_msg_perm_denied_are_you_root[] ALIGN1;
+extern const char bb_msg_you_must_be_root[] ALIGN1;
+extern const char bb_msg_requires_arg[] ALIGN1;
+extern const char bb_msg_invalid_arg[] ALIGN1;
+extern const char bb_msg_standard_input[] ALIGN1;
+extern const char bb_msg_standard_output[] ALIGN1;
 
 /* NB: (bb_hexdigits_upcase[i] | 0x20) -> lowercase hex digit */
-extern const char bb_hexdigits_upcase[];
+extern const char bb_hexdigits_upcase[] ALIGN1;
 
-extern const char bb_path_wtmp_file[];
+extern const char bb_path_wtmp_file[] ALIGN1;
 
 /* Busybox mount uses either /proc/mounts or /etc/mtab to
  * get the list of currently mounted filesystems */
@@ -1725,10 +1725,10 @@ extern const char bb_path_wtmp_file[];
 #define bb_path_motd_file "/etc/motd"
 
 #define bb_dev_null "/dev/null"
-extern const char bb_busybox_exec_path[];
+extern const char bb_busybox_exec_path[] ALIGN1;
 /* util-linux manpage says /sbin:/bin:/usr/sbin:/usr/bin,
  * but I want to save a few bytes here */
-extern char bb_PATH_root_path[]; /* "PATH=/sbin:/usr/sbin:/bin:/usr/bin" */
+extern char bb_PATH_root_path[] ALIGN1; /* "PATH=/sbin:/usr/sbin:/bin:/usr/bin" */
 #define bb_default_root_path (bb_PATH_root_path + sizeof("PATH"))
 #define bb_default_path      (bb_PATH_root_path + sizeof("PATH=/sbin:/usr/sbin"))
 
@@ -1758,7 +1758,7 @@ extern struct globals *const ptr_to_globals;
  * If you change LIBBB_DEFAULT_LOGIN_SHELL,
  * don't forget to change increment constant. */
 #define LIBBB_DEFAULT_LOGIN_SHELL  "-/bin/sh"
-extern const char bb_default_login_shell[];
+extern const char bb_default_login_shell[] ALIGN1;
 /* "/bin/sh" */
 #define DEFAULT_SHELL              (bb_default_login_shell+1)
 /* "sh" */

-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: s390x

Kernel: Linux 3.2.0-3-s390x (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages busybox depends on:
ii  libc6  2.13-33

busybox recommends no packages.

busybox suggests no packages.

-- no debconf information



Information forwarded to debian-bugs-dist@lists.debian.org, Debian Install System Team <debian-boot@lists.debian.org>:
Bug#681760; Package busybox. (Tue, 17 Jul 2012 05:21:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Michael Tokarev <mjt@tls.msk.ru>:
Extra info received and forwarded to list. Copy sent to Debian Install System Team <debian-boot@lists.debian.org>. (Tue, 17 Jul 2012 05:21:03 GMT) Full text and rfc822 format available.

Message #10 received at 681760@bugs.debian.org (full text, mbox):

From: Michael Tokarev <mjt@tls.msk.ru>
To: Aurelien Jarno <aurel32@debian.org>, 681760@bugs.debian.org
Subject: Re: Bug#681760: busybox: broken on s390x due to alignment issues
Date: Tue, 17 Jul 2012 09:14:05 +0400
forwarded 681760 http://lists.busybox.net/pipermail/busybox/2012-July/078155.html
tags 681760 + pending
thanks

On 16.07.2012 12:57, Aurelien Jarno wrote:

> busybox is currently broken on s390x to the point of not being usable.
> Depending on the configuration, some strings are replaced by empty 
> strings. For the current version 1:1.20.0-5, this is the case of at 
> least for the banner and the binary path, the later causing all exec
> applets to fail to execute. In turns this renders the system 
> unbootable:
[]
> This is due to aggressive size optimization by chaning the default 
> strings alignement in the definitions of the strings in 
> libbb/messages.c. Given it is not done in the corresponding declarations
> in include/libbb.h, the compiler is free to optimize the access to these
> constants with aligned access, which is what GCC does on s390x. This is
> why the bug appears and disappears from version to version, as the issue
> depends on the size of neighbouring constants and variables.
> 
> The patch below, also submitted upstream and adapted to the debian 
> package (due to changes in shell-ash-export-HOME.patch) fixes the 
> problem.

Thank you for the excellent bugreport.  If you ask me, I'd say the whole
thing - killing alignment - is not worth the effort here, it saves a
few bytes but may cost much more, like is demonstrated by this very
issue, so I'd just remove the ALIGN1 marker.  Also, I'd say it is a
bug in GCC, since it produces no warning when declaration and definition
of the same variable are different and may produce different results.

As for the patch, I'd use the same patch as sent to upstream, and adapt
the ash-export-HOME instead, since it is already debian-specific.  But
I'm not sure what's better for the release team.  I'll ask around.

Thanks you!

/mjt



Set Bug forwarded-to-address to 'http://lists.busybox.net/pipermail/busybox/2012-July/078155.html'. Request was from Michael Tokarev <mjt@tls.msk.ru> to control@bugs.debian.org. (Tue, 17 Jul 2012 05:21:05 GMT) Full text and rfc822 format available.

Added tag(s) pending. Request was from Michael Tokarev <mjt@tls.msk.ru> to control@bugs.debian.org. (Tue, 17 Jul 2012 05:21:06 GMT) Full text and rfc822 format available.

Reply sent to Michael Tokarev <mjt@tls.msk.ru>:
You have taken responsibility. (Sun, 22 Jul 2012 08:51:09 GMT) Full text and rfc822 format available.

Notification sent to Aurelien Jarno <aurel32@debian.org>:
Bug acknowledged by developer. (Sun, 22 Jul 2012 08:51:10 GMT) Full text and rfc822 format available.

Message #19 received at 681760-close@bugs.debian.org (full text, mbox):

From: Michael Tokarev <mjt@tls.msk.ru>
To: 681760-close@bugs.debian.org
Subject: Bug#681760: fixed in busybox 1:1.20.0-6
Date: Sun, 22 Jul 2012 08:48:10 +0000
Source: busybox
Source-Version: 1:1.20.0-6

We believe that the bug you reported is fixed in the latest version of
busybox, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 681760@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Michael Tokarev <mjt@tls.msk.ru> (supplier of updated busybox package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.8
Date: Sun, 22 Jul 2012 12:30:02 +0400
Source: busybox
Binary: busybox busybox-static busybox-udeb busybox-syslogd udhcpc udhcpd
Architecture: source all i386
Version: 1:1.20.0-6
Distribution: unstable
Urgency: low
Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
Changed-By: Michael Tokarev <mjt@tls.msk.ru>
Description: 
 busybox    - Tiny utilities for small and embedded systems
 busybox-static - Standalone rescue shell with tons of builtin utilities
 busybox-syslogd - Provides syslogd and klogd using busybox
 busybox-udeb - Tiny utilities for the debian-installer (udeb)
 udhcpc     - Provides the busybox DHCP client implementation
 udhcpd     - Provides the busybox DHCP server implementation
Closes: 681760
Changes: 
 busybox (1:1.20.0-6) unstable; urgency=low
 .
   * reorder patches in debian/patches/series: all upstream first,
     debian-specific next.  cmp(1) shows no changes in the resulting
     sources (after applying patches both ways)
   * dont-force-no-alignment-for-s390.patch: do not use ALIGN* macros
     on s390 and s390x because gcc generates wrong code (for wrong
     declarations).  No effect for anything but s390(x), where the
     resulting package does not work anyway. (Closes: 681760)
Checksums-Sha1: 
 2e7e47af2f3039b4861fe7e8b31ea3d9082583f3 1610 busybox_1.20.0-6.dsc
 c243a2b3d132788659524f718b62e3d5006ef497 55507 busybox_1.20.0-6.debian.tar.gz
 07890944891f2e93e1bd29b3f26b8d124184b93d 20018 busybox-syslogd_1.20.0-6_all.deb
 5b6e14178612619946d96ad23662b02d51cafc5e 876228 busybox-static_1.20.0-6_i386.deb
 98a4b45904d05a6fabde36408ce5f932768df4b6 440120 busybox_1.20.0-6_i386.deb
 a60ee8c0c8432be01f92b70a153d57d69272034b 17684 udhcpc_1.20.0-6_i386.deb
 dcedca1bbe88dfd76fe090d78f61752c48236b15 20992 udhcpd_1.20.0-6_i386.deb
 4937bd41affcd3b9b947c8450b27a764ac60a764 176444 busybox-udeb_1.20.0-6_i386.udeb
Checksums-Sha256: 
 445c7512e34809b9b924ca74526f8c49fdb0e22b1669e045427a355235c840a2 1610 busybox_1.20.0-6.dsc
 6851b3bc689cb3e8e408dce3165bfeccb189ee292984d94d54d1cd30664ae273 55507 busybox_1.20.0-6.debian.tar.gz
 b29cb9179fae44984e744ee93a9dca54a4e62115310e0964878cd46be304f663 20018 busybox-syslogd_1.20.0-6_all.deb
 62a4f09a00fca6a453ce27ab93631c317da02994a743f3c9a2cf8a9c8103a93d 876228 busybox-static_1.20.0-6_i386.deb
 d3632b40f3e02b7854e8aa83bdf6a0ec68290f9665bf7168eef938846a72af6b 440120 busybox_1.20.0-6_i386.deb
 d8871c2b69e8a25d3648c8d51ee254b12cc5f8a1751bf63a560dbe2922dd9564 17684 udhcpc_1.20.0-6_i386.deb
 c09249a5856a8250db88ab0dcefe4dabbf35a14474b3f290fc5986f867f0cc63 20992 udhcpd_1.20.0-6_i386.deb
 a9c0b75f7397c34b0f15118d2e1ffe2398a3d37e5de096d16d46c4a863de7765 176444 busybox-udeb_1.20.0-6_i386.udeb
Files: 
 a4af644d81442c0a4d95af0bc4f72504 1610 utils optional busybox_1.20.0-6.dsc
 cbec396a741b13c255df5841f62b40bb 55507 utils optional busybox_1.20.0-6.debian.tar.gz
 f7d84c2186b1e98955152e9642ff14fb 20018 utils optional busybox-syslogd_1.20.0-6_all.deb
 8a1ba6358dd0fe795f6a81fe69ad569c 876228 shells extra busybox-static_1.20.0-6_i386.deb
 06539c4f97f2798e526370f3e9a74049 440120 utils optional busybox_1.20.0-6_i386.deb
 63adc8d61705072c7b9a9dd9f6f7d92e 17684 net optional udhcpc_1.20.0-6_i386.deb
 dee428a5e5e215af9229fd50282baf4e 20992 net optional udhcpd_1.20.0-6_i386.deb
 0ebc3dc34d1b1becd9dbbf5e30762c23 176444 debian-installer extra busybox-udeb_1.20.0-6_i386.udeb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iJwEAQECAAYFAlALussACgkQUlPFrXTwyDgRfAP8CUDjktMJKsq4x9DH53WLed5c
QxZojFq4PVZ1Vlz7PKiMw4cToDoeCdOyBmTitzbtqu73qaZTa2W1Ezs7lWLTbz4D
y0mdJ1a3zsnXMVa0HWKEmLqJ+RtTNc+jT3XNLuKynWESBxg1h5GUS+rXdL7t5G2Q
FBaqMIDUrQKKMfU7ZiI=
=nhBr
-----END PGP SIGNATURE-----




Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Tue, 04 Sep 2012 07:29:03 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Wed Apr 23 14:57:19 2014; Machine Name: buxtehude.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.