Commit Graph

105 Commits

Author SHA1 Message Date
Ed Maste
203b6f692c makefs: use ENTRY macro for diff reduction with NetBSD
Sponsored by:	The FreeBSD Foundation
2015-12-21 16:12:41 +00:00
Ed Maste
6d90cbf05d Remove clauses 3 and 4 from makefs newfs_extern.h
Obtained from:	NetBSD
2015-11-19 02:39:46 +00:00
Enji Cooper
042c83fdc8 Bump .Dd 2015-11-09 09:39:59 +00:00
Enji Cooper
daf5e00077 Follow up to r290259 dealing with makefs(8)
- Don't use contractions (don't -> do not)
- Change "throw away" to "discard" when describing the -o keep-bad-images option
- Revert author e-mail split I brought over from NetBSD, effectively reverting
  the change bapt made in r267668

MFC after: 3 days
Submitted by: bjk
Sponsored by: EMC / Isilon Storage Division
2015-11-09 09:39:07 +00:00
Enji Cooper
126b73dd8b Add testcases for -t ffs -o version=[12]
Verify the filesystem type using dumpfs. Add preliminary support
for NetBSD (needs to be validated)

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-11-02 11:06:51 +00:00
Enji Cooper
fc062a4bd7 Sync minor whitespace / type changes in ffs_csum_swap and ffs_sb_swap with
src/sys/ufs/ffs/ffs_bswap.c@1.39

Obtained from: NetBSD
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-11-02 10:09:09 +00:00
Enji Cooper
c213f0dbec Clean up mtree keyword support a slight bit and add a few more default keywords
- Parameterize the mtree keywords as $DEFAULT_MTREE_KEYWORDS
- Test with the extra mtree keywords, `mode,gid,uid`.
- Add a note about mtrees with time support not working with makefs right now

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-11-02 10:08:00 +00:00
Enji Cooper
10bd272504 Add testcases for -t cd9660 -o isolevel=[1-3]
-- -o isolevel=1 currently fails because of path comparison issues,
   so mark it as an expected failure.
-- -o isolevel=3 is not implemented, so expect it to fail as an out
   of bounds value [*].

PR: 203645
MFC after: 1 week
X-MFC with: r290264
Sponsored by: EMC / Isilon Storage Division
2015-11-02 09:16:51 +00:00
Enji Cooper
bc06965ace Limit isoLevel to 1 and 2 to avoid segfaulting when isoLevel is set to 3 by
dereferencing a NULL function pointer

Add some asserts to ensure that isolevel is always either 1 or 2.

PR: 203645
Reported by: Thomas Schmitt <scdbackup@gmx.net>
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-11-02 08:43:15 +00:00
Enji Cooper
eac300b82d Fix spelling of isolevel cd9660 option
MFC after: 1 week
X-MFC with: r290260
Sponsored by: EMC / Isilon Storage Division
2015-11-02 07:46:47 +00:00
Enji Cooper
3d765991ed Bump .Dd for r290259 and r290260 2015-11-02 07:42:42 +00:00
Enji Cooper
6dbfd3d67c Document undocumented long options for -t cd9660
Note which options have been implemented and which options haven't
been implemented

Submitted as the following NetBSD PRs: bin/50390 and bin/50392

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-11-02 07:40:18 +00:00
Enji Cooper
93c2e8006a Sync makefs(8) content a bit with src/usr.sbin/makefs/makefs.8@1.53
Sections involving unimplemented filesystems (chfs, msdosfs, udf, v7fs) and
options have been omitted.

MFC after: 1 week
Obtained from: NetBSD
Sponsored by: EMC / Isilon Storage Division
2015-11-02 07:36:42 +00:00
Enji Cooper
78d2334f0d Follow up to roundup feature addition in r289203
- Rename -r to -R to avoid the clash with makefs -r in NetBSD
- Note that -R is an FFS-specific option because it's not implemented
  in cd9660 today
- Rename the roundup variable to "roundup-size" in the manpage and help
  text for consistency with other variables.
- Bump .Dd (missed in r289203)

PR: 203707
MFC after: 1 week
X-MFC with: r289203
Differential Revision: https://reviews.freebsd.org/D3959
Reviewed by: adrian (earlier patch), emaste
Sponsored by: EMC / Isilon Storage Division
2015-10-30 05:55:56 +00:00
Enji Cooper
dc50fb3673 Add a regression test for r289899 to validate rockridge encoding
of device types

