* [PATCH 0/1] Move PSEUDO_LOCALSTATEDIR outside rootfs
@ 2012-08-21 18:31 Peter Seebach
2012-08-21 18:31 ` [PATCH 1/1] runqemu-export-rootfs and friends: don't put pseudo db in target fs Peter Seebach
0 siblings, 1 reply; 6+ messages in thread
From: Peter Seebach @ 2012-08-21 18:31 UTC (permalink / raw)
To: openembedded-core
There's a race condition in one of our (non-poky) builds which involves
a rootfs getting deleted while a pseudo process has a db in it open.
This caused me to realize that there existed a pseudo database in a
target filesystem, which made me panic. And we have a few really strange
reports I've never been able to reproduce where target filesystems
under qemu went pear-shaped in ways that look like pseudo suddenly
got really, really, confused.
Like say what would happen if a target could wipe out its own filesystem
permissions, because they were in its rootfs. :P
I haven't tested this super thoroughly, but I can still complete builds
and SDK builds with it, and it makes sense.
The following changes since commit 4ef8960c8d2876914bb78cbdce5fae3c5297e942:
Khem Raj (1):
gcc-cross-intermediate, gcc-crosssdk-intermediate: Remove
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib seebs/varpseudo
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=seebs/varpseudo
Peter Seebach (1):
runqemu-export-rootfs and friends: don't put pseudo db in target fs
.../installer/adt-installer/scripts/extract_rootfs | 7 +++----
scripts/runqemu-export-rootfs | 2 +-
scripts/runqemu-extract-sdk | 13 +++++++------
3 files changed, 11 insertions(+), 11 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 1/1] runqemu-export-rootfs and friends: don't put pseudo db in target fs
2012-08-21 18:31 [PATCH 0/1] Move PSEUDO_LOCALSTATEDIR outside rootfs Peter Seebach
@ 2012-08-21 18:31 ` Peter Seebach
2012-08-22 16:34 ` Scott Garman
0 siblings, 1 reply; 6+ messages in thread
From: Peter Seebach @ 2012-08-21 18:31 UTC (permalink / raw)
To: openembedded-core
In a few places, we have scripts which use <rootfs>/var/pseudo for
the pseudo state directory controlling a given filesystem. This
seems possibly risky because it means that stuff running under
qemu or whatnot could wipe out the data being used to handle that
rootfs.
Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
---
| 7 +++----
scripts/runqemu-export-rootfs | 2 +-
| 13 +++++++------
3 files changed, 11 insertions(+), 11 deletions(-)
--git a/meta/recipes-devtools/installer/adt-installer/scripts/extract_rootfs b/meta/recipes-devtools/installer/adt-installer/scripts/extract_rootfs
index 62dc170..0bbbeef 100755
--- a/meta/recipes-devtools/installer/adt-installer/scripts/extract_rootfs
+++ b/meta/recipes-devtools/installer/adt-installer/scripts/extract_rootfs
@@ -28,7 +28,6 @@ extract_rootfs()
native_sysroot=$3
target_sysroot=$2
PSEUDO_COMMAND="$native_sysroot/usr/bin/pseudo"
- PSEUDO_OPTS="-P $natvie_sysroot/usr"
TAR_OPTS="-xjf"
PSEUDO_OPTS="-P $native_sysroot/usr"
@@ -46,9 +45,9 @@ extract_rootfs()
mkdir -p "$target_sysroot"
fi
- mkdir -p "$target_sysroot/var/pseudo"
- touch "$target_sysroot/var/pseudo/pseudo.pid"
- PSEUDO_LOCALSTATEDIR="$target_sysroot/var/pseudo"
+ mkdir -p "$target_sysroot/../pseudo_state"
+ touch "$target_sysroot/../pseudo_state/pseudo.pid"
+ PSEUDO_LOCALSTATEDIR="$target_sysroot/../pseudo_state"
export PSEUDO_LOCALSTATEDIR
echo_info "Extracting rootfs: $1, using pseudo..."
diff --git a/scripts/runqemu-export-rootfs b/scripts/runqemu-export-rootfs
index f8213ba..9b7941b 100755
--- a/scripts/runqemu-export-rootfs
+++ b/scripts/runqemu-export-rootfs
@@ -68,7 +68,7 @@ NFSPID=~/.runqemu-sdk/nfs$NFS_INSTANCE.pid
MOUNTPID=~/.runqemu-sdk/mount$NFS_INSTANCE.pid
PSEUDO_OPTS="-P $OECORE_NATIVE_SYSROOT/usr"
-PSEUDO_LOCALSTATEDIR="$NFS_EXPORT_DIR/var/pseudo"
+PSEUDO_LOCALSTATEDIR="$NFS_EXPORT_DIR/../pseudo_state"
export PSEUDO_LOCALSTATEDIR
if [ ! -d "$PSEUDO_LOCALSTATEDIR" ]; then
--git a/scripts/runqemu-extract-sdk b/scripts/runqemu-extract-sdk
index 4b52475..8bab333 100755
--- a/scripts/runqemu-extract-sdk
+++ b/scripts/runqemu-extract-sdk
@@ -73,15 +73,16 @@ if [ ! -d "$SDK_ROOTFS_DIR" ]; then
mkdir -p "$SDK_ROOTFS_DIR"
fi
-if [ -e "$SDK_ROOTFS_DIR/var/pseudo" ]; then
- echo "Error: $SDK_ROOTFS_DIR/var/pseudo already exists!"
- echo "Please delete the entire rootfs tree manually if this is really what you want"
+if [ -e "$SDK_ROOTFS_DIR/../pseudo_state" ]; then
+ echo "Error: $SDK_ROOTFS_DIR/../pseudo_state already exists!"
+ echo "Please delete the rootfs tree and pseudo directory manually"
+ echo "if this is really what you want."
exit 1
fi
-mkdir -p "$SDK_ROOTFS_DIR/var/pseudo"
-touch "$SDK_ROOTFS_DIR/var/pseudo/pseudo.pid"
-PSEUDO_LOCALSTATEDIR="$SDK_ROOTFS_DIR/var/pseudo"
+mkdir -p "$SDK_ROOTFS_DIR/../pseudo_state"
+touch "$SDK_ROOTFS_DIR/../pseudo_state/pseudo.pid"
+PSEUDO_LOCALSTATEDIR="$SDK_ROOTFS_DIR/../pseudo_state"
export PSEUDO_LOCALSTATEDIR
echo "Extracting rootfs tarball using pseudo..."
--
1.7.0.4
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH 1/1] runqemu-export-rootfs and friends: don't put pseudo db in target fs
2012-08-21 18:31 ` [PATCH 1/1] runqemu-export-rootfs and friends: don't put pseudo db in target fs Peter Seebach
@ 2012-08-22 16:34 ` Scott Garman
2012-08-22 19:20 ` Peter Seebach
2012-08-22 19:39 ` Richard Purdie
0 siblings, 2 replies; 6+ messages in thread
From: Scott Garman @ 2012-08-22 16:34 UTC (permalink / raw)
To: openembedded-core
On 08/21/2012 11:31 AM, Peter Seebach wrote:
> In a few places, we have scripts which use <rootfs>/var/pseudo for
> the pseudo state directory controlling a given filesystem. This
> seems possibly risky because it means that stuff running under
> qemu or whatnot could wipe out the data being used to handle that
> rootfs.
>
> Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
> ---
> .../installer/adt-installer/scripts/extract_rootfs | 7 +++----
> scripts/runqemu-export-rootfs | 2 +-
> scripts/runqemu-extract-sdk | 13 +++++++------
> 3 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/meta/recipes-devtools/installer/adt-installer/scripts/extract_rootfs b/meta/recipes-devtools/installer/adt-installer/scripts/extract_rootfs
> index 62dc170..0bbbeef 100755
> --- a/meta/recipes-devtools/installer/adt-installer/scripts/extract_rootfs
> +++ b/meta/recipes-devtools/installer/adt-installer/scripts/extract_rootfs
> @@ -28,7 +28,6 @@ extract_rootfs()
> native_sysroot=$3
> target_sysroot=$2
> PSEUDO_COMMAND="$native_sysroot/usr/bin/pseudo"
> - PSEUDO_OPTS="-P $natvie_sysroot/usr"
> TAR_OPTS="-xjf"
> PSEUDO_OPTS="-P $native_sysroot/usr"
>
> @@ -46,9 +45,9 @@ extract_rootfs()
> mkdir -p "$target_sysroot"
> fi
>
> - mkdir -p "$target_sysroot/var/pseudo"
> - touch "$target_sysroot/var/pseudo/pseudo.pid"
> - PSEUDO_LOCALSTATEDIR="$target_sysroot/var/pseudo"
> + mkdir -p "$target_sysroot/../pseudo_state"
> + touch "$target_sysroot/../pseudo_state/pseudo.pid"
> + PSEUDO_LOCALSTATEDIR="$target_sysroot/../pseudo_state"
> export PSEUDO_LOCALSTATEDIR
This would mean that if someone tried to put multiple rootfs directories
in the same subdirectory, they could clobber each other's pseudo_state
data, correct? Putting multiple rootfs directories in the same subdir is
a common use case already, I don't think we could break that.
If you appended the top-level rootfs directory name to ../pseudo_state,
e.g, ../pseudo_state_<dirname>, that would keep the pseudo_state
directories separate and make it fairly obvious what rootfs they
belonged to.
Also, neither of these schemes would support having $target_sysroot
directly under / (though I'm not sure why someone would do that).
Scott
--
Scott Garman
Embedded Linux Engineer - Yocto Project
Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] runqemu-export-rootfs and friends: don't put pseudo db in target fs
2012-08-22 16:34 ` Scott Garman
@ 2012-08-22 19:20 ` Peter Seebach
2012-08-22 19:39 ` Richard Purdie
1 sibling, 0 replies; 6+ messages in thread
From: Peter Seebach @ 2012-08-22 19:20 UTC (permalink / raw)
To: Scott Garman; +Cc: openembedded-core
On Wed, 22 Aug 2012 09:34:35 -0700
Scott Garman <scott.a.garman@intel.com> wrote:
> This would mean that if someone tried to put multiple rootfs
> directories in the same subdirectory, they could clobber each other's
> pseudo_state data, correct? Putting multiple rootfs directories in
> the same subdir is a common use case already, I don't think we could
> break that.
Good catch!
I didn't realize this was a common use case.
> If you appended the top-level rootfs directory name
> to ../pseudo_state, e.g, ../pseudo_state_<dirname>, that would keep
> the pseudo_state directories separate and make it fairly obvious what
> rootfs they belonged to.
Good idea.
> Also, neither of these schemes would support having $target_sysroot
> directly under / (though I'm not sure why someone would do that).
Yeah. I don't really like having the pseudo stuff outside the
directory, but I dislike it less than I dislike having it in the
directory. :)
-s
--
Listen, get this. Nobody with a good compiler needs to be justified.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] runqemu-export-rootfs and friends: don't put pseudo db in target fs
2012-08-22 16:34 ` Scott Garman
2012-08-22 19:20 ` Peter Seebach
@ 2012-08-22 19:39 ` Richard Purdie
2012-08-27 16:17 ` Peter Seebach
1 sibling, 1 reply; 6+ messages in thread
From: Richard Purdie @ 2012-08-22 19:39 UTC (permalink / raw)
To: Scott Garman; +Cc: openembedded-core
On Wed, 2012-08-22 at 09:34 -0700, Scott Garman wrote:
> This would mean that if someone tried to put multiple rootfs directories
> in the same subdirectory, they could clobber each other's pseudo_state
> data, correct? Putting multiple rootfs directories in the same subdir is
> a common use case already, I don't think we could break that.
>
> If you appended the top-level rootfs directory name to ../pseudo_state,
> e.g, ../pseudo_state_<dirname>, that would keep the pseudo_state
> directories separate and make it fairly obvious what rootfs they
> belonged to.
I'd wondered about this too. Can you use <dirname>.pseudo_state to make
the list sort better and help people with tab completion and so on? :)
Cheers,
Richard
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] runqemu-export-rootfs and friends: don't put pseudo db in target fs
2012-08-22 19:39 ` Richard Purdie
@ 2012-08-27 16:17 ` Peter Seebach
0 siblings, 0 replies; 6+ messages in thread
From: Peter Seebach @ 2012-08-27 16:17 UTC (permalink / raw)
To: Richard Purdie; +Cc: openembedded-core, Scott Garman
On Wed, 22 Aug 2012 20:39:24 +0100
Richard Purdie <richard.purdie@linuxfoundation.org> wrote:
> I'd wondered about this too. Can you use <dirname>.pseudo_state to
> make the list sort better and help people with tab completion and so
> on? :)
This is even BETTER. And since my previous submission had a Hilarious
Typo in it, I'll revise with this too.
-s
--
Listen, get this. Nobody with a good compiler needs to be justified.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-08-27 16:30 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-21 18:31 [PATCH 0/1] Move PSEUDO_LOCALSTATEDIR outside rootfs Peter Seebach
2012-08-21 18:31 ` [PATCH 1/1] runqemu-export-rootfs and friends: don't put pseudo db in target fs Peter Seebach
2012-08-22 16:34 ` Scott Garman
2012-08-22 19:20 ` Peter Seebach
2012-08-22 19:39 ` Richard Purdie
2012-08-27 16:17 ` Peter Seebach
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox