Bug 73244 - quota doesn't support large user id numbers
quota doesn't support large user id numbers
Status: CLOSED ERRATA
Product: Red Hat Linux
Classification: Retired
Component: quota (Show other bugs)
7.3
i686 Linux
high Severity medium
: ---
: ---
Assigned To: Phil Copeland
Brock Organ
: Security
: 69936 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-09-01 13:26 EDT by Petri T. Koistinen
Modified: 2007-03-26 23:56 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-10-03 03:56:40 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
The structure state when it all goes horribly wrong,... (13.01 KB, image/png)
2002-09-02 20:58 EDT, Phil Copeland
no flags Details

  None (edit)
Description Petri T. Koistinen 2002-09-01 13:26:47 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.79 [en] (X11; U; Linux 2.4.18-12.5 i686; Nav)

Description of problem:
We have system where username and userid number are same. Usernames
are formed using this pattern:

YYNNNNN

Where YY is last two numbers of year and NNNNN is running number.
If fact this is student number. For example my number is student number is
9700265. So my user-id is quite large, it is 9700265.

Then I try to set quota for my account:

# /usr/sbin/edquota -p quotaproto-op 9700265
edquota: Error while getting quota from /dev/cciss/c0d1p2 for 9700265: Invalid
argument
edquota: Error while getting quota from /dev/cciss/c0d0p6 for 9700265: Invalid
argument

Quota won't work for me, or anybody else with 9XNNNNN type user-id/name.
On the other hand if I we have useid which starts with 00NNNNN, 01NNNNN or
02NNNNN they will work because their UID's are much smaller.

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


How reproducible:
Always

Steps to Reproduce:
1. Try setting quota with BIG userid's.

Actual Results:  Quota doesn't work for "old" people. ;)
To be serious: some people are able to fill whole filesystem.
(/var and /home).


Additional info:

quota-3.03-1
Comment 1 Petri T. Koistinen 2002-09-01 13:28:55 EDT
Oh, too much spelling errors...sorry. I hope you get the idea.
Comment 2 Phil Copeland 2002-09-02 14:02:59 EDT
I have an errata queued up for this already, as and when QA get to it, it'll be
released.

[copeland@porkchop copeland]$ latest-pkg dist-7.3-errata-candidate quota
/mnt/redhat/beehive/comps/dist/7.3-errata-candidate/quota/3.06-4/SRPMS/quota-3.06-4.src.rpm

