Skip to contentSkip to conversation

builddeb: Don't create files in /tmp with predictable names

PATCH Applied Ben Hutchings 4 participants 4 messages Feb 15, 2012 – Feb 18, 2012 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 builddeb: Don't create files in /tmp with predictable names

The current use of /tmp for file lists is insecure. Put them under $objtree/debian instead.

---
Joerg, this will textually conflict with your changes. Sorry about that, but I think it has to go ahead of them.

Ben.

 scripts/package/builddeb |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
scripts/package/builddeb +6 -6
index f6cbc3d..3c6c0b1 100644
@@ -238,14 +238,14 @@ EOF
 fi
 
 # Build header package
-(cd $srctree; find . -name Makefile -o -name Kconfig\* -o -name \*.pl > /tmp/files$$)
-(cd $srctree; find arch/$SRCARCH/include include scripts -type f >> /tmp/files$$)
-(cd $objtree; find .config Module.symvers include scripts -type f >> /tmp/objfiles$$)
+(cd $srctree; find . -name Makefile -o -name Kconfig\* -o -name \*.pl > "$objtree/debian/hdrsrcfiles")
+(cd $srctree; find arch/$SRCARCH/include include scripts -type f >> "$objtree/debian/hdrsrcfiles")
+(cd $objtree; find .config Module.symvers include scripts -type f >> "$objtree/debian/hdrobjfiles")
 destdir=$kernel_headers_dir/usr/src/linux-headers-$version
 mkdir -p "$destdir"
-(cd $srctree; tar -c -f - -T /tmp/files$$) | (cd $destdir; tar -xf -)
-(cd $objtree; tar -c -f - -T /tmp/objfiles$$) | (cd $destdir; tar -xf -)
-rm -f /tmp/files$$ /tmp/objfiles$$
+(cd $srctree; tar -c -f - -T "$objtree/debian/hdrsrcfiles") | (cd $destdir; tar -xf -)
+(cd $objtree; tar -c -f - -T "$objtree/debian/hdrobjfiles") | (cd $destdir; tar -xf -)
+rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles"
 arch=$(dpkg --print-architecture)
 
 cat <<EOF >> debian/control
Signature · 1 line
1.7.9
#2 lore raw
In reply to Ben Hutchings
Quoted 8 lines · Ben Hutchings

The current use of /tmp for file lists is insecure. Put them under $objtree/debian instead.

---
Joerg, this will textually conflict with your changes. Sorry about that, but I think it has to go ahead of them.

No problem. It was easy to rebase. I am about to send a new version.

Joerg

Signature · 5 lines
AMD Operating System Research Center

Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632