freebsd-dev/sys
Bill Paul 51d6d0952b Clean up and apply the fix for PR 83477. The calculation for locating
the start of the section headers has to take into account the fact
that the image_nt_header is really variable sized. It happens that
the existing calculation is correct for _most_ production binaries
produced by the Windows DDK, but if we get a binary with oddball
offsets, the PE loader could crash.

Changes from the supplied patch are:

- We don't really need to use the IMAGE_SIZEOF_NT_HEADER() macro when
  computing how much of the header to return to callers of
  pe_get_optional_header(). While it's important to take the variable
  size of the header into account in other calculations, we never
  actually look at anything outside the non-variable portion of the
  header. This saves callers from having to allocate a variable sized
  buffer off the heap (I purposely tried to avoid using malloc()
  in subr_pe.c to make it easier to compile in both the -D_KERNEL and
  !-D_KERNEL case), and since we're copying into a buffer on the
  stack, we always have to copy the same amount of data or else
  we'll trash the stack something fierce.

- We need <stddef.h> to get offsetof() in the !-D_KERNEL case.

- ndiscvt.c needs the IMAGE_FIRST_SECTION() macro too, since it does
  a little bit of section pre-processing.

PR: kern/83477
2005-10-26 18:46:27 +00:00
..
alpha Reorganize the interrupt handling code a bit to make a few things cleaner 2005-10-25 19:48:48 +00:00
amd64 Reorganize the interrupt handling code a bit to make a few things cleaner 2005-10-25 19:48:48 +00:00
arm Reorganize the interrupt handling code a bit to make a few things cleaner 2005-10-25 19:48:48 +00:00
boot - Add a workaround for the fact that OFW doesn't guarantee that 2005-10-25 12:51:49 +00:00
bsm
cam Make the exploring of all luns supported by an HBA more of a 2005-09-16 01:26:17 +00:00
coda Merge the dev_clone and dev_clone_cred event handlers into a single 2005-08-08 19:55:32 +00:00
compat Clean up and apply the fix for PR 83477. The calculation for locating 2005-10-26 18:46:27 +00:00
conf Refactor (some more) installation of kernel and module objects. 2005-10-25 09:05:07 +00:00
contrib Add a commented out version of what was done for the r20041119sysinc import. 2005-10-24 04:36:14 +00:00
crypto Add VIA/ACE "PadLock" support as a crypto(9) driver. 2005-08-18 00:30:22 +00:00
ddb - Rename 'traceall' to 'alltrace' so that the 'tr' shortcut for 'trace' 2005-10-24 15:21:36 +00:00
dev - Use swi_remove() to teardown swi handlers rather than 2005-10-26 15:52:16 +00:00
doc
fs Use correct cirteria for determining which directory entries we can 2005-10-18 20:21:25 +00:00
gdb
geom Add checking for File record magic. 2005-10-26 03:24:28 +00:00
gnu Apply the same fix to a potential race in the ISDOTDOT code 2005-10-21 09:15:26 +00:00
i4b Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE and 2005-08-09 10:20:02 +00:00
i386 Reorganize the interrupt handling code a bit to make a few things cleaner 2005-10-25 19:48:48 +00:00
ia64 Reorganize the interrupt handling code a bit to make a few things cleaner 2005-10-25 19:48:48 +00:00
isa Fix an endianness issue in pnp_eisaformat(). This corrects printing PnP IDs 2005-09-28 15:01:58 +00:00
isofs/cd9660 Implement the full range of ISO9660 number conversion routines in iso.h. 2005-10-18 13:35:08 +00:00
kern Add a swi_remove() function to teardown software interrupt handlers. For 2005-10-26 15:51:05 +00:00
libkern Backout strtok() addition to libkern, strsep() is enough and strtok() 2005-10-06 19:06:07 +00:00
modules Connect es137x build on sparc64. 2005-10-25 04:01:41 +00:00
net If we have been called from ether_ifdetach() then do not try and clear the 2005-10-23 22:30:07 +00:00
net80211 Properly set ic_curchan before calling back to device driver to do channel 2005-08-30 14:27:47 +00:00
netatalk Forward declare atalkdomain with static linkage, not extern, since 2005-09-11 16:04:56 +00:00
netatm Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE and 2005-08-09 10:20:02 +00:00
netgraph - Use swi_remove() to teardown swi handlers rather than 2005-10-26 15:52:16 +00:00
netinet Since carp(4) interfaces presently are kinda fake yet possess 2005-10-26 05:57:35 +00:00
netinet6 fixed a compilation failure on amd64/sparc64/ia64 2005-10-22 05:07:16 +00:00
netipsec Replace custom mbuf writeability test with generic M_WRITABLE() test 2005-09-26 20:35:45 +00:00
netipx Forward declaring static variables as extern is invalid ISO-C. Now that 2005-09-07 10:06:14 +00:00
netkey SADB_UPDATE did not return an error when key length is invalid. 2005-08-22 07:05:14 +00:00
netnatm Forward declaring static variables as extern is invalid ISO-C. Now that 2005-09-07 10:06:14 +00:00
netncp Change API of mb_copy_t in libmchain so that netsmb can handle 2005-07-29 13:22:37 +00:00
netsmb Allow user to override default port numbers used by communication 2005-10-02 08:32:49 +00:00
nfs
nfs4client
nfsclient - Fix leak of struct nlminfo on process exit. 2005-10-26 07:18:37 +00:00
nfsserver Use the refcount API to manage the reference count for user credentials 2005-09-27 18:09:42 +00:00
opencrypto Fix bogus check. It was possible to panic the kernel by giving 0 length. 2005-08-18 11:58:03 +00:00
pc98 Catch up with new interrupt handling code. 2005-10-26 06:44:59 +00:00
pccard Remove the kernel portion of OLDCARD. I'm working on a replacement 2005-09-25 21:29:32 +00:00
pci Replace FreeBSD 3.x syntax (controller miibus0) with 4.x syntax 2005-10-22 05:06:55 +00:00
posix4 Const-qualify ksem_timedwait's parameter abstime as it's only passed in. 2005-10-18 11:46:24 +00:00
powerpc Reorganize the interrupt handling code a bit to make a few things cleaner 2005-10-25 19:48:48 +00:00
rpc Add GIANT_REQUIRED and WITNESS sleep warnings to uprintf() and tprintf(), 2005-09-19 16:51:43 +00:00
security Lock object while we iterate through it's backing objects. 2005-10-09 02:37:27 +00:00
sparc64 Reorganize the interrupt handling code a bit to make a few things cleaner 2005-10-25 19:48:48 +00:00
sys Add a swi_remove() function to teardown software interrupt handlers. For 2005-10-26 15:51:05 +00:00
tools Add convenience macros for bus_space usage that doesn't require specification 2005-09-24 20:11:07 +00:00
ufs Remove an unneeded "a" from comment. 2005-10-25 19:46:15 +00:00
vm Use of the ZERO_COPY_SOCKETS options can result in an unusual state that 2005-10-22 18:46:38 +00:00
Makefile