lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 01 Jul 2015 20:56:58 -0700
From:	Dan Mick <dmick@...hat.com>
To:	linux-kernel@...r.kernel.org
Subject: failing while writing to disk with BIOS in realmode setup

What might I be doing wrong?  Why won't this code succeed to write to
the (otherwise empty) drive 1 from kernel setup's main?  I'm 100%
certain this is the code I'm booting (with grub/bzImage); it's as though
the intcalls just never happen (or fail for some reason I can't get
telemetry on, which is why I'm trying this technique in the first place).

--- /var/tmp/main.c	2015-06-30 14:08:52.435618099 -0700
+++ arch/x86/boot/main.c	2015-07-01 20:33:32.227506260 -0700
@@ -132,6 +131,8 @@
 	}
 }

+char block[512] = "DJM WAS HERE                     ";
+
 void main(void)
 {
 	/* First, copy the boot header into the "zeropage" */
@@ -142,6 +143,22 @@
 	if (cmdline_find_option_bool("debug"))
 		puts("early console in setup code\n");

+	struct biosregs ireg, oreg;
+	initregs(&ireg);
+	ireg.ah = 0;		// reset drive 81
+	ireg.dl = 0x81;
+	intcall(0x13, &ireg, &oreg);
+
+	initregs(&ireg);
+	ireg.ah = 0x03;		// write AL sectors to drive DL CHS CH/DH/CL
+	ireg.al = 1;
+	ireg.dl = 0x81;
+	ireg.cl = 1;
+	ireg.dh = 0;
+	ireg.es = ds();
+	ireg.bx = (uint)(uintptr_t)&block;
+
+	intcall(0x13, &ireg, &oreg);
 	/* End of heap check */
 	init_heap();


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