<feed xmlns='http://www.w3.org/2005/Atom'>
<title>talos-skiboot/libc/stdio, branch 04-16-2019</title>
<subtitle>Talos™ II skiboot sources</subtitle>
<id>https://git.raptorcs.com/git/talos-skiboot/atom?h=04-16-2019</id>
<link rel='self' href='https://git.raptorcs.com/git/talos-skiboot/atom?h=04-16-2019'/>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-skiboot/'/>
<updated>2018-03-01T02:28:39+00:00</updated>
<entry>
<title>build: use thin archives rather than incremental linking</title>
<updated>2018-03-01T02:28:39+00:00</updated>
<author>
<name>Nicholas Piggin</name>
<email>npiggin@gmail.com</email>
</author>
<published>2018-02-10T08:42:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-skiboot/commit/?id=f6159cff5d91e5c0810d0c9285a1d2370a38e2b7'/>
<id>urn:sha1:f6159cff5d91e5c0810d0c9285a1d2370a38e2b7</id>
<content type='text'>
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 &lt;npiggin@gmail.com&gt;
Signed-off-by: Stewart Smith &lt;stewart@linux.vnet.ibm.com&gt;
</content>
</entry>
<entry>
<title>libc/stdio/vsnprintf.c: add explicit fallthrough</title>
<updated>2017-02-02T05:35:42+00:00</updated>
<author>
<name>Stewart Smith</name>
<email>stewart@linux.vnet.ibm.com</email>
</author>
<published>2017-02-02T05:35:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-skiboot/commit/?id=11cf409be293091470b3f75619416e2bb2697265'/>
<id>urn:sha1:11cf409be293091470b3f75619416e2bb2697265</id>
<content type='text'>
silences recent GCC warning

Signed-off-by: Stewart Smith &lt;stewart@linux.vnet.ibm.com&gt;
</content>
</entry>
<entry>
<title>libc : Changes variable data type where return value of strlen() stored from int to size_t</title>
<updated>2016-10-11T04:40:30+00:00</updated>
<author>
<name>Mukesh Ojha</name>
<email>mukesh02@linux.vnet.ibm.com</email>
</author>
<published>2016-09-02T04:56:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-skiboot/commit/?id=32dc2a19bb6a91862b414fdd6eec07154e5e4308'/>
<id>urn:sha1:32dc2a19bb6a91862b414fdd6eec07154e5e4308</id>
<content type='text'>
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 &lt;mukesh02@linux.vnet.ibm.com&gt;
Signed-off-by: Stewart Smith &lt;stewart@linux.vnet.ibm.com&gt;
</content>
</entry>
<entry>
<title>libc: Remove NULL check for format argument in snprintf()</title>
<updated>2016-07-18T06:04:17+00:00</updated>
<author>
<name>Cyril Bur</name>
<email>cyril.bur@au1.ibm.com</email>
</author>
<published>2016-07-14T01:58:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-skiboot/commit/?id=d314ddf5d9e167108ccddf0ed1cdb3cc0f25d443'/>
<id>urn:sha1:d314ddf5d9e167108ccddf0ed1cdb3cc0f25d443</id>
<content type='text'>
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 &lt;cyril.bur@au1.ibm.com&gt;
Signed-off-by: Stewart Smith &lt;stewart@linux.vnet.ibm.com&gt;
</content>
</entry>
<entry>
<title>Fix for typos</title>
<updated>2016-06-20T05:08:05+00:00</updated>
<author>
<name>Frederic Bonnard</name>
<email>frediz@linux.vnet.ibm.com</email>
</author>
<published>2016-06-13T09:37:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-skiboot/commit/?id=4c95b5e04e3c4f72e4005574f67cd6e365d3276f'/>
<id>urn:sha1:4c95b5e04e3c4f72e4005574f67cd6e365d3276f</id>
<content type='text'>
While reviewing the Debian packaging, codespell found those.
Most proposed fixes are based on codespell's default dictionnary.

Signed-off-by: Frederic Bonnard &lt;frediz@linux.vnet.ibm.com&gt;
Reviewed-by: Mukesh Ojha &lt;mukesh02@linux.vnet.ibm.com&gt;
Signed-off-by: Stewart Smith &lt;stewart@linux.vnet.ibm.com&gt;
</content>
</entry>
<entry>
<title>Remove unused scanf and variants</title>
<updated>2015-11-13T01:00:17+00:00</updated>
<author>
<name>Stewart Smith</name>
<email>stewart@linux.vnet.ibm.com</email>
</author>
<published>2015-11-13T01:00:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-skiboot/commit/?id=6665027600101146f1865d5c407947f5fcd96da1'/>
<id>urn:sha1:6665027600101146f1865d5c407947f5fcd96da1</id>
<content type='text'>
We don't use scanf at all, so solve the bugs found by static analysis
by just removing it.

Signed-off-by: Stewart Smith &lt;stewart@linux.vnet.ibm.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'update-2.1.1.1'</title>
<updated>2015-01-19T06:23:09+00:00</updated>
<author>
<name>Stewart Smith</name>
<email>stewart@linux.vnet.ibm.com</email>
</author>
<published>2015-01-19T06:22:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-skiboot/commit/?id=452869244990b61a0b683f3f90489cbae234d00a'/>
<id>urn:sha1:452869244990b61a0b683f3f90489cbae234d00a</id>
<content type='text'>
</content>
</entry>
<entry>
<title>opal: Fix buffer overrun in print_* functions.</title>
<updated>2015-01-19T06:15:22+00:00</updated>
<author>
<name>Mahesh Salgaonkar</name>
<email>mahesh@linux.vnet.ibm.com</email>
</author>
<published>2015-01-14T18:32:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-skiboot/commit/?id=d0b91f6c8b4f159fc05eca21fceff1bf98fabd51'/>
<id>urn:sha1:d0b91f6c8b4f159fc05eca21fceff1bf98fabd51</id>
<content type='text'>
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()-&gt;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()-&gt;vsnprintf()-&gt;print_format()-&gt;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 &lt;mahesh@linux.vnet.ibm.com&gt;
Acked-by: Ananth N Mavinakayanahalli &lt;ananth@in.ibm.com&gt;
Signed-off-by: Stewart Smith &lt;stewart@linux.vnet.ibm.com&gt;
</content>
</entry>
<entry>
<title>Remove vsprintf: just like sprintf, vsnprintf is a much better idea</title>
<updated>2014-11-28T06:35:44+00:00</updated>
<author>
<name>Stewart Smith</name>
<email>stewart@linux.vnet.ibm.com</email>
</author>
<published>2014-11-28T06:35:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-skiboot/commit/?id=566f139cffdcef5d1ce679cc1a7cfd0c7cde3f78'/>
<id>urn:sha1:566f139cffdcef5d1ce679cc1a7cfd0c7cde3f78</id>
<content type='text'>
Signed-off-by: Stewart Smith &lt;stewart@linux.vnet.ibm.com&gt;
</content>
</entry>
<entry>
<title>Remove sprintf: there's no good reason to have this in firmware</title>
<updated>2014-11-28T06:23:32+00:00</updated>
<author>
<name>Stewart Smith</name>
<email>stewart@linux.vnet.ibm.com</email>
</author>
<published>2014-11-28T06:23:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.raptorcs.com/git/talos-skiboot/commit/?id=124591c0f398341c0262ee2804c08c6f0e2dbdf6'/>
<id>urn:sha1:124591c0f398341c0262ee2804c08c6f0e2dbdf6</id>
<content type='text'>
Signed-off-by: Stewart Smith &lt;stewart@linux.vnet.ibm.com&gt;
</content>
</entry>
</feed>