NOTE: the source rpm
(ftp://ftp.redhat.com/pub/redhat/linux/rawhide/SRPMS/SRPMS/quota-3.06-4.src.rpm)
currently in rawhide for 8.0 is the same code for 7.3-errata-candidate. you can
download this and issue 'rpmbuild --rebuild quota-3.06-4.src.rpm' and install
the resulting rpms to fix this issue

Phil
=--=
Comment 3 Petri T. Koistinen 2002-09-02 15:14:08 EDT
I downloaded the source package, builded it as instructed and installed it with
command 'rpm -Uvh /usr/src/redhat/RPMS/i386/quota-3.06-4.i386.rpm'.

To make sure there is no old quota around I also rebooted the machine.
This patch does _not_ work for us. We are getting similar errors as before.
Like this:

[root@telinux1 pkoistin]# quota -v 9700265
quota: Error while getting quota from /dev/cciss/c0d1p2 for 9700265: Invalid
argument
quota: Error while getting quota from /dev/cciss/c0d0p6 for 9700265: Invalid
argument
quota: Error while getting quota from 193.167.196.19:/home/perjantai for
9700265: Connection refused
quota: Error while getting quota from
193.167.196.19:/perjantai/home/hk/perjantai for 9700265: Connection refused
Disk quotas for user #9700265 (uid 9700265): none
[root@telinux1 pkoistin]# 

Last two errors should not have any revelance to this bug.
Comment 4 Phil Copeland 2002-09-02 20:57:51 EDT
Ok,.. lets have a look at this again

[root@bryce2 SPECS]# rpm -Uvh /usr/src/redhat/RPMS/i386/quota-3.06-4.i386.rpm

Ok lets create a partition with quota enabled
/dev/hdb9              2743460   2252040    352060  87% /compile
[root@bryce2 /]# quotacheck -c /dev/hdb9
[root@bryce2 /]# mount
...
/dev/hdb9 on /compile type ext3 (rw,quota)


ok lets create a user
[root@alpha root]# useradd qwerty -u 9700265 -d /compile/qwerty
Ok and a test one
[root@bryce2 /]# useradd test -u 9700 -d /compile/qwerty


add some quotas,...

ok
lets see how we do

[root@bryce2 /]# quota test  
Disk quotas for user test (uid 9700): 
     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
      /dev/hdb9       8    1000    2000               2       0       0        
[root@bryce2 /]# quota qwerty
quota: Error while getting quota from /dev/hdb9 for 9700265: Invalid argument
Disk quotas for user qwerty (uid 9700265): none



An strace shows up

test
----
geteuid32()                             = 0
quotactl(0xd00 /* Q_??? */|USRQUOTA, "/dev/hdb9", 9700, {0, 0, 2, 2000, 1000,
8192, 0, 0}) = 0


qwerty
------
geteuid32()                             = 0
quotactl(0xd00 /* Q_??? */|USRQUOTA, "/dev/hdb9", 9700265, {0, 0, 0, 0, 0,
1073813768, 70, 1073814272}) = -1 EINVAL (Invalid argument)


Humm looks like a kernel fault not the userland
(tracked to quotaio_v2.c:645 where this code is executed
if (quotactl(QCMD(Q_V2_GETQUOTA, h->qh_type), h->qh_quotadev, id, (void
*)&kdqblk) < 0) {

This call fails. (structure snapshot in next attachment)

include/linux/quota.h:long quotactl __P ((int, const char *, qid_t,
__kernel_caddr_t));

Comment 5 Phil Copeland 2002-09-02 20:58:41 EDT
Created attachment 74568 [details]
The structure state when it all goes horribly wrong,...
Comment 6 Phil Copeland 2002-09-02 21:31:06 EDT
Structure is properly formed...
Ah,.. there we go,...

linux/fs/dquot.c +2060

        if (id & ~0xFFFF)
                goto out;

someone didn't notice that uid_t is (2^32)-1 not (2^16)-1
Should be if (id & ~0xFFFFFFFF)
actually, that check could be pulled out altogether I think (looking at
linux-2.5.33)

Kernel bug

Phil
=--=
Comment 7 Phil Copeland 2002-09-03 11:32:04 EDT
*** Bug 69936 has been marked as a duplicate of this bug. ***
Comment 8 Petri T. Koistinen 2002-09-04 03:30:31 EDT
Offtopic comment: which is the name of the debugger that this screengrab is taken from? It looks nice. ;)
Comment 9 Andrew Sydelko 2002-09-04 10:57:10 EDT
Ok, the kernel fix makes edquota work, but after running checkquota on the
filesystem, the highuid user still has their information show up for 
(their uid - 65536) as reported by repquota.
Comment 10 Andrew Sydelko 2002-09-04 11:45:43 EDT
recompiling the quota rpm using '--with-ext2direct=no' fixes the other quota
utils to work properly...
Comment 11 Petri T. Koistinen 2002-09-05 07:02:57 EDT
Could you give me the new kernel for testdrive before releasing the errata?
Comment 12 Phil Copeland 2002-09-06 11:05:01 EDT
Thoron, the struct snapshot was from using 'ddd' and cut out using 'xv's screen
grab feature.

Anyway
Current kernel >= 2.4.18-14 has the quota fix in. You should be able to find it
in rawhide

I don't believe this will be fixed for the release as various deadlines have
elapsed though 8/ possibly an errata item after the fact I fear

Phil
=--=
Comment 13 Petri T. Koistinen 2002-09-06 11:43:33 EDT
Let me make myself clear: are you saying that you are not going to release
Red Hat 7.3 security advisory about this? If this is missing from Red Hat 8.0 or
whatever you are talking about, it doesn't matter to me now. (Althought it would
be nice.)

Thank you very much for the patch, I will install the new kernel (from Raw Hide)
and report if it works with 7.3 system.
Comment 14 Phil Copeland 2002-09-06 11:55:23 EDT
I was refering to the 'about to go out the door and onto store shelves' release.
All resources here are currently focused on makeing that product happen to a
deadline. As soon as thats out of the way then we'll go firefighting the
6.2->7.3 issues.

Even if I built the quota errata right now (actually, I have), it has to go
through QA first and they're backlogged with other work. You won't see it for
some time.

Phil
=--=
Comment 15 Petri T. Koistinen 2002-09-06 12:02:58 EDT
Thank you very much about the clarification. I hope use of Raw Hide kernel don't
cause me any problems, well I can always go back to kernel which works for me,
but does not have proper quota support. I am looking forward to see that new
kernel appear in public Raw Hide archive soon.
Comment 16 Petri T. Koistinen 2002-09-15 17:40:06 EDT
Hi! I see no new kernel in Raw Hide. I would realy like to beta test this kernel
before you release the official errata, just to make sure it works. Could you
deliver me the new kernel off the record? (Well, this is that record, but
anyway. Can you be flexible with this issue, or is it forbidden by management?)
Comment 17 Phil Copeland 2002-09-16 14:44:07 EDT
Humm I thought it was already in rawhide, but apparently not. It is available
through the beta test program though.

Phil
=--=
Comment 18 Petri T. Koistinen 2002-09-16 16:57:45 EDT
Stupid question: What is beta test program and how can I join to it?
Comment 19 Petri T. Koistinen 2002-10-03 03:56:34 EDT
I am willing to test 7.3 errata kernel before it's officially released, so that 
we can be sure it works.
Comment 20 Petri T. Koistinen 2002-10-21 16:09:50 EDT
Problem is fixed with
http://rhn.redhat.com/errata/RHSA-2002-206.html

Thank you!

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