Age | Commit message (Collapse) | Author |
|
Double negatives are hard to grok.
function old new delta
login_main 986 988 +2
su_main 474 470 -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 2/-4) Total: -2 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
sulogin_main 341 331 -10
.rodata 104327 104312 -15
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-25) Total: -25 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Also, shorten/eliminate messages to be closer to util-linux.
function old new delta
packed_usage 34233 34238 +5
sulogin_main 340 341 +1
.rodata 104380 104327 -53
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 6/-53) Total: -47 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
__pgetc 501 522 +21
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Change to root's HOME. Set some envvars. Steal ctty if necessary and possible.
function old new delta
sulogin_main 240 340 +100
setup_environment 225 233 +8
su_main 479 474 -5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 108/-5) Total: 103 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
exec_login_shell - 12 +12
sulogin_main 247 240 -7
login_main 960 953 -7
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/2 up/down: 12/-14) Total: -2 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
pause_after_failed_login - 9 +9
vlock_main 358 353 -5
sulogin_main 252 247 -5
su_main 484 479 -5
passwd_main 936 931 -5
login_main 967 962 -5
bb_do_delay 68 - -68
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/5 up/down: 9/-93) Total: -84 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Back in 2007, commit 0c97c9d43707 ("'simple' error message functions by
Loic Grenie") introduced bb_simple_perror_msg() to allow for a lower
overhead call to bb_perror_msg() when only a string was being printed
with no parameters. This saves space for some CPU architectures because
it avoids the overhead of a call to a variadic function. However there
has never been a simple version of bb_error_msg(), and since 2007 many
new calls to bb_perror_msg() have been added that only take a single
parameter and so could have been using bb_simple_perror_message().
This changeset introduces 'simple' versions of bb_info_msg(),
bb_error_msg(), bb_error_msg_and_die(), bb_herror_msg() and
bb_herror_msg_and_die(), and replaces all calls that only take a
single parameter, or use something like ("%s", arg), with calls to the
corresponding 'simple' version.
Since it is likely that single parameter calls to the variadic functions
may be accidentally reintroduced in the future a new debugging config
option WARN_SIMPLE_MSG has been introduced. This uses some macro magic
which will cause any such calls to generate a warning, but this is
turned off by default to avoid use of the unpleasant macros in normal
circumstances.
This is a large changeset due to the number of calls that have been
replaced. The only files that contain changes other than simple
substitution of function calls are libbb.h, libbb/herror_msg.c,
libbb/verror_msg.c and libbb/xfuncs_printf.c. In miscutils/devfsd.c,
networking/udhcp/common.h and util-linux/mdev.c additonal macros have
been added for logging so that single parameter and multiple parameter
logging variants exist.
The amount of space saved varies considerably by architecture, and was
found to be as follows (for 'defconfig' using GCC 7.4):
Arm: -92 bytes
MIPS: -52 bytes
PPC: -1836 bytes
x86_64: -938 bytes
Note that for the MIPS architecture only an exception had to be made
disabling the 'simple' calls for 'udhcp' (in networking/udhcp/common.h)
because it made these files larger on MIPS.
Signed-off-by: James Byrne <james.byrne@origamienergy.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Between Busybox 1.24.2 and 1.25.0 the bb_info_msg() function was
eliminated and calls to it changed to be bb_error_msg(). The downside of
this is that daemons now log all messages to syslog at the LOG_ERR level
which makes it hard to filter errors from informational messages.
This change optionally re-introduces bb_info_msg(), controlled by a new
option FEATURE_SYSLOG_INFO, restores all the calls to bb_info_msg() that
were removed (only in applets that set logmode to LOGMODE_SYSLOG or
LOGMODE_BOTH), and also changes informational messages in ifplugd and
ntpd.
The code size change of this is as follows (using 'defconfig' on x86_64
with gcc 7.3.0-27ubuntu1~18.04)
function old new delta
bb_info_msg - 182 +182
bb_vinfo_msg - 27 +27
static.log7 194 198 +4
log8 190 191 +1
log5 190 191 +1
crondlog 45 - -45
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 3/0 up/down: 215/-45) Total: 170 bytes
If you don't care about everything being logged at LOG_ERR level
then when FEATURE_SYSLOG_INFO is disabled Busybox actually gets smaller:
function old new delta
static.log7 194 200 +6
log8 190 193 +3
log5 190 193 +3
syslog_level 1 - -1
bb_verror_msg 583 581 -2
crondlog 45 - -45
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 3/1 up/down: 12/-48) Total: -36 bytes
Signed-off-by: James Byrne <james.byrne@origamienergy.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
The applets with "<applet> [opts] PROG ARGS" API very quickly exec
another program, noexec is okay for them:
chpst/envdir/envuidgid/softlimit/setuidgid
chroot
chrt
ionice
nice
nohup
setarch/linux32/linux64
taskset
cttyhack
"reset" and "sulogin" applets don't have this form, but also exec
another program at once, thus made noexec too.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Those two spaces after tab have no effect, and always a nuisance when editing.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Also, added a comment about bug 9401 (TIOCSTI input injection).
function old new delta
packed_usage 30909 30932 +23
su_main 470 487 +17
sulogin_main 260 258 -2
run_applet_and_exit 681 678 -3
run_shell 166 126 -40
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
In many cases, this aqllows to drop use of opt_complementary.
Approximately -400 bytes:
function old new delta
getopt32 1423 1502 +79
opt_string 17 18 +1
OPT_STR 24 25 +1
uniq_main 416 406 -10
timeout_main 279 269 -10
sulogin_main 270 260 -10
readprofile_main 1825 1815 -10
ps_main 543 533 -10
pidof_main 245 235 -10
pgrep_main 611 601 -10
od_main 2600 2590 -10
mkfs_minix_main 2684 2674 -10
mkfs_ext2_main 2603 2593 -10
microcom_main 712 702 -10
makemime_main 315 305 -10
ionice_main 282 272 -10
inetd_main 2074 2064 -10
ifplugd_main 1144 1134 -10
halt_main 353 343 -10
getopt_main 636 626 -10
fdisk_main 2854 2844 -10
env_main 206 196 -10
dmesg_main 319 309 -10
conspy_main 1214 1204 -10
awk_main 981 971 -10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/22 up/down: 81/-220) Total: -139 bytes
text data bss dec hex filename
919373 906 14060 934339 e41c3 busybox_old
918969 906 14060 933935 e402f busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Historic "System Maintenance Mode" message is a tiny bit cryptic.
Let's say explicitly what we are doing: we are giving user a shell
(presumably to do some maintenance in single-user mode).
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
sulogin_main 325 270 -55
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Sulogin is not a suid app, should fail if run by non-root.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
This needed some extensions correct_passwd() function,
which got renamed ask_and_check_password() to better describe what it does.
function old new delta
ask_and_check_password_extended - 215 +215
ask_and_check_password - 12 +12
vlock_main 394 397 +3
sulogin_main 494 326 -168
correct_password 207 - -207
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 1/1 up/down: 230/-375) Total: -145 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
The current password checking is unable to distinguish between the user
entering an empty password or pressing Control-D. As a result, an empty
password always results in normal startup.
We modify bb_ask to return NULL if Control-D is pressed without entering
a password. The sulogin applet is then modified to only proceed to
normal startup if bb_ask returns NULL. This covers EOF with no password,
interrupt by timeout and ^C.
Signed-off-by: Jonathan Liu <net147@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
packed_usage 28706 28623 -83
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
editors/*.c loginutils/*.c mailutils/*.c
Signed-off-by: Pere Orga <gotrunks@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
This change retains "or later" state! No licensing _changes_ here,
only form is adjusted (article, space between "GPL" and "v2" and so on).
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
function old new delta
run_shell 157 166 +9
su_main 477 470 -7
sulogin_main 515 503 -12
Signed-off-by: Ladislav Michl <Ladislav.Michl@seznam.cz>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
|
and SKIP_XXXX to IF_NOT_XXXX - the second one was especially
badly named. It was not skipping anything!
|
|
function old new delta
bb_ask - 355 +355
mkpasswd_main - 296 +296
.rodata 121746 121847 +101
packed_usage 24632 24689 +57
static.methods - 21 +21
gmatch 229 248 +19
bb_ask_stdin - 11 +11
applet_names 1949 1958 +9
applet_main 1172 1176 +4
sulogin_main 503 505 +2
applet_nameofs 586 588 +2
sha256_hash 329 327 -2
correct_password 208 206 -2
parse_command 1442 1439 -3
get_cred_or_die 145 141 -4
passwd_main 1054 1044 -10
bb_askpass 348 - -348
------------------------------------------------------------------------------
(add/remove: 4/1 grow/shrink: 7/5 up/down: 877/-369) Total: 508 bytes
|
|
function old new delta
stop_handler 41 38 -3
sulogin_main 508 504 -4
got_cont 4 - -4
cont_handler 11 - -11
startservice 309 297 -12
processorstart 423 409 -14
tcpudpsvd_main 1861 1843 -18
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 0/5 up/down: 0/-66) Total: -66 bytes
|
|
|
|
text data bss dec hex filename
759802 604 6684 767090 bb472 busybox_old
759804 604 6676 767084 bb46c busybox_unstripped
|
|
For bbox it's not acceptable. Roll our own des and md5 crypt
implementation. Against older uclibc:
text data bss dec hex filename
759945 604 6684 767233 bb501 busybox_old
759766 604 6684 767054 bb44e busybox_unstripped
so, we still save on code size.
|
|
function old new delta
getopt32 1370 1385 +15
sulogin_main 490 494 +4
realpath_main 84 86 +2
sleep_main 76 77 +1
mt_main 256 257 +1
printenv_main 75 74 -1
fdformat_main 546 545 -1
usleep_main 44 42 -2
setlogcons_main 77 75 -2
ed_main 2654 2649 -5
deallocvt_main 69 64 -5
addgroup_main 373 368 -5
mkfs_minix_main 2989 2982 -7
tail_main 1221 1213 -8
sv_main 1254 1241 -13
du_main 348 328 -20
tftp_main 325 302 -23
split_main 581 558 -23
nc_main 1000 977 -23
diff_main 891 868 -23
arping_main 1797 1770 -27
ls_main 893 847 -46
od_main 2797 2750 -47
readprofile_main 1944 1895 -49
tcpudpsvd_main 1973 1922 -51
udhcpc_main 2590 2513 -77
grep_main 824 722 -102
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/22 up/down: 23/-560) Total: -537 bytes
text data bss dec hex filename
796973 658 7428 805059 c48c3 busybox_old
796479 662 7420 804561 c46d1 busybox_unstripped
|
|
function old new delta
procps_scan 1265 1298 +33
aliascmd 278 283 +5
parse_file_cmd 116 120 +4
dname_enc 373 377 +4
setcmd 90 93 +3
execcmd 57 60 +3
count_lines 72 74 +2
process_command_subs 340 339 -1
test_main 409 407 -2
mknod_main 179 177 -2
handle_incoming_and_exit 2653 2651 -2
argstr 1312 1310 -2
shiftcmd 131 128 -3
exitcmd 46 43 -3
dotcmd 297 294 -3
breakcmd 86 83 -3
evalpipe 353 349 -4
evalcommand 1180 1176 -4
evalcmd 109 105 -4
send_tree 374 369 -5
mkfifo_main 82 77 -5
evalsubshell 152 147 -5
typecmd 75 69 -6
letcmd 61 55 -6
add_cmd 1190 1183 -7
main 891 883 -8
ash_main 1415 1407 -8
parse_stream 1377 1367 -10
alloc_procps_scan 55 - -55
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 7/21 up/down: 54/-148) Total: -94 bytes
text data bss dec hex filename
797195 658 7428 805281 c49a1 busybox_old
797101 658 7428 805187 c4943 busybox_unstripped
|
|
mount: sanitize environ if called by non-root
*: adjust for slightly different sanitize routine
|
|
|
|
|
|
adduser: implement -S and code shrink / fix uid selection
*: sanitize getspnam_r use
text data bss dec hex filename
777042 974 9676 787692 c04ec busybox_old
776883 974 9676 787533 c044d busybox_unstripped
|
|
sulogin: remove alarm handling, as it is redundant there.
code shrink. After all differences cancel out:
text data bss dec hex filename
777543 1000 9532 788075 c066b busybox_old
777543 1000 9532 788075 c066b busybox_unstripped
|
|
EXTERNALLY_VISIBLE. 5% size reduction of libbusybox.so
|
|
run_shell: mark as NORETURN
setup_environment, run_shell: add usage comments
login: add FIXME :(
function old new delta
UNSPEC_print 64 66 +2
sulogin_main 509 506 -3
mkfs_minix_main 3070 3067 -3
login_main 1615 1612 -3
su_main 461 448 -13
setup_environment 261 206 -55
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/5 up/down: 2/-77) Total: -75 bytes
text data bss dec hex filename
772578 1051 10724 784353 bf7e1 busybox_old
772502 1051 10724 784277 bf795 busybox_unstripped
|
|
(add/remove: 0/0 grow/shrink: 12/131 up/down: 91/-727) Total: -636 bytes
text data bss dec hex filename
773469 1058 11092 785619 bfcd3 busybox_old
772644 1058 11092 784794 bf99a busybox_unstripped
|
|
trylink: explain how to modify link and drastically decrease amount
of padding (unfortunately, needs hand editing ATM).
*: add ALIGN1 / ALIGN2 to global strings and arrays of bytes and shorts
size saving: 0.5k
|
|
*: s/include "busybox.h"/include "libbb.h"
|
|
fall back to ordinary one
Reduced usage of functions returning datain static buffers.
(mostly passwd/group/shadow related):
function old new delta
correct_password 143 193 +50
sulogin_main 490 533 +43
adduser_main 732 774 +42
passwd_main 1875 1915 +40
addgroup_main 330 365 +35
bb_internal_getspnam 38 - -38
bb_internal_fgetpwent 38 - -38
bb_internal_fgetgrent 38 - -38
static.resultbuf 168 88 -80
static.buffer 1872 1104 -768
------------------------------------------------------------------------------
(add/remove: 0/3 grow/shrink: 5/2 up/down: 210/-962) Total: -752 bytes
|
|
no preceding prototype
|
|
|
|
|