From: Daniel De Graaf Subject: [PATCH] Avoid null dereference in flask get_page_sid Date: Wed, 8 Sep 2010 12:21:02 -0400 Message-ID: <20100908162102.GA17645@moss-transistor.epoch.ncsc.mil> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel List-Id: xen-devel@lists.xenproject.org When booting Xen with flask enabled, dom0 memory specified to 1G, and no policy loaded, I was able to produce a crash in get_page_sid. The following patch appears to fix the issue, but I'm not sure if this is the best response when given a page that does not have a label. Xen call trace: [] get_page_sid+0x87/0x93 [] get_mfn_sid+0x56/0x6e [] flask_mmu_normal_update+0xbc/0xeb [] do_mmu_update+0x378/0x1927 [] do_multicall+0x29d/0x438 [] syscall_enter+0xf2/0x14c --- a/xen/xsm/flask/hooks.c +++ b/xen/xsm/flask/hooks.c @@ -345,7 +345,10 @@ default: /*Pages are implicitly labeled by domain ownership!*/ dsec = d->ssid; - *sid = dsec->sid; + if (dsec) + *sid = dsec->sid; + else + rc = -ENOENT; break; } -- Daniel De Graaf National Security Agency