X-MFC with: r289899
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
2015-10-24 23:21:08 +00:00
Enji Cooper
fb9ab5ec6b Remove an ls -l I was using for debugging
MFC after: 2 weeks
X-MFC with: r289897
Sponsored by: EMC / Isilon Storage Division
2015-10-24 23:19:24 +00:00
Enji Cooper
fc002adafd Import the fix from NetBSD kern/48852 (sic) to fix rockridge encoding of
device nodes

In particular, use st_rdev (the device type), not st_dev (the device inode),
and fix the comparison to be correct with the st_rdev field

Bug 203648
MFC after: 2 weeks
Submitted by: Thomas Schmitt <scdbackup@gmx.net>
Coverity CID: 1008927
Sponsored by: EMC / Isilon Storage Division
2015-10-24 23:16:13 +00:00
Enji Cooper
fc2b053656 Add more cd9660/FFS makefs testcases
General changes:
- Parameterize out the mount command.
- Use mtree to verify the contents of an image (check_image_contents) instead
  of using diff (diff verifies content, but not file metadata).
- Move common logic out to functions (common_cleanup, mount_image,
  check_image_contents)
- Add stub testcases for makefs -D (crashes with SIGBUS, similar to bug # 192839)
- Add a note about the ISO-9660 and rockridge specs
- Add testcases that exercise:
-- Creating disk images from an mtree and multiple directories.
-- -F flag use (not really an extensive testcase right now)

cd9660-specific test changes:

- Remove an XXX comment about symlinks; I forgot that non-rockridge images turn
  symlinks into hardlinks.
- Add testcases that exercise:
-- -o allow-deep-trees
-- -o allow-max-name stub testcase (doesn't seem to be implemented in makefs)
-- -o preparer (existence in image; not conformance to spec)
-- -o publisher (existence in image; not conformance to spec)
-- -o rockridge (basic)

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
2015-10-24 22:12:23 +00:00
Enji Cooper
66845bf5c5 Revise "create_test_inputs" to simplify the file structure as
these testcases don't need to be nested as much as bin/ls/ls_tests.sh
do when verifying ls -a, ls -A, etc. This allows the tests to make
all paths relative to the top of the temporary directory instead of
always tacking on $ATF_TMPDIR, thus complicating things unnecessarily

Create non-empty files in create_test_inputs as well now, similar to
create_test_inputs2 in bin/ls/ls_tests.sh

Compare the input files to the output file contents using diff where
possible:
- Skip over the fifo comparison for now because it always fails
- Skip over the symlink comparison on cd9660 because it always fails
  today

Sponsored by: EMC / Isilon Storage Division
MFC after: 2 weeks
X-MFC with: r289739
2015-10-22 07:22:05 +00:00
Enji Cooper
7bdfc3b75e Correctly reintroduce the rudimentary smoke tests I botched up
in r289684

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
2015-10-22 05:32:45 +00:00
Enji Cooper
6cf8c0fe51 Revert r289694
I committed some other undesirable local changes by accident
2015-10-21 13:15:04 +00:00
Enji Cooper
b4c3ec123e Add some rudimentary [smoke] testcases for makefs
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
2015-10-21 13:13:38 +00:00
Enji Cooper
42afd55d1e Unbreak makefs -t cd9660 after r289687
buffer_head needs to be freed -- not buffer

Detected by jemalloc, i.e. running makefs failed the arena assert
because my copy of malloc on CURRENT is compiled with the default
!MALLOC_PRODUCTION asserts on

Pointyhat to: ngie
PR: 203647
X-MFC with: r289687
Sponsored by: EMC / Isilon Storage Division
2015-10-21 12:54:15 +00:00
Enji Cooper
b73321f086 Free buffer before returning from cd9660_write_path_table to avoid
leaking it after returning from the function

MFC after: 1 week
PR: 203647
Submitted by: Thomas Schmitt <scdbackup@gmx.net>
Coverity CID: 978431
Sponsored by: EMC / Isilon Storage Division
2015-10-21 11:38:48 +00:00
Eitan Adler
463a577b27 Fix a ton of speelling errors
arc lint is helpful

Reviewed By: allanjude, wblock, #manpages, chris@bsdjunk.com
Differential Revision: https://reviews.freebsd.org/D3337
2015-10-21 05:37:09 +00:00
Enji Cooper
d2a489eb1a Don't check if val is NULL before calling free; free(3) already
handles this

MFC after: 1 week
PR: 203649
Submitted by: Thomas Schmitt <scdbackup@gmx.net>
Coverity CID: 1305659
Sponsored by: EMC / Isilon Storage Division
2015-10-19 18:45:14 +00:00
Sean Bruno
24484ca4bf makefs(8) leaves sblock.fs_providersize uninitialized (zero) that can be easily
checked with dumpfs(8). This may lead to other problems, f.e. geom_label kernel
module sanity checks do not like zero fs_old_size value and skips such UFS1
file system while tasting (fs_old_size derives from sblock.fs_providersize).

PR:	203704
Submitted by:	eugen@grosbein.net
Reviewed by:	marcel
2015-10-13 17:00:14 +00:00
Adrian Chadd
a08b904c5e makefs: introduce a new option to specify what to round the resulting
image up to.

From ticket:

While trying to run FreeBSD/mips on some device having very small flash media,
one is forced to compress file system with mkulzma(8) utility. It is desirable
to specify small UFS block/fragment sizes like 4096/512 bytes for makefs(8)
and big compression block size like 65535 bytes to mkulzma at the same time.
Then one obtains very good comression ratios (like 75% and more) but faces
the following problem.

geom_uncompress kernel module reports GEOM provider size rounded up to its
compression block size. Generally, this changes original media size and now
it fails to match the size of embedded UFS file system that leads to other
problems, f.e. geom_label kernel module does not like this and skips the
file system while tasting the GEOM and looking for UFS label.

This makes it impossible to refer to the file system using known UFS label
instead of something like /dev/map/rootfs.uncompress.

The following patch introduces new command line option "-r roundup" for makefs
that makes it round up the image to specified block size. Hence, geom_uncompress
does not change GEOM media size for images rounded that way and geom_label
accepts such GEOMs just fine.

With the patch applied, one can use following commands:

$ makefs -t ffs -r 65536 -o bsize=4096,fsize=512,label=flash optimization=space fs.img fs
$ mkulzma -s 65536 -o fs.img.ulzma fs.img

PR:		bin/203707
Submitted by:	<eugen@grosbein.net>
2015-10-13 02:32:15 +00:00
Xin LI
65b4f27054 Don't leak 'var'.
Reported by:	clang static analyzer
2015-09-03 01:15:23 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty
98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Christian Brueffer
8b36eba6c0 Fix a typo in the FFS maxbpg option, it was erroneously spelled maxbpf.
The error exists in the NetBSD upstream version as well and will be reported back.

PR:		196598
Submitted by:	Dan McGregor
MFC after:	1 week
2015-01-12 19:26:31 +00:00
Baptiste Daroussin
2df4d9628a Convert makefs to LIBADD
Add definition of libnetbsd in src.libnames.mk
2014-11-24 22:15:30 +00:00
Simon J. Gerraty
9268022b74 Merge from head@274682 2014-11-19 01:07:58 +00:00
Davide Italiano
9d5a327fb5 r258695 introduces a sanity check for makefs in order to verify that
the minimum image size specified is always less than the maximum
image size. If makefs(1) is invoked specifying minimum image size,
but not maximum one, the program exits with an error. Example:

# sudo -E makefs -M 538968064 -B be /home/davide/disk.img $DESTDIR
makefs: `/home/davide/tftproot/mips' minsize of 538968064 rounded up
to ffs bsize of 8192 exceeds maxsize 0.  Lower bsize, or round the
minimum and maximum sizes to bsize.

Assert then that minsize < maxsize iff maxsize is specified.
This change allows me to build MIPS images using makefs(1) and following
what specified in the wiki again.

Reviewed by:	jmallett, ngie
2014-09-18 03:11:59 +00:00
Bryan Drewery
5608fd23c2 Revert r267233 for now. PIE support needs to be reworked.
1. 50+% of NO_PIE use is fixed by adding -fPIC to INTERNALLIB and other
   build-only utility libraries.
2. Another 40% is fixed by generating _pic.a variants of various libraries.
3. Some of the NO_PIE use is a bit absurd as it is disabling PIE (and ASLR)
   where it never would work anyhow, such as csu or loader. This suggests
   there may be better ways of adding support to the tree. Many of these
   cases can be fixed such that -fPIE will work but there is really no
   reason to have it in those cases.
4. Some of the uses are working around hacks done to some Makefiles that are
   really building libraries but have been using bsd.prog.mk because the code
   is cleaner. Had they been using bsd.lib.mk then NO_PIE would not have
   been needed.

We likely do want to enable PIE by default (opt-out) for non-tree consumers
(such as ports). For in-tree though we probably want to only enable PIE
(opt-in) for common attack targets such as remote service daemons and setuid
utilities. This is also a great performance compromise since ASLR is expected
to reduce performance. As such it does not make sense to enable it in all
utilities such as ls(1) that have little benefit to having it enabled.

Reported by:	kib
2014-08-19 15:04:32 +00:00
Simon J. Gerraty
ee7b0571c2 Merge head from 7/28 2014-08-19 06:50:54 +00:00
Baptiste Daroussin
01c2b8ac0d use .Mt to mark up email addresses consistently (part2)
PR:		191174
Submitted by:	Franco Fichtner  <franco@lastsummer.de>
2014-06-20 09:57:27 +00:00
Bryan Drewery
864c53ead8 In preparation for ASLR [1] support add WITH_PIE to support building with -fPIE.
This is currently an opt-in build flag. Once ASLR support is ready and stable
it should changed to opt-out and be enabled by default along with ASLR.

Each application Makefile uses opt-out to ensure that ASLR will be enabled by
default in new directories when the system is compiled with PIE/ASLR. [2]

Mark known build failures as NO_PIE for now.

The only known runtime failure was rtld.

[1] http://www.bsdcan.org/2014/schedule/events/452.en.html
Submitted by:		Shawn Webb <lattera@gmail.com>
Discussed between:	des@ and Shawn Webb [2]
2014-06-08 17:29:31 +00:00
John-Mark Gurney
646fc9ccad convert to using the _daddr_t types like newfs was...
Put the superblock in the correct possition for UFS2... There is a bug
in FFS that if we don't put it here (for UFS2), it will forcefully
relocate the superblock, and I believe cause data loss..

I have a fix for that, but w/ how many releases are broken, we won't be
able to switch to the better _FLOPPY (block 0) for this for a while..
2014-05-31 20:26:34 +00:00
Simon J. Gerraty
fae50821ae Updated dependencies 2014-05-16 14:09:51 +00:00
Simon J. Gerraty
76b28ad6ab Updated dependencies 2014-05-10 05:16:28 +00:00
Simon J. Gerraty
3b8f084595 Merge head 2014-04-28 07:50:45 +00:00
Marcel Moolenaar
4ceda9d362 Timestamps may not have a decimal point.
While here, consistently use sbuf_new_auto().
2014-04-06 02:57:49 +00:00
Simon J. Gerraty
12a5ad4762 Allow comments at end of line.
Reviewed by: marcel
2014-03-04 20:09:23 +00:00
Marius Strobl
516e016844 Record the IEEE P1282 Rock Ridge version 1.12 POSIX File Serial Number,
i. e. the POSIX:5.6.1 st_ino field, which can be used to detect hard links
in the file system. This is also the default in mkisofs(8) and according to
its man page, no system only being able to cope with Rock Ridge version 1.10
is known to exist.

PR:		185138
Submitted by:	Kurt Lidl
MFC after:	1 week
2013-12-29 16:43:35 +00:00
Juli Mallett
5ad283b3c6 Provide a helpful diagnostic when the minimum size rounded to the block size
would exceed the maximum size.  This can be a difficult problem to diagnose
if one is, for instance, using -s with a fixed size in a script and the bsize
calculated for a filesystem image changes, necessitating a re-rounding of the
image size or a hand-setting of the bsize.  Previously one would get a
cryptic message about how the size exceeded the maximum size, which normally
only happens if the contents of the image are larger than specified.
2013-11-27 21:55:43 +00:00
Simon J. Gerraty
34b33809b7 Updated dependencies 2013-10-13 00:24:00 +00:00
Simon J. Gerraty
d1d0158641 Merge from head 2013-09-05 20:18:59 +00:00