Commit Graph

220 Commits

Author SHA1 Message Date
Ruslan Ermilov
042df2e2da Enable GCC stack protection (aka Propolice) for userland:
- It is opt-out for now so as to give it maximum testing, but it may be
  turned opt-in for stable branches depending on the consensus.  You
  can turn it off with WITHOUT_SSP.
- WITHOUT_SSP was previously used to disable the build of GNU libssp.
  It is harmless to steal the knob as SSP symbols have been provided
  by libc for a long time, GNU libssp should not have been much used.
- SSP is disabled in a few corners such as system bootstrap programs
  (sys/boot), process bootstrap code (rtld, csu) and SSP symbols themselves.
- It should be safe to use -fstack-protector-all to build world, however
  libc will be automatically downgraded to -fstack-protector because it
  breaks rtld otherwise.
- This option is unavailable on ia64.

Enable GCC stack protection (aka Propolice) for kernel:
- It is opt-out for now so as to give it maximum testing.
- Do not compile your kernel with -fstack-protector-all, it won't work.

Submitted by:	Jeremie Le Hen <jeremie@le-hen.org>
2008-06-25 21:33:28 +00:00
Ruslan Ermilov
967f568996 _setjmp.o was missing a dependency on "machine". 2008-04-29 17:42:42 +00:00
Ruslan Ermilov
692411eece Don't forget to clean the "machine" symlink on amd64, otherwise bad
things may happen.

Reported by:	phk
MFC after:	3 days
2008-04-29 17:37:01 +00:00
Doug Rabson
472f4537e6 On i386, don't try to do network-type stuff if the device name is'nt pxeN. 2008-04-05 15:03:29 +00:00
Maxim Sobolev
056c1a0528 Fix logical bug in the bzip2 reading code, which results in bogus EIO
returned on a perfectly valid bzip2 stream whose decompressed size
is multiple of read-ahead buffer size. Reproduce the problem is easy:
create some power-of-two sized file (truncate -s 1m file will do),
bzip2 it and try to load it as md_image from loader. See how it fails.

The bug doesn't affect gzip code (which most of bzip2-reading code was
copied from) probably due to the fact that libgzip doesn't report
Z_STREAM_END with the last block, but requires extra call to inflate()
to retrieve it and has some extra data in the input stream at that time.
However, apply similar fix to gzipfs.c just in the case the API will
change in the future to do what bzip2 code does.

Add some ifdef'ed code to enable testing bzipfs.c from witin normal
FreeBSD environment as opposed to the restricted loader one, so that
one can use gdb and whatnot.

Sponsored by:	Sippy Software, Inc., http://www.sippysoft.com/
MFC in:		7 days
2007-12-18 01:50:49 +00:00
John Baldwin
f352a0d45f First cut at support for booting a GPT labeled disk via the BIOS bootstrap
on i386 and amd64 machines.  The overall process is that /boot/pmbr lives
in the PMBR (similar to /boot/mbr for MBR disks) and is responsible for
locating and loading /boot/gptboot.  /boot/gptboot is similar to /boot/boot
except that it groks GPT rather than MBR + bsdlabel.  Unlike /boot/boot,
/boot/gptboot lives in its own dedicated GPT partition with a new
"FreeBSD boot" type.  This partition does not have a fixed size in that
/boot/pmbr will load the entire partition into the lower 640k.  However,
it is limited in that it can only be 545k.  That's still a lot better than
the current 7.5k limit for boot2 on MBR.  gptboot mostly acts just like
boot2 in that it reads /boot.config and loads up /boot/loader.  Some more
details:
- Include uuid_equal() and uuid_is_nil() in libstand.
- Add a new 'boot' command to gpt(8) which makes a GPT disk bootable using
  /boot/pmbr and /boot/gptboot.  Note that the disk must have some free
  space for the boot partition.
  - This required exposing the backend of the 'add' function as a
    gpt_add_part() function to the rest of gpt(8).  'boot' uses this to
    create a boot partition if needed.
- Don't cripple cgbase() in the UFS boot code for /boot/gptboot so that
  it can handle a filesystem > 1.5 TB.
- /boot/gptboot has a simple loader (gptldr) that doesn't do any I/O
  unlike boot1 since /boot/pmbr loads all of gptboot up front.  The
  C portion of gptboot (gptboot.c) has been repocopied from boot2.c.
  The primary changes are to parse the GPT to find a root filesystem
  and to use 64-bit disk addresses.  Currently gptboot assumes that the
  first UFS partition on the disk is the / filesystem, but this algorithm
  will likely be improved in the future.
- Teach the biosdisk driver in /boot/loader to understand GPT tables.
  GPT partitions are identified as 'disk0pX:' (e.g. disk0p2:) which is
  similar to the /dev names the kernel uses (e.g. /dev/ad0p2).
- Add a new "freebsd-boot" alias to g_part() for the new boot UUID.

MFC after:	1 month
Discussed with:	marcel (some things might still change, but am committing
			what I have so far)
