qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Schauer <j.schauer@email.de>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: [Qemu-devel] Bug#636035: qemu-user: init_paths() doesnt guard against recursive link cycles
Date: Sat, 30 Jul 2011 14:24:34 +0200	[thread overview]
Message-ID: <20110730122434.25086.45185.reportbug@hoothoot> (raw)

Package: qemu-user
Version: 0.14.1+dfsg-3
Severity: normal

Hi,

when a symbolic or hardlink which creates a recursive cycle exists in
the directory specified as the elf interpreter prefix
(default=/etc/qemu-binfmt/<arch>/), qemu-user will recursively traverse
this path and never finish (eating tons of memory in the process).

The easiest way to reproduce is to do:

ln -s '.' /etc/qemu-binfmt/<arch>/foobar

(or wherever directory you pointed qemu to with the -L option)

This is mostly annoying because there exists the /usr/bin/X11 symlink
which points to '.' in debian systems with x11-common installed.

Other problems occur with /proc/self/fd/ (and /dev/fd/ which links to
it) when /proc is mounted in the elf interpreter prefix path.

The problem occurs when init_paths() is called on interp_prefix (the elf
interpreter prefix path). init_paths() doesnt protect from infinitely
traversing cyclic symlinks.

find(1) solves this problem by maintaining a hashtable of (to be)
traversed directories and skipping directories that are found to be
already part of it.

I can prepare a patch for path.c (which defines init_paths()) which
guards against this behaviour in the same way that find(1) does if this
problem is desired to be solved that way.

cheers, josch

                 reply	other threads:[~2011-07-30 12:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110730122434.25086.45185.reportbug@hoothoot \
    --to=j.schauer@email.de \
    --cc=636035@bugs.debian.org \
    --cc=submit@bugs.debian.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).