Age | Commit message (Collapse) | Author | Files | Lines |
|
This changes to build system to use thin archives rather than
incremental linking for built-in.o, similar to recent change to Linux.
built-in.o is renamed to built-in.a, and is created as a thin archive
with no index, for speed and size. All built-in.a are aggregated into
a skiboot.tmp.a which is a thin archive built with an index, making it
suitable or linking. This is input into the final link.
The advantags of build size and linker code placement flexibility are
not as great with skiboot as a bigger project like Linux, but it's a
conceptually better way to build, and is more compatible with link
time optimisation in toolchains which might be interesting for skiboot
particularly for size reductions.
Size of build tree before this patch is 34.4MB, afterwards 23.1MB.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
silences recent GCC warning
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
int to size_t
Reason of the change as integer value may overflow, and it can give negative
value for the length.
This patch also changes the data type of variable which is compared with
strlen() as the comparison also has to be done on the same level.
Signed-off-by: Mukesh Ojha <mukesh02@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
libc printf style functions are annotated with __attribute__((format
(printf, x, y))) which causes GCC to perform compile time checks
against these arguments.
As of at least gcc 6.1.1 [(GCC) 6.1.1 20160602] this causes an error
running make check. GCC appears to be guaranteeing that the format
argument won't be NULL and complaining about explicit checks.
In file included from core/test/run-console-log-buf-overrun.c:48:0:
core/test/run-console-log-buf-overrun.c: In function ‘snprintf’:
core/test/../../libc/stdio/snprintf.c:21:19: error: nonnull argument
‘format’compared to NULL [-Werror=nonnull-compare]
if ((buff==NULL) || (format==NULL))
~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors make:
*** [core/test/Makefile.check:59:core/test/run-console-log-buf-overrun] Error 1
Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
While reviewing the Debian packaging, codespell found those.
Most proposed fixes are based on codespell's default dictionnary.
Signed-off-by: Frederic Bonnard <frediz@linux.vnet.ibm.com>
Reviewed-by: Mukesh Ojha <mukesh02@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
We don't use scanf at all, so solve the bugs found by static analysis
by just removing it.
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
|
|
While running HMI tests I saw a massive corruption in OPAL for one of the
HMI test that injects TB error. On investigation I found that
vsnprintf()->print_itoa() was the culprit. print_itoa function uses tmp
array of size 16 to convert unsigned long value to ASCII. But an unsigned
value of 0xffffffffffffffff needs atleast 25 characters to print its ASCII
representation. This caused an array to overflow resulting into corruption,
unpredictable behavior and finally system termination.
We could fix this by increasing the size of tmp[] array but that still won't
fix this bug completely. While auditing vsnprintf() function I found that
it makes use of print_*() functions to write data to buffer. But none of
the print_* function have any check on buffer size before writing data to it.
Without size check print_*() can easily overrun buffer passed by
vprlog()->vsnprintf()->print_format()->print_*() causing massive corruption
leading to unpredictable behavior.
This patch fixes this bug by modifying print_*() function to check for
buffer size to avoid buffer overrun.
- Modified print_format(), print_fill() and print_itoa() to take bufsize
as argument and added a size check while writing to buffer.
- Remove temporary array from print_itoa(), instead write data directly to
buffer.
- Added two new function print_str_fill() and print_str() to be used as
helper routine for '%s' fmt case in print_format() function. These new
routines now has a check on buffer size while copying NULL terminated
string to buffer.
- Added "!bufsize" check in vsnprintf() to avoid buffer overrun while
setting NULL character before returning.
I ran HMI tests with this patch successfully. I also tested this patch by
reducing size of the buffer (in core/console-log.c:vprlog()) from 320 to 50
and booted the lid successfully with no corruption at all.
Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Acked-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Remove recursive call in print_itoa to reduce the stack usage.
Signed-off-by: Shreyas B. Prabhu <shreyas@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Replace the libc printf implementation with a wrapper that does
fancy log things such as display timestamp and the log level.
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
|
|
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
|