This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours
Bug 135291 - kernel SRPM %build uses hardcoded /tmp
kernel SRPM %build uses hardcoded /tmp
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: kernel (Show other bugs)
3
All Linux
medium Severity medium
: ---
: ---
Assigned To: Rik van Riel
Brian Brock
:
Depends On:
Blocks: FC3Target FC4Target
  Show dependency treegraph
 
Reported: 2004-10-11 15:32 EDT by D. Hugh Redelmeier
Modified: 2007-11-30 17:10 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-03-15 10:36:09 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description D. Hugh Redelmeier 2004-10-11 15:32:11 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; rv:1.7.3) Gecko/20040914
Firefox/0.10

Description of problem:
In kernel-2.6.8-1.603.src.rpm (and probably others),
in kernel-2.6.spec,
in %build:
  gpg --homedir /tmp --batch --gen-key %{SOURCE11} 
  gpg --homedir /tmp --export --keyring ./kernel.pub Red > extract.pub

The hardcoded /tmp seems like a bad idea:

- It causes separate users on the system to interfere with each other.
 For example, I built as root, then could not build as myself because
these files existed and were owned by root.

- It introduces a security issue: the paths are predictable and so an
adversary could plant symlinks or whatever.  Doubly so considering
that we are dealing with keying material.

- These files don't seem to be deleted.  It is hard to know what files
should be deleted since they are mixed in with everything else in /tmp.

I don't know enough to suggest the best alternative.  A workable one
might be:

  KT=%{_builddir}/keytmp
  rm -rf $KT
  mkdir $KT
  chmod go-rwx $KT
  gpg --homedir $KT --batch --gen-key %{SOURCE11} 
  gpg --homedir $KT --export --keyring ./kernel.pub Red > extract.pub
  rm -rf $KT

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. as root: build kernel from SRPM
2. as an ordinary user: build kernel from SRPM
3.
    

Actual Results:  gpg: can't open `/tmp/random_seed': Permission denied


Expected Results:  build works

Additional info:

Technically, this is a security issue.
Comment 1 Rik van Riel 2004-12-07 11:14:45 EST
I'll look into it, since I'm the one messing up the rawhide kernel
spec file the most often anyway (and davej is busy with production
kernels).
Comment 2 Rik van Riel 2005-03-15 10:36:09 EST
This seems to have been fixed in rawhide, while I was looking the other way:

#
# Create gpg keys for signing the modules
#

gpg --homedir . --batch --gen-key %{SOURCE11}
gpg --homedir . --export --keyring ./kernel.pub Red > extract.pub

Note You need to log in before you can comment on or make changes to this bug.