From: "Jan Beulich" Subject: [PATCH] x86/EDD: check MBR for BIOS magic before considering signature valid Date: Wed, 30 May 2012 16:36:19 +0100 Message-ID: <4FC65A930200007800086F39@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartBC923863.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__PartBC923863.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Signed-off-by: Jan Beulich --- a/xen/arch/x86/boot/edd.S +++ b/xen/arch/x86/boot/edd.S @@ -53,12 +53,16 @@ edd_mbr_sig_read: jc edd_mbr_sig_done # on failure, we're done. cmpb $0, %ah # some BIOSes do not set = CF jne edd_mbr_sig_done # on failure, we're done. + cmpw $0xaa55, bootsym(boot_edd_info)+0x1fe + jne .Ledd_mbr_sig_next movl bootsym(boot_edd_info)+EDD_MBR_SIG_OFFSET,%eax movb %dl, (%bx) # store BIOS drive number movl %eax, 4(%bx) # store signature from = MBR incb bootsym(boot_mbr_signature_nr) # note that we stored = something - incb %dl # increment to next = device addw $8, %bx # increment sig buffer = ptr +.Ledd_mbr_sig_next: + incb %dl # increment to next = device + jz edd_mbr_sig_done cmpb $EDD_MBR_SIG_MAX,bootsym(boot_mbr_signature_nr) jb edd_mbr_sig_read edd_mbr_sig_done: --=__PartBC923863.0__= Content-Type: text/plain; name="x86-edd-mbr-sig-check.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-edd-mbr-sig-check.patch" x86/EDD: check MBR for BIOS magic before considering signature valid=0A=0AS= igned-off-by: Jan Beulich =0A=0A--- a/xen/arch/x86/boot/= edd.S=0A+++ b/xen/arch/x86/boot/edd.S=0A@@ -53,12 +53,16 @@ edd_mbr_sig_rea= d:=0A jc edd_mbr_sig_done # on failure, we're = done.=0A cmpb $0, %ah # some BIOSes do = not set CF=0A jne edd_mbr_sig_done # on = failure, we're done.=0A+ cmpw $0xaa55, bootsym(boot_edd_info)+0x1= fe=0A+ jne .Ledd_mbr_sig_next=0A movl bootsym(boot_ed= d_info)+EDD_MBR_SIG_OFFSET,%eax=0A movb %dl, (%bx) = # store BIOS drive number=0A movl %eax, 4(%bx) = # store signature from MBR=0A incb bootsym(boot_mbr_si= gnature_nr) # note that we stored something=0A- incb %dl = # increment to next device=0A addw $8, %bx = # increment sig buffer ptr=0A+.Ledd_mbr_sig_next:= =0A+ incb %dl # increment to next = device=0A+ jz edd_mbr_sig_done=0A cmpb $EDD_MBR_SIG_= MAX,bootsym(boot_mbr_signature_nr)=0A jb edd_mbr_sig_read=0A = edd_mbr_sig_done:=0A --=__PartBC923863.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__PartBC923863.0__=--