Bug 214375 - Kernel panic when libc.so.6 be overwrited
Summary: Kernel panic when libc.so.6 be overwrited
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: glibc
Version: 4.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-11-07 10:24 UTC by Brian Chung
Modified: 2007-11-30 22:07 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2006-11-07 14:36:29 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Brian Chung 2006-11-07 10:24:38 UTC
Description of problem:

we use ibm tsm solution to backup linux host, kernel panic when libc-2.3.4.so be
restored by tsm agent. even i recover it with a backup file from localhost.


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

glibc-2.3.4-2.25

How reproducible:


Steps to Reproduce:

1.cd /lib/tls/
2.cp libc-2.3.4.so libc-2.3.4.so.bak
3.cp libc-2.3.4.so.bak libc-2.3.4.so
  
Actual results:

kernel panic: reboot
show the following messages:
/sbin/init :error while loading share libraries: /lib/tls/libc.so.6: file too
short kernel panic - not syncing: Attemped to kill init !

Expected results:


Additional info:

Comment 1 Jakub Jelinek 2006-11-07 14:36:29 UTC
That's user error.  You really can't restore libc.so (or any other widely used
shared library or the dynamic linker) using cp on a running system.
cp overwrites the target file (opens it with O_WRONLY|O_TRUNC) and at that point
any program that have the current libc.so.6 mapped can crash.  If init crashes,
the whole system is dead of course, the root just shot himself in the foot.
The way shared libraries should be restored is that they are copied to a
temporary file in the same directory where they should be installed to and
once copied there, they are moved or linked over the target file (mv -f or ln
-f).  install(1) gets close, it unlinks the target file and then copies it over,
but there is still a window in which the old libc doesn't exist and new one
doesn't either, so e.g. newly started programs in that timeframe could die.
rpm does the right thing AFAIK.


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