From b8a4c876905d605cf180e77f7d1bb08f2ed22940 Mon Sep 17 00:00:00 2001 From: Tiago Muck Date: Wed, 12 Dec 2018 15:52:41 -0600 Subject: mem: Add invalid context id check on LLSC checks If the request's address is in the LLSC list, its context Id was being fetched unconditionally, which could cause the assert at Request::contextId() to fail. Change-Id: Iae9791f81c8fe9a7fcd842cd8ab7db18f34f2808 Signed-off-by: Tiago Muck Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18792 Reviewed-by: Nikos Nikoleris Maintainer: Nikos Nikoleris Tested-by: kokoro --- src/mem/abstract_mem.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/mem/abstract_mem.cc') diff --git a/src/mem/abstract_mem.cc b/src/mem/abstract_mem.cc index a998530fd..6870ba38f 100644 --- a/src/mem/abstract_mem.cc +++ b/src/mem/abstract_mem.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2012,2017-2018 ARM Limited + * Copyright (c) 2010-2012,2017-2019 ARM Limited * All rights reserved * * The license below extends only to copyright in the software and shall @@ -284,7 +284,10 @@ AbstractMemory::checkLockedAddrList(PacketPtr pkt) DPRINTF(LLSC, "Erasing lock record: context %d addr %#x\n", i->contextId, paddr); ContextID owner_cid = i->contextId; - ContextID requester_cid = pkt->req->contextId(); + assert(owner_cid != InvalidContextID); + ContextID requester_cid = req->hasContextId() ? + req->contextId() : + InvalidContextID; if (owner_cid != requester_cid) { ThreadContext* ctx = system()->getThreadContext(owner_cid); TheISA::globalClearExclusive(ctx); -- cgit v1.2.3