From dfa51259ad1434aa75bef6d071ba5dfacbf13cba Mon Sep 17 00:00:00 2001 From: Matthias Gazzari Date: Sat, 19 May 2018 00:44:20 +0200 Subject: nb/intel/nehalem: Fix smashed stack in romstage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Stack smashing was detected during raminit when not loading from MRC. Adding CAR_GLOBAL to a struct inside raminit was suggested in https://mail.coreboot.org/pipermail/coreboot/2018-May/086677.html in order to fix the problem. Adding CAR_GLOBAL to the ram timings variable solves the issue (adding it to the ram_training or raminfo struct had no effect). This is just a workaround and might need a proper fix in the future. Tested on Lenovo X201i with 2+2 and 4+4 GB RAM. Change-Id: I21b380db61be2aedc045201821d83e18e7d07ad1 Signed-off-by: Matthias Gazzari Reviewed-on: https://review.coreboot.org/26388 Tested-by: build bot (Jenkins) Reviewed-by: Kyösti Mälkki --- src/northbridge/intel/nehalem/raminit.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/northbridge/intel/nehalem') diff --git a/src/northbridge/intel/nehalem/raminit.c b/src/northbridge/intel/nehalem/raminit.c index df88ef3e79..6a27b576e0 100644 --- a/src/northbridge/intel/nehalem/raminit.c +++ b/src/northbridge/intel/nehalem/raminit.c @@ -44,6 +44,7 @@ #include #include #include +#include #endif #if !REAL @@ -282,6 +283,9 @@ struct raminfo { const struct ram_training *cached_training; }; +/* Global allocation of timings_car */ +timing_bounds_t timings_car[64] CAR_GLOBAL; + static void write_500(struct raminfo *info, int channel, u32 val, u16 addr, int bits, int flag); @@ -3128,7 +3132,7 @@ static void do_ram_training(struct raminfo *info) u8 reg_178; int niter; - timing_bounds_t timings[64]; + timing_bounds_t *timings = timings_car; int lane, rank, slot, channel; u8 reg178_center; -- cgit v1.2.3