On Fri, Jan 19, 2018 at 10:58 AM, Chris Boot <bo...@debian.org> wrote: > On 18/01/18 23:44, Cyril Brulebois wrote: >> Raphael Hertzog <hert...@debian.org> (2018-01-17): >>> On Wed, 17 Jan 2018, Aurelien Jarno wrote: >>>> busybox is compiled with -mpreferred-stack-boundary=2 on i386 which has >>>> the same effect of reducing the default stack alignment from 16 bytes to >>>> 2 bytes. This comes from arch/i386/Makefile: >>>> >>>> | # -mpreferred-stack-boundary=2 is essential in preventing gcc 4.2.x >>>> | # from aligning stack to 16 bytes. (Which is gcc's way of supporting >>>> SSE). >>>> | CFLAGS += $(call cc-option,-march=i386 -mpreferred-stack-boundary=2,) >>>> >>>> I don't really get why it is essential to prevent gcc from aligning >>>> stack to 16 bytes, anyway this is a bad idea. Removing this option just >>>> fixes the issue. > > Hi all, > > I've added the busybox mailing list and Denys Vlasenko. Denys: can you > explain in more detail why this is/was necessary and whether it's > sensible to remove this these days, given the issues it seems to cause? > >> Oh wow, that's an old commit: >> | commit 65b8cfb2a0b6854271dbd8baf5203896223cd4ce >> | Author: Denis Vlasenko <vda.li...@googlemail.com> >> | Date: Mon Jul 23 21:05:06 2007 +0000 >> | >> | add comment why preferred stack boundary is 4 on i386 >> >>> I confirm that rebuilding busybox with this option dropped fixed the issue >>> for me. I uploaded a fixed busybox to Kali. I'm happy to do the same for >>> Debian if it can help the current maintainers. >> >> Fixing it ASAP would look good to me (unless you here differently from >> Chris or Christoph); it would be great to ping upstream to propagate >> Aurélien's comments too. > > I'd like to get a response from Denys about this first but I don't have > any particular objection to patching this for Debian; I just want to > understand better why this was done upstream before simply reverting it.
It adds stack alignment code to almost every function, with ~3.5% size growth. If function already has locals, this takes the form of allocating more local space (to make stack aligned to 16 bytes), which in turn makes some instruction longer. Example: <machtime_stream>: 53 push %ebx -83 ec 04 sub $0x4,%esp 89 c3 mov %eax,%ebx +83 ec 18 sub $0x18,%esp e8 fc ff ff ff call 7 <machtime_stream+0x7> R_386_PC32 .text.machtime -89 04 24 mov %eax,(%esp) -89 e2 mov %esp,%edx +8d 54 24 14 lea 0x14(%esp),%edx b9 04 00 00 00 mov $0x4,%ecx +89 44 24 14 mov %eax,0x14(%esp) 89 d8 mov %ebx,%eax -e8 fc ff ff ff call 18 <machtime_stream+0x18> +e8 fc ff ff ff call 1b <machtime_stream+0x1b> R_386_PC32 full_write -58 pop %eax +83 c4 18 add $0x18,%esp 5b pop %ebx c3 ret "make bloatcheck": function old new delta hdparm_main 4582 4948 +366 identify 4386 4682 +296 wget_main 2601 2831 +230 bootchartd_main 1798 1974 +176 make_device 2183 2339 +156 handle_incoming_and_exit 2860 3008 +148 common_traceroute_main 3712 3858 +146 redirect 1121 1264 +143 evaluate 3487 3625 +138 udhcpc_main 2706 2843 +137 getty_main 1549 1680 +131 mkfs_ext2_main 2599 2727 +128 do_cmd 4466 4593 +127 process_files 2239 2365 +126 ife_print 1287 1413 +126 syslogd_main 1946 2070 +124 unzip_main 2709 2832 +123 sv 1309 1432 +123 parse_stream 2683 2800 +117 fdisk_main 2844 2961 +117 exec_builtin 1488 1603 +115 dpkg_main 2935 3046 +111 setpriv_main 954 1064 +110 update_passwd 1435 1542 +107 read_line_input 2478 2582 +104 mount_main 1234 1337 +103 copy_file 1673 1774 +101 colon 2893 2994 +101 run_pipe 1600 1700 +100 arp_main 1903 2003 +100 fsck_minix_main 3017 3115 +98 fsck_main 1812 1909 +97 ed_main 2344 2441 +97 singlemount 1129 1224 +95 i2cdetect_main 1224 1319 +95 complete_cmd_dir_file 767 859 +92 common_ping_main 1773 1865 +92 mdev_main 1346 1437 +91 login_main 1156 1245 +89 print_linkinfo 821 908 +87 udhcpd_main 1467 1553 +86 do_iplink 2370 2456 +86 arping_main 1787 1873 +86 parse_args 1426 1511 +85 dd_main 1552 1637 +85 brctl_main 1210 1295 +85 logdir_open 1230 1312 +82 pstm_div 1438 1517 +79 dump_identity 986 1065 +79 data_extract_all 981 1060 +79 time_main 1090 1168 +78 tcpudpsvd_main 1774 1852 +78 kill_main 965 1043 +78 crond_main 1149 1227 +78 pstm_exptmod 1416 1493 +77 load_crontab 928 1005 +77 acpid_main 1178 1255 +77 mkfs_minix_main 2657 2733 +76 inflate_unzip_internal 1944 2020 +76 ifupdown_main 1122 1197 +75 do_iproute 2214 2289 +75 dolisten 942 1016 +74 i2cdump_main 1516 1589 +73 fbset_main 1482 1555 +73 diffreg 1371 1444 +73 chat_main 1242 1315 +73 runsvdir_main 692 764 +72 lpqr_main 1095 1167 +72 less_main 2493 2565 +72 init_main 745 817 +72 start_stop_daemon_main 1012 1083 +71 slattach_main 621 692 +71 runsv_main 1643 1714 +71 print_stat 864 935 +71 iostat_main 1949 2019 +70 expand_one_var 1638 1708 +70 od_main 2585 2654 +69 ifconfig_main 1129 1198 +69 sha512_process_block128 1137 1205 +68 remove_file 556 624 +68 popmaildir_main 808 876 +68 get_header_cpio 933 1001 +68 zcip_main 1281 1348 +67 read_interfaces 1135 1201 +66 unpack_lzma_stream 1482 1547 +65 print_route 1656 1721 +65 patch_main 1987 2051 +64 parse 1058 1122 +64 crontab_main 565 629 +64 bb_verror_msg 466 530 +64 man_main 853 916 +63 grep_file 1284 1347 +63 writeFileToTarball 1326 1387 +61 print_intel_cstates 511 572 +61 parse_one_line 893 954 +61 add_cmd 1181 1242 +61 send_cgi_and_exit 845 905 +60 script_main 1083 1143 +60 powertop_main 1433 1493 +60 i2cset_main 1281 1341 +60 dnsd_main 1303 1363 +60 udhcp_run_script 803 862 +59 send_file_and_exit 786 845 +59 head_main 819 878 +59 fdformat_main 547 606 +59 fbsplash_main 1248 1307 +59 ubi_tools_main 1272 1330 +58 rtnl_talk 536 594 +58 more_main 715 773 +58 hush_main 980 1038 +58 mpstat_main 1246 1303 +57 hexedit_main 1145 1202 +57 date_main 846 903 +57 argstr 1138 1195 +57 adduser_main 865 922 +57 tail_main 1673 1729 +56 print_neigh 878 934 +56 ftpd_main 2238 2294 +56 print_addrinfo 1170 1225 +55 ifplugd_main 1134 1189 +55 display_single 880 935 +55 bbunpack 776 831 +55 nandwrite_main 1058 1112 +54 get_header_tar 1803 1857 +54 df_main 1053 1107 +54 psRsaEncryptPub 419 472 +53 passwd_main 984 1037 +53 makedevs_main 1031 1084 +53 main 760 813 +53 parse_conf 1456 1508 +52 diff_main 1337 1389 +52 bb_displayroutes 457 509 +52 svstatus_print 349 400 +51 last_main 876 927 +51 ipcs_main 1041 1092 +51 handle_dir_common 360 411 +51 getopt_main 621 672 +51 do_msg 782 833 +51 print_tunnel 567 617 +50 ln_main 511 561 +50 cut_main 954 1004 +50 compressStream 534 584 +50 recursive_action 463 512 +49 process_module 811 860 +49 input_tab 1104 1153 +49 sulogin_main 258 306 +48 shell_builtin_read 1327 1375 +48 set_loop 653 701 +48 hexdump_main 611 659 +48 write_status_file 1075 1122 +47 netstat_main 530 577 +47 lpd_main 742 789 +47 unpack_xz_stream 2397 2443 +46 switch_root_main 726 772 +46 sendmail_main 1196 1242 +46 readwrite 656 702 +46 lzo_decompress 524 570 +46 klogd_main 506 552 +46 hostname_main 259 305 +46 compare_keys 695 741 +46 xmalloc_follow_symlinks 147 192 +45 shred_main 356 401 +45 microcom_main 702 747 +45 expand_vars_to_list 1157 1202 +45 do_iprule 1010 1055 +45 logread_main 476 520 +44 check 404 448 +44 ash_main 1104 1148 +44 add_remove_shell_main 294 338 +44 xstrtoull_range_sfx 294 337 +43 scan_and_display_dirs_recur 489 532 +43 rotate 547 590 +43 processorstop 435 478 +43 mkfs_vfat_main 1479 1522 +43 do_shm 883 926 +43 whois_main 665 707 +42 tftp_protocol 1844 1886 +42 sed_main 686 728 +42 procps_scan 1096 1138 +42 nohup_main 220 262 +42 nmeter_main 736 778 +42 evalpipe 362 404 +42 dhcprelay_main 943 985 +42 addgroup_main 403 445 +42 rmoldest 307 348 +41 ntpd_main 1200 1241 +41 inetd_main 2063 2104 +41 dos2unix_main 426 467 +41 bb_make_directory 419 460 +41 tls_handshake 1607 1647 +40 logdir_close 190 230 +40 ipcalc_main 537 577 +40 hwclock_main 405 445 +40 get_boot 1687 1727 +40 sysctl_act_on_setting 464 503 +39 sort_main 788 827 +39 print_it 206 245 +39 get_terminal_width_height 231 270 +39 evalcommand 1420 1459 +39 run_applet_and_exit 683 721 +38 rtcwake_main 452 490 +38 chpst_main 694 732 +38 add_split_dependencies 691 729 +38 update_status 602 639 +37 handle_upload_common 329 366 +37 find_mount_point 289 326 +37 ether_wake_main 737 774 +37 cbq_print_opt 517 554 +37 awk_sub 560 597 +37 xrtnl_dump_filter 399 435 +36 smtp_checkp 166 202 +36 rewrite 978 1014 +36 buffer_pwrite 499 535 +36 who_main 469 504 +35 stty_main 1207 1242 +35 showkey_main 509 544 +35 rpm_main 1062 1097 +35 print_qdisc 474 509 +35 display_process_list 1287 1322 +35 cdcmd 680 715 +35 bb_progress_update 768 803 +35 bb_daemonize_or_rexec 205 240 +35 INET6_setroute 511 546 +35 umount_main 555 589 +34 tr_main 616 650 +34 timestamp_and_log 593 627 +34 send_headers 669 703 +34 run_script 276 310 +34 rdate_main 236 270 +34 procps_read_smaps 1012 1046 +34 parse_url 409 443 +34 parse_datestr 907 941 +34 nbdclient_main 498 532 +34 nameif_main 686 720 +34 do_load 949 983 +34 chpasswd_main 298 332 +34 wc_main 615 648 +33 udhcp_read_interface 324 357 +33 telnet_main 1582 1615 +33 setup_heredoc 312 345 +33 setjobctl 351 384 +33 print_statfs 346 379 +33 ntp_init 466 499 +33 nc_main 1022 1055 +33 ipneigh_list_or_flush 720 753 +33 do_time 448 481 +33 do_ipaddr 1375 1408 +33 collect_mem 339 372 +33 cal_main 902 935 +33 awk_main 947 980 +33 udhcp_recv_raw_packet 580 612 +32 tar_main 974 1006 +32 swap_on_off_main 418 450 +32 spawn_https_helper_openssl 441 473 +32 parse_dollar 831 863 +32 httpd_main 732 764 +32 execute 560 592 +32 create_J 1953 1985 +32 check_user_passwd 485 517 +32 arpping 493 525 +32 write_stats_core 1283 1314 +31 write_irqcpu_stats 649 680 +31 uniq_main 445 476 +31 uevent_main 409 440 +31 str2sockaddr 532 563 +31 scan_recursive 380 411 +31 reread_config_file 851 882 +31 readprofile_main 1793 1824 +31 read_cstate_counts 360 391 +31 pstm_div_2d 408 439 +31 list_table 585 616 +31 expandarg 957 988 +31 env_main 191 222 +31 du 420 451 +31 delete_contents 191 222 +31 cmp_main 667 698 +31 bb_dump_dump 1476 1507 +31 warn_geometry 113 143 +30 pack_lzop 867 897 +30 menu 167 197 +30 md5_sha1_sum_main 528 558 +30 log_locally 432 462 +30 expand_main 673 703 +30 eval6 547 577 +30 do_if_fetch 756 786 +30 cttyhack_main 357 387 +30 su_main 491 520 +29 resume_main 495 524 +29 mktemp_main 190 219 +29 if_readlist_proc 610 639 +29 format_line 212 241 +29 do_iptunnel 980 1009 +29 cpio_o 832 861 +29 change_listen_mode 321 350 +29 bb_ask 311 340 +29 attach_option 413 442 +29 xargs_main 798 826 +28 test_main 408 436 +28 setup_redirects 314 342 +28 route_main 617 645 +28 ps_main 543 571 +28 printf_main 877 905 +28 pgetc 571 599 +28 parse_and_put_prompt 777 805 +28 load_history 251 279 +28 i2cget_main 370 398 +28 huft_build 1306 1334 +28 glob_brace 402 430 +28 forkchild 609 637 +28 find_alias 652 680 +28 test_version 284 311 +27 svlogd_main 1379 1406 +27 read_int 529 556 +27 print_login_issue 432 459 +27 make_new_session 487 514 +27 ls_main 548 575 +27 fuser_main 298 325 +27 fatattr_main 295 322 +27 dumpleases_main 529 556 +27 INET_setroute 778 805 +27 sysctl_act_recursive 163 189 +26 setvareq 294 320 +26 setserial_main 1116 1142 +26 run_list 1258 1284 +26 run_applet_no_and_exit 439 465 +26 open_list_and_close 343 369 +26 get_volume_size_in_bytes 228 254 +26 fork_job 456 482 +26 encode_base64 240 266 +26 xmalloc_open_zipped_read_close 141 166 +25 unset_local_var_len 204 229 +25 unix_do_one 484 509 +25 tc_main 934 959 +25 startservice 363 388 +25 split_main 533 558 +25 regex_process 313 338 +25 print_rule 676 701 +25 lzo_compress 473 498 +25 getgrouplist_internal 236 261 +25 get_address 218 243 +25 filter_rename_config 244 269 +25 do_rescan 467 492 +25 collect_cpu 593 618 +25 builtin_trap 414 439 +25 which_main 201 225 +24 uuencode_main 328 352 +24 step_time 345 369 +24 status 135 159 +24 sha_crypt 1184 1208 +24 run_command 174 198 +24 read_bunzip 1885 1909 +24 openvt_main 387 411 +24 init_exec 258 282 +24 id_main 468 492 +24 get_prefix 328 352 +24 get_console_fd_or_die 159 183 +24 find_block_device_in_dir 238 262 +24 expmeta 538 562 +24 edit_file 762 786 +24 dotcmd 296 320 +24 do_exec 309 333 +24 cp_main 360 384 +24 config_read 637 661 +24 update_local_clock 850 873 +23 telnetd_main 1775 1798 +23 print_perms 174 197 +23 pmap_main 275 298 +23 paste_main 511 534 +23 m_status_print 255 278 +23 lsscsi_main 326 349 +23 iproute_list_or_flush 1278 1301 +23 find_range 522 545 +23 file_insert 364 387 +23 eject_main 328 351 +23 data_extract_to_command 394 417 +23 conspy_main 1149 1172 +23 base64_main 213 236 +23 xxd_main 414 436 +22 watch_main 215 237 +22 timeout_main 269 291 +22 tftpd_main 572 594 +22 swap_enable_disable 267 289 +22 send_packet 168 190 +22 rtc_xopen 141 163 +22 rpm_gettags 485 507 +22 process_timer_stats 429 451 +22 mv_main 511 533 +22 install_main 754 776 +22 init 441 463 +22 helper_export_local 204 226 +22 generate_output 354 376 +22 find_pid_by_name 232 254 +22 filter_accept_list_reassign 188 210 +22 edir 344 366 +22 done_word 647 669 +22 builtin_unset 147 169 +22 basename_main 150 172 +22 write_block 427 448 +21 vfork_compressor 191 212 +21 uudecode_main 307 328 +21 unsafe_symlink_target 147 168 +21 trapcmd 268 289 +21 set_local_var 446 467 +21 scan_proc_net_or_maps 445 466 +21 rtc_tm2time 89 110 +21 retrieve_file_data 465 486 +21 restore_state_and_exit 117 138 +21 resize_main 210 231 +21 rescan_crontab_dir 137 158 +21 read_lines 635 656 +21 rdval 157 178 +21 pseudo_exec_argv 380 401 +21 process_stdin 320 341 +21 print_found 296 317 +21 print_class 361 382 +21 prepare_socket_fd 153 174 +21 poplocalvars 276 297 +21 parse_params 1499 1520 +21 mount_it_now 168 189 +21 lsof_main 181 202 +21 isrv_run 463 484 +21 inflate_codes 642 663 +21 handle_input 597 618 +21 fsck_device 427 448 +21 find_command 873 894 +21 fgetc_interactive 256 277 +21 evaltree 507 528 +21 deluser_main 328 349 +21 confirm_action 100 121 +21 ask 208 229 +21 vgetopt32 1422 1442 +20 unpack_gz_stream 588 608 +20 uname_main 253 273 +20 udhcp_str2optset 532 552 +20 setvar 172 192 +20 send_mail_command 89 109 +20 searchLines 165 185 +20 remove_file_array 149 169 +20 read_leases 332 352 +20 popfile 86 106 +20 pgrep_main 741 761 +20 parse_mount_options 229 249 +20 halt_main 343 363 +20 fsync_main 126 146 +20 fail_hunk 132 152 +20 do_sem 636 656 +20 dname_dec 313 333 +20 comm_main 239 259 +20 clean_up_cur_rule 96 116 +20 cksum_main 288 308 +20 check_and_run_traps 237 257 +20 builtin_set 281 301 +20 add_partition 1327 1347 +20 INET_rresolve 214 234 +20 xmalloc_optname_optval 863 882 +19 ... ...about 4000 lines skipped... ... aes_cbc_encrypt 663 664 +1 aes_cbc_decrypt 984 985 +1 undo_pop 222 221 -1 syntax 55 53 -2 power 50 47 -3 chargen_stream 132 129 -3 INET6_resolve 119 116 -3 prf_hmac_sha256 180 176 -4 printLines 184 179 -5 do_stats 211 206 -5 convert_to_struct 295 287 -8 select_and_cluster 1055 1043 -12 print_direc 438 422 -16 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2288/11 up/down: 35199/-62) Total: 35137 bytes