kern/66248: [panic] bootloader is confused by booting from USB flash, trashes main drives boot block

Julian Elischer julian at elischer.org
Wed Jan 5 17:32:46 PST 2005


Not sure, but this may want to go into 4.11?
Is the bug in that as well?


Peter Edwards wrote:

>The following reply was made to PR kern/66248; it has been noted by GNATS.
>
>From: Peter Edwards <peadar at freebsd.org>
>To: freebsd-gnats-submit at FreeBSD.org, bremner at unb.ca
>Cc: julian at elischer.org, imp at bsdimp.org
>Subject: Re: kern/66248: [panic] bootloader is confused by booting from USB
> flash, trashes main drives boot block
>Date: Wed, 05 Jan 2005 20:53:02 +0000
>
> This is a multi-part message in MIME format.
> --------------070200040205060401080901
> Content-Type: text/plain; charset=us-ascii; format=flowed
> Content-Transfer-Encoding: 7bit
> 
> The following patch, applied before the one above, shrinks boot0 enough 
> to squeeze the previous patch in without undeffing the BEL stuff.
> 
> FWIW: The patch to fix the bug looks good to me.
> I someone gives a go-ahead, I'll commit a combined patch: I certainly 
> don't want to make a commit to boot0 and have half the FreeBSD community 
> left without a bootable machine, unless I can pass the book :-)
> 
> 
> --------------070200040205060401080901
> Content-Type: text/plain;
>  name="boot0.smaller.patch"
> Content-Transfer-Encoding: 7bit
> Content-Disposition: inline;
>  filename="boot0.smaller.patch"
> 
> Index: boot0.S
> ===================================================================
> RCS file: /usr/cvs/FreeBSD-CVS/src/sys/boot/i386/boot0/boot0.S,v
> retrieving revision 1.12
> diff -u -w -r1.12 boot0.S
> --- boot0.S	24 Nov 2004 15:39:04 -0000	1.12
> +++ boot0.S	5 Jan 2005 20:44:32 -0000
> @@ -29,7 +29,7 @@
>  		.set PRT_OFF,0x1be		# Partition table
>  
>  		.set TBL0SZ,0x3 		# Table 0 size
> -		.set TBL1SZ,0xb 		# Table 1 size
> +		.set TBL1SZ,0xc 		# Table 1 size
>  
>  		.set MAGIC,0xaa55		# Magic: bootable
>  		.set B0MAGIC,0xbb66		# Identification
> @@ -148,13 +148,8 @@
>  		movb $TBL1SZ,%cl		# Number of entries
>  		repne				# Known
>  		scasb				#  type?
> -		jne main.4			# No
> -/*
> - * If it matches get the matching element in the next array.  If it doesn't,
> - * we are already pointing at its first element which points to a "?".
> - */
> -		addw $TBL1SZ,%di		# Adjust
> -main.4:		movb (%di),%cl			# Partition
> +		addw $TBL1SZ - 1, %di		# Adjust
> +		movb (%di),%cl			# Partition
>  		addw %cx,%di			#  description
>  		callw putx			# Display it
>  main.5:		incw %dx			# Next item
> @@ -314,8 +309,7 @@
>  		cmpw $MAGIC,0x1fe(%bx)		# Bootable?
>  		jne main.10			# No
>  		pushw %si			# Save
> -		movw $crlf,%si			# Leave some
> -		callw puts			#  space
> +		callw putn			# Leave some space
>  		popw %si			# Restore
>  		jmp *%bx			# Invoke bootstrap
>  
> @@ -408,14 +402,14 @@
>  		.byte 0x0, 0x5, 0xf
>  /*
>   * These values indicate bootable types we know the names of.
> + * The value of the last entry is unimportant: it indicates "everything else"
>   */
>  		.byte 0x1, 0x4, 0x6, 0xb, 0xc, 0xe, 0x83
> -		.byte 0x9f, 0xa5, 0xa6, 0xa9
> +		.byte 0x9f, 0xa5, 0xa6, 0xa9, 0xff
>  /*
>   * These are offsets that match the known names above and point to the strings
>   * that will be printed.
>   */
> -		.byte os_misc-. 		# Unknown
>  		.byte os_dos-.			# DOS
>  		.byte os_dos-.			# DOS
>  		.byte os_dos-.			# DOS
> @@ -427,6 +421,7 @@
>  		.byte os_freebsd-.		# FreeBSD
>  		.byte os_bsd-.			# OpenBSD
>  		.byte os_bsd-.			# NetBSD
> +		.byte os_misc-. 		# Unknown
>  /*
>   * And here are the strings themselves. 0x80 or'd into a byte indicates
>   * the end of the string. (not so great for Russians but...)
> 
> --------------070200040205060401080901--
>_______________________________________________
>freebsd-usb at freebsd.org mailing list
>http://lists.freebsd.org/mailman/listinfo/freebsd-usb
>To unsubscribe, send any mail to "freebsd-usb-unsubscribe at freebsd.org"
>  
>



More information about the freebsd-current mailing list