Bug 131886

Summary: __put_task_struct unresolved when loading externally compiled module
Product: Red Hat Enterprise Linux 3 Reporter: Robin Crook <robin>
Component: kernelAssignee: Ernie Petrides <petrides>
Status: CLOSED ERRATA QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0CC: petrides, riel
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: RHSA-2005-663 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-09-28 14:29:35 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 156320    
Attachments:
Description Flags
tar file of sources none

Description Robin Crook 2004-09-06 11:40:48 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)

Description of problem:
I have compiled a module against the 2.4.21-15.0.3.EL linux kernel 
source tree.  Initially I got the following when I tried to load it:

[root@stratum11 rms]# insmod ./rms.o
./rms.o: unresolved symbol free_task_struct

Googling resulted in me changing free_task_struct to put_task_struct 
but I now get:

[root@stratum11 rms]# insmod ./rms.o
./rms.o: unresolved symbol __put_task_struct
[root@stratum11 rms]# 


Version-Release number of selected component (if applicable):
kernel-smp-2.4.21-15.0.3.EL

How reproducible:
Always

Steps to Reproduce:
1. Include a call to put_task_struct(tsk) in module code and build it 
against the 2.4.21-15.0.3.EL source tree
2. try to insmod the module - insmod ./rms.o 
3.
    

Actual Results:  [root@stratum11 rms]# insmod ./rms.o
./rms.o: unresolved symbol __put_task_struct
[root@stratum11 rms]# 


Expected Results:  The module should have loaded.

Additional info:

Comment 1 Arjan van de Ven 2004-09-06 11:43:35 UTC
can you give a pointer to the sourcecode of this module so that we can
see what you are trying to achieve ?

Comment 2 Robin Crook 2004-09-06 12:46:39 UTC
Created attachment 103507 [details]
tar file of sources

I've attached a tarfile of the sources.  The put_task_struct call is in the
rms_kern.c file.
We are in the process of removing the need to use a 
patch (that we call ptrack) that provides containers
for the set of processes in a parallel job. One of
the operations we perform is to accumulate its stats. 

We increment the reference count on the proc so that 
it doesn't disappear under our feet, we do this with 
get_task_struct (rms_kern.c:453). We decrement the 
reference count with free_task_struct (or put_task_struct 
in some kernels) when we are finished with the process 
(rms_kern.c:583).

This all works ok on 2.4.20 and vanilla 2.6 kernels
but not on RHEL 3.0 where the put_task_struct macro
exists but the __put_task_struct fn is not defined.

Comment 3 Robin Crook 2004-09-07 16:56:43 UTC
This bug is present in the 2.6.7 vanilla kernel as well and I've 
found this by googling: 

http://www.ussg.iu.edu/hypermail/linux/kernel/0308.0/0666.html

From: Frank Cornelis (Frank.Cornelis.be)
Date: Mon Aug 04 2003 - 07:54:13 EST 

Next message: Alan Cox: "Re: DVD-RAM errors (was: DVD-RAM crashing 
system


Hi, 


In order to be able to safely manipulate a task_struct from within a 
module one should use get/put_task_struct. This is currently not 
possible because __put_task_struct is not exported. Next patch solves 
this issue. 


Frank. 


--- linux-2.6.0-test2.orig/kernel/ksyms.c 2003-07-29 
10:04:45.000000000 +0200 
+++ linux-2.6.0-test2/kernel/ksyms.c 2003-07-29 14:11:40.000000000 
+0200 
@@ -495,6 +495,7 @@ 
 #if !defined(__ia64__) 
 EXPORT_SYMBOL(loops_per_jiffy); 
 #endif 
+EXPORT_SYMBOL(__put_task_struct); 
  


 /* misc */ 


We would really like this patch to make it into the distribution.


Comment 4 Ernie Petrides 2005-04-30 01:23:40 UTC
Patch posted for review on 29-Apr-2005.

Comment 5 Ernie Petrides 2005-05-05 00:44:20 UTC
A fix for this problem has just been committed to the RHEL3 U6
patch pool this evening (in kernel version 2.4.21-32.3.EL).


Comment 15 Red Hat Bugzilla 2005-09-28 14:29:35 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2005-663.html