History log of /external/squashfs-tools/squashfs-tools/pseudo.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
1727f1046c63c17d7efa53e1f3cb0198bbba823d 06-May-2014 Phillip Lougher <phillip@squashfs.org.uk> pseudo: protect against multiple inclusion

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
/external/squashfs-tools/squashfs-tools/pseudo.h
a8c9ff255d558fc86cc38f814b8a5626fcc0d702 29-Apr-2014 Phillip Lougher <phillip@squashfs.org.uk> mksquashfs: fix limit on the number of dynamic pseudo files

Dynamic pseudo files exist to enable users to dynamically
create files which don't actually exist in the source filesystem,
where the contents of the file are obtained from running
a command or piece of shell.

For instance

"a_file f 0777 root root dmesg"

will create a file named "a_file", which has the output of "dmesg"
as its contents.

When I implemented "dynamic pseudo files" I anticipated they would
be used for a limited amount of files. As such, when I implemented
them, I had Mksquashfs at start-up run through the set of dynamic
pseudo files and fork and exec the commands/shell upfront, with
Mksquashfs later reading from the pipes connecting the forked processes
at file system generation when that part of the filesystem was generated.

Doing this ensured maximum parallelism, as it allowed the forked
processes to run and produce output in parallel with Mksquashfs. By
the time the output of the processes was needed in filesystem
generation it was anticipated the forked processes run in parallel
would have finished any computation, and would be waiting to output
(or if the output was small, it would already be buffered in the pipe).

But this strategy had a known defect. It relied on the fact that
the total number of dynamic pseudo files when kicked off in their
entirety at Mksquashfs startup would not exceed process limits or
open file limits (each pipe created uses fds, and there's normally
omly 1024 that can be open at the same time by the ultimate parent
Mksquashfs process). Due to the fact I assumed dynamic pesudo files
would be only used for a limited number of files, this seemed like
worrying about a defect that would never in practice occur.

But, quite unexpectedly, I received a bug report last year where
a user tried to do exactly that, a pseudo file with more than 1000
dynamic pseudo files, and of course Mksquashfs failed when the
maximum open file limit was reached.

So, this commit fixes that bug. Dynamic pseudo file process creation
has been moved to the reader thread, and the process is created when
the output from that process is needed in filesystem generation, ensuring
the reader thread can read the sub-process' output and wait for it to die
and reap the resources used (pipe fds etc.) before starting another
dynamic pseudo file process. This ensures the minimal amount of
processes/fds/memory is in use at any one time by the pseudo file
processes and therefore prevents users from "mis-using" the
dynamic pseudo facility to create a DOS (denial of service) situation
where system limits are exceeded.

Note, I do not suspect the user who reported the bug of trying to
deliberately exploit a weakness in Mksquashfs to generate a DOS
situation, this appears to be one of the cases where a user wanted
to create many dynamic pseudo files and came accross this bug
by accident.

But, this bug needed to be fixed, both for the users who need to
create lots of dynamic pseudo files, and to close a "system resource
exhaustion" vulnerability.

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
/external/squashfs-tools/squashfs-tools/pseudo.h
7a28f7a57b9b1fec0f6f1a0ab0cd94dd7881d673 21-Apr-2014 Phillip Lougher <phillip@squashfs.org.uk> pseudo: fix pseudo definition dumping and actually call it

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
/external/squashfs-tools/squashfs-tools/pseudo.h
5ef2eba370311345600a0609175f08973e7510a0 24-Dec-2012 Phillip Lougher <phillip@squashfs.org.uk> pseudo: Move pseudo variable from mksquashfs.c to pseudo.c

Move and make pseudo variable mostly private to pseudo. This eliminates
the need to pass it to and from read_pseudo_def() and read_pseudo_file().

It is now only needed for dir_scan2() and so add an accessor get_pseudo()
for it in pseudo.c.

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
/external/squashfs-tools/squashfs-tools/pseudo.h
83d42a3fc898962aa1f1e8387f2ccb1114e0d294 01-Nov-2012 Phillip Lougher <phillip@squashfs.org.uk> Update email address

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
/external/squashfs-tools/squashfs-tools/pseudo.h
8db6d288d01afc5464965b0bde8106cd7360c543 16-Oct-2012 Phillip Lougher <phillip@squashfs.org.uk> Update copyright dates

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
/external/squashfs-tools/squashfs-tools/pseudo.h
e80f5c85abc4160f60a384fffec759900147f494 25-Aug-2010 plougher <plougher> Fix copyright dates - these files didn't exist before 2009!
/external/squashfs-tools/squashfs-tools/pseudo.h
1ebb6e9932d448097d769f1366d8adaae797ea64 22-Jul-2010 plougher <plougher> Wrap some lines
/external/squashfs-tools/squashfs-tools/pseudo.h
11e7b1b6fe39cced2eefa83b6de6cdcd0b4ff1ab 11-Sep-2009 plougher <plougher> Delete tmp files
/external/squashfs-tools/squashfs-tools/pseudo.h
ba674e80dcf875e17ce5eedd057f530ae07a0ab4 10-Sep-2009 plougher <plougher> Various improvements to dynamic pseudo file code. Plus add a waitpid()
when reading dynamic files using a pipe
/external/squashfs-tools/squashfs-tools/pseudo.h
d63f166656cb908337900f53f5332d2b1bd09496 09-Sep-2009 plougher <plougher> Refactor #ifdef USE_TMP_FILE code
/external/squashfs-tools/squashfs-tools/pseudo.h
00d08177d2d5d1b8a5ea3f56459006ba9501335e 03-Sep-2009 plougher <plougher> Don't use temporary file in dynamic pseudo files
/external/squashfs-tools/squashfs-tools/pseudo.h
d197d2813d0b05f5539b2d13c68b78b758fe3887 05-May-2009 plougher <plougher> Add structure definitions for new dynamic pseudo file
/external/squashfs-tools/squashfs-tools/pseudo.h
888885a8f21fc7fa0fc12fcd5037d2862bddbc0a 05-Apr-2009 plougher <plougher> First checkin of pseudo file support files
/external/squashfs-tools/squashfs-tools/pseudo.h