2007-10-24 21:33:00 +00:00
Marius Strobl
da65d6fe83 - Given that we tell the compiler that struct ip is packed and 32-bit
aligned, GCC 4.2.1 also generates code for sendudp() that assumes
  this alignment. GCC 4.2.1 however doesn't 32-bit align wbuf, causing
  the loader to crash due to an unaligned access of wbuf in sendudp()
  when netbooting sparc64. Solve this by specifying wbuf as packed and
  32-bit aligned, too. As for lastdata and readudp() this currently is
  no issue when compiled with GCC 4.2.1, though give lastdata the same
  treatment as wbuf for consistency and possibility of being affected
  in the future. [1]
- Sprinkle const on a lookup table.

Reported by:		marcel [1]
Submitted by:		yongari [1]
Reviewed by:		marcel [1]
MFC after:		5 days
2007-10-21 17:03:18 +00:00
Yoshihiro Takahashi
51626c2003 Optimize for size on pc98. It enables to boot a kernel again.
I don't know what's wrong (loader, boot2 or others), but this change is
effective.

Tested by:	NAKAJI Hiroyuki
MFC after:	3 days
2007-10-15 14:20:24 +00:00
Alexander Kabaev
a6a026d5f8 Cast away const qualifier to squash GCC warning. 2007-04-04 03:29:02 +00:00
Warner Losh
ee7093a640 Remove California Regent's clause 3, per letter 2007-01-09 01:02:06 +00:00
Olivier Houchard
05b432d2d1 Instead of re-implementing hton[ls] and friends for each arch, add a new MI
file, net/ntoh.c, which just implement them using the inline functions from
<sys/endian.h>.

