mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: peterius@durandal.simons-rock.edu
To: linux-kernel@vger.kernel.org
Subject: memory and current macro
Date: Wed, 2 May 2001 22:20:33 -0400	[thread overview]
Message-ID: <p04320402b7166eda68f2@[64.210.111.70]> (raw)

Hi,
	I've been trying to write a device driver and I've found two 
problems.  First, the current macro.  I wanted to get the uid of the 
calling process but "current->uid" does NOT work it returns some 
other number.  Same with "current->pid" and many others.  I figured 
these numbers weren't random and decided to print out a particular 
processes's descriptor and check out what was going on.  I found that 
"&(current->uid)" is 0x1d lower than the address that holds the user 
id.  In addition, adding 0x1d to that address added it twice???  So 
to get the uid I ended up adding half...or "&(current->uid) + 0x0f". 
Does anyone know why this is?  I have an i686 processor, IBM thinkpad 
570e laptop, Debian 2.2, kernel version 2.4.2.

	Second problem might not have anything to do with my device 
driver at all.  It seems that applications on my laptop know longer 
free memory they have allocated.  I thought it was my module.  I 
check "free" for the memory available, "insmod" my module, check 
"free" again, "rmmod" it.  Each time the amount of free memory goes 
down.  Even when I remove the module.  Then I found that all other 
processes do this also, from ftp to ls or cd.  Then I start getting 
really bad segmentation errors in almost every process I try to run. 
And at the top, they say, usually, "kernel BUG page_alloc.c line:xx". 
I'm worried I've corrupted something or I don't know.  I looked this 
up in the source but I don't know why everything is triggering it. 
Are there any known memory allocation or freeing problems with kernel 
2.4.2?

								- Peter

             reply	other threads:[~2001-05-03  2:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-03  2:20 peterius [this message]
2001-05-03  9:21 ` Alan Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='p04320402b7166eda68f2@[64.210.111.70]' \
    --to=peterius@durandal.simons-rock.edu \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®