aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2018-05-18 17:45:31 +0200
committerAlexey Kardashevskiy <aik@ozlabs.ru>2018-05-25 14:56:07 +1000
commit4c91c160f9e9695d3a5494f5cabd022cc6603ea3 (patch)
treefe8766c0be7cdd94df948a28de27210ac8ae7009
parent4c2af4e48ff4162617cd41d4b2582bcbda670bea (diff)
downloadSLOF-4c91c160f9e9695d3a5494f5cabd022cc6603ea3.zip
SLOF-4c91c160f9e9695d3a5494f5cabd022cc6603ea3.tar.gz
SLOF-4c91c160f9e9695d3a5494f5cabd022cc6603ea3.tar.bz2
obp-tftp: Make sure to not overwrite paflof in memory
The obp-tftp package is currently using an arbitrary large value as maximal load size. If the downloaded file is big enough, we can easily erase Paflof in memory this way. Let's make sure that this can not happen by limiting the size to the amount of memory below the Paflof binary (which is close to the end of the RAM) in case of board-qemu, or the amount of memory between the minimum RAM size and the load-base on board-js2x. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Greg Kurz <groug@kaod.org> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
-rw-r--r--slof/fs/packages/obp-tftp.fs8
1 files changed, 7 insertions, 1 deletions
diff --git a/slof/fs/packages/obp-tftp.fs b/slof/fs/packages/obp-tftp.fs
index 19c11e1..7236624 100644
--- a/slof/fs/packages/obp-tftp.fs
+++ b/slof/fs/packages/obp-tftp.fs
@@ -24,7 +24,13 @@ s" obp-tftp" device-name
my-parent ihandle>phandle node>path encode-string
s" bootpath" set-chosen
- 60000000 ( addr maxlen )
+ \ Determine the maximum size that we can load:
+ dup paflof-start < IF
+ paflof-start
+ ELSE
+ MIN-RAM-SIZE
+ THEN ( addr endaddr )
+ over - ( addr maxlen )
\ Add OBP-TFTP Bootstring argument, e.g. "10.128.0.1,bootrom.bin,10.128.40.1"
my-args