Suggested by:	bde
2006-11-06 22:07:47 +00:00
Ruslan Ermilov
2b46c64c9c Remove alpha left-overs. 2006-08-22 08:03:01 +00:00
Jung-uk Kim
0d84d9ebb5 Implement printf 'X' conversion for both libstand and kernel. 2006-03-09 22:37:34 +00:00
Ruslan Ermilov
94f5f5df3d Fix prototypes. 2005-11-24 11:14:06 +00:00
Dag-Erling Smørgrav
a92fef8afc Implement the full range of ISO9660 number conversion routines in iso.h.
MFC after:	2 weeks
2005-10-18 13:35:08 +00:00
Andrey A. Chernov
e775a53b59 Add -mno-sse3 for prescott/nocona 2005-07-15 12:29:31 +00:00
David E. O'Brien
b9a30e8043 Match sys/boot in ensure GCC does not use x86 FP registers in integer code.
Submitted by:	Pawel Worach <pawel.worach@gmail.com>
2005-06-03 06:55:22 +00:00
David E. O'Brien
c0a87c26b3 Back out revision 1.51, it is wrong. We don't litter -I's within lib
Makefiles to get headers from /usr/src vs. the standard include paths.
2005-05-31 20:39:53 +00:00
John Baldwin
ac0a0594f6 Use %z to print size_t values. 2005-05-31 20:01:58 +00:00
John Baldwin
7ab17e6d01 Just use uintptr_t and intptr_t rather than requiring each arch to provide
explicit int/long typedefs.
2005-05-31 20:01:18 +00:00
Maxim Sobolev
55f88dd25e Make bzip2 support working again after bzip2 upgrade. This time commit
BZ_NO_COMPRESS support to the bzip2 sources directly (yes, this takes file
off the vendor branch, but looks like bzip2 maintainer doesn't care), so that
it will not be removed when the next upgrade is performed. Also, add a short
note on how to test bzip2 support.

Pointy hat to:  obrien

Correct comment (libz -> libbz2) and remove useless full path to zutil.h
while I am here.
2005-05-29 21:56:38 +00:00
Maxim Sobolev
422d5081e1 Add missed ${.CURDIR}/../../contrib/bzip2 into include search path, otherwise
old version of bzlib.h can be picked up from the /usr/include.
2005-05-29 21:05:58 +00:00
Philippe Charnier
e479377e63 Remove unused variable. Shorten the path to WARNS=6 compliance. 2005-05-20 12:55:38 +00:00
Peter Wemm
d9d99c5478 Fix libstand on amd64. Rev 1.46 (obrien) removed the -I. that the
bzip2 support provided, and amd64 depended on.  Amd64 has a custom
${.OBJDIR}/machine symlink in it and the -I. picked this up.  Without
it, the libstand code was being compiled in 32 bit mode, but with 64 bit
machine headers.
2005-05-20 03:18:19 +00:00
David E. O'Brien
af753a20e9 Clean up an additional file. 2005-05-17 17:48:26 +00:00
David E. O'Brien
311d73f68e Don't use a patch w/in /usr/src. Programmatically change files when needed. 2005-05-17 17:46:29 +00:00
David E. O'Brien
d09dcfcfe9 Re-enable support for bzip2'ed compressed filesystems. 2005-05-17 16:22:54 +00:00
David E. O'Brien
1e2e63f657 Temporarily disable support for bzip2'ed compressed filesystems, until a
maintainable why of handling them is created.
2005-05-17 01:44:37 +00:00
Ruslan Ermilov
24a0682c64 Sort sections. 2005-01-20 09:17:07 +00:00
Tom Rhodes
8f79184fe2 Various markup and spelling fixes.
PR:		75574
Submitted by:	Nobuyuki Koganemaru <n-kogane@syd.odn.ne.jp> (original version)
2004-12-29 02:18:24 +00:00
Ruslan Ermilov
ab7a294721 NODOCCOMPRESS -> NO_DOCCOMPRESS
NOINFO -> NO_INFO
NOINFOCOMPRESS -> NO_INFOCOMPRESS
NOLINT -> NO_LINT
NOPIC -> NO_PIC
NOPROFILE -> NO_PROFILE
2004-12-21 09:33:47 +00:00
Ruslan Ermilov
a35d88931c For variables that are only checked with defined(), don't provide
any fake value.
2004-10-24 15:33:08 +00:00
Stefan Farfeleder
5a9e72a72b Don't add integers to void pointers. 2004-10-03 15:58:20 +00:00
Stefan Farfeleder
e60b9f5130 Prefer C99's __func__ over GCC's __FUNCTION__. 2004-09-22 16:56:49 +00:00
Ian Dowse
e3cce87239 Reset the seek pointer to 0 when a file is successfully opened,
since otherwise the initial seek offset will contain the directory
offset of the filesystem block that contained its directory entry.
This bug was mostly harmless because typically the directory is
less than one filesystem block in size so the offset would be zero.
It did however generally break loading a kernel from the (large)
kernel compile directory.

Also reset the seek pointer when a new inode is opened in read_inode(),
though this is not actually necessary now because all callers set
it afterwards.
2004-09-04 14:54:01 +00:00
Peter Pentchev
16d9177176 Bump the document date, since the content changed today.
Discussed with:	ru
2004-08-06 15:29:54 +00:00
Peter Pentchev
a222db0461 Fix a printf("%b", ..) example.
PR:		68849
Submitted by:	Michel Lavondes <fox@vader.aacc.cc.md.us>
MFC after:	1 week
2004-08-06 11:24:37 +00:00
Ruslan Ermilov
30950a21e1 Eliminate double whitespace. 2004-07-03 22:30:10 +00:00
Ruslan Ermilov
1a0a934547 Mechanically kill hard sentence breaks. 2004-07-02 23:52:20 +00:00
Tim J. Robbins
30e970d965 Update libstand makefile for zlib 1.2.1. 2004-07-01 00:01:26 +00:00
Olivier Houchard
027e3e1b0d Define iaddr_t and saddr_t for arm. 2004-05-14 13:32:13 +00:00
Olivier Houchard
bbf1290a6c Import _setjmp.S for arm in libstand. 2004-05-14 12:24:51 +00:00
Peter Grehan
bf7c848b97 No reason to disable this test on powerpc. 2004-02-25 00:53:06 +00:00
Peter Grehan
8509c106ef Use signed char cast to avoid out-of-range error on PowerPC (which has
unsigned char by default). This is a no-op on all other current arches.

Tested by: md5 sum before/after same on i386
2004-02-25 00:52:14 +00:00
John Baldwin
fb6b710c39 Clean up error handling in libstand filesystem code to be more consistent:
- bzipfs and gzipfs now properly return errno values directly from their
  read routines rather than returning -1.
- missing errno values on error returns for the seek routines on almost
  all filesystems were added.
- fstat() now returns -1 if an error occurs rather than ignoring it.
- nfs's readdir() routine now reports valid errno values if an error or
  EOF occurs rather than EPERM  (It was just returning 0 for success and
  1 for failure).
- nullfs used the wrong semantics for every function besides close() and
  seek().  Getting it right for close() appears to be an accident at that.
- read() for buffered files no longer returns 0 (EOF) if an error occurs,
  but returns -1 instead.
2004-01-21 20:12:23 +00:00
John Baldwin
7d45c61f20 - Move the code to try to open a single chunk file and prompt for the
associated floppy if needed into a static split_openfile() function.
- Use this function in splitfs_open() to open the first chunk rather
  than using open() directly.  This allows the first chunk to be located
  on a different disk than the actual foo.split file.
2004-01-15 18:38:15 +00:00
John Baldwin
4b609f5564 Whitespace tweaks to make indentation consistent within this file and even
within a single function.
2004-01-15 18:36:48 +00:00
John Baldwin
9e8e07fcda - Print out line number in a panic message using %d rather than %p. Line
numbers aren't pointers.
- Add a __printflike() attribute to libstand's panic() prototype to catch
  such bogons in the future.
2004-01-15 18:35:32 +00:00
Ruslan Ermilov
9b7d991dd4 Removed duplicate SRCS. 2004-01-11 17:23:31 +00:00
Brian Feldman
e083cf16d9 Implement seeking to earlier offsets in gzipfs. This allows my loader
to e.g. correctly load all .ko.gz's I've tried, as opposed to messing
up trying to read section headers on some of them.
2003-12-10 16:10:34 +00:00