2001-10-25 04:54:09

by Mike Castle

[permalink] [raw]
Subject: modprobe problem with block-major-11

If there is a better list for this, let me know and I'll take the question
there.

I have a new CDRW I've been trying to get working for a couple of months
now. Working with autoloading the modules anyway.

I've tried following the CD-Writing HOWTO for setting up modules.conf with
no luck.

Currently my modules.conf has:
options ide-cd ignore=hdc # tell the ide-cd module to ignore h
alias block-major-11 sr_mod # load sr_mod upon access of scd0
pre-install sg modprobe ide-scsi # load ide-scsi before sg
pre-install sr_mod modprobe ide-scsi # load ide-scsi before sr_mod
pre-install ide-scsi modprobe ide-cd # load ide-cd before ide-scsi

And lilo.conf has:
append="hdc=scsi"

Of course, also tried hdc=ide-scsi with same results.

Now, if I try something like ``head /dev/scd0'' I see the following in
dmesg:
SCSI subsystem driver Revision: 1.00
Uniform CD-ROM driver unloaded

And the following in /var/log/ksymoops:
20011024 214049 start /sbin/modprobe -s -k -- block-major-11 safemode=1
20011024 214050 probe ended

Now, if I take the command from that:
/sbin/modprobe -s -k -- block-major-11

I get the following:
thune:~# /sbin/modprobe -s -k -- block-major-11
Warning: loading /lib/modules/2.4.12/kernel/drivers/cdrom/cdrom.o will
taint the kernel: no license
Warning: loading /lib/modules/2.4.12/kernel/drivers/ide/ide-cd.o will taint the
kernel: no license
ide-cd: ignoring drive hdc
Vendor: PHILIPS Model: PCRW804 Rev: 2,1
Type: CD-ROM ANSI SCSI revision: 02
Attached scsi CD-ROM sr0 at scsi0, channel 0, id 0, lun 0
sr0: scsi3-mmc drive: 32x/32x writer cd/rw xa/form2 cdda tray

ksymoops has:
20011024 214923 start /sbin/modprobe -s -k -- block-major-11 safemode=0
20011024 214923 start modprobe ide-scsi safemode=0
20011024 214923 start modprobe ide-cd safemode=0
20011024 214924 probe ended
20011024 214924 probe ended
20011024 214924 probe ended

And dmesg shows:
CSI subsystem driver Revision: 1.00
ide-cd: ignoring drive hdc
scsi0 : SCSI host adapter emulation for IDE ATAPI devices
Vendor: PHILIPS Model: PCRW804 Rev: 2,1
Type: CD-ROM ANSI SCSI revision: 02
Attached scsi CD-ROM sr0 at scsi0, channel 0, id 0, lun 0
sr0: scsi3-mmc drive: 32x/32x writer cd/rw xa/form2 cdda tray
Uniform CD-ROM driver Revision: 3.12


So, it appears to me that the autoloading should work. But it's not.

What am I missing?

Help appreciated,
mrc
--
Mike Castle [email protected] http://www.netcom.com/~dalgoda/
We are all of us living in the shadow of Manhattan. -- Watchmen
fatal ("You are in a maze of twisty compiler features, all different"); -- gcc


2001-10-25 05:51:34

by Keith Owens

[permalink] [raw]
Subject: Re: modprobe problem with block-major-11

On Wed, 24 Oct 2001 21:53:28 -0700,
Mike Castle <[email protected]> wrote:
>Currently my modules.conf has:
>options ide-cd ignore=hdc # tell the ide-cd module to ignore h
>alias block-major-11 sr_mod # load sr_mod upon access of scd0
>pre-install sg modprobe ide-scsi # load ide-scsi before sg
>pre-install sr_mod modprobe ide-scsi # load ide-scsi before sr_mod
>pre-install ide-scsi modprobe ide-cd # load ide-cd before ide-scsi

Is that the complete modules.conf? The messages below imply that you
have other options and/or commands in there.

>Now, if I try something like ``head /dev/scd0'' I see the following in
>dmesg:
>SCSI subsystem driver Revision: 1.00
>Uniform CD-ROM driver unloaded
>
>And the following in /var/log/ksymoops:
>20011024 214049 start /sbin/modprobe -s -k -- block-major-11 safemode=1
>20011024 214050 probe ended

Check syslog for any error messages. The only unusual thing is that
modprobe is running in safe mode (user supplied input data) which
suppresses some command expansions. Post your entire modules.conf
exactly as is, i.e. read the file into your mail, do not cut and paste
it.

2001-10-25 07:51:47

by Mike Castle

[permalink] [raw]
Subject: Re: modprobe problem with block-major-11

On Thu, Oct 25, 2001 at 03:51:36PM +1000, Keith Owens wrote:
> On Wed, 24 Oct 2001 21:53:28 -0700,
> Mike Castle <[email protected]> wrote:
> >Now, if I try something like ``head /dev/scd0'' I see the following in
> >dmesg:
> >SCSI subsystem driver Revision: 1.00
> >Uniform CD-ROM driver unloaded
> >
> >And the following in /var/log/ksymoops:
> >20011024 214049 start /sbin/modprobe -s -k -- block-major-11 safemode=1
> >20011024 214050 probe ended
>
> Check syslog for any error messages. The only unusual thing is that

Only thing in syslog around that time:
Oct 24 21:40:49 thune kernel: SCSI subsystem driver Revision: 1.00
Oct 24 21:40:50 thune insmod: /lib/modules/2.4.12/kernel/drivers/cdrom/cdrom.o: pre-install sr_mod failed
Oct 24 21:40:50 thune insmod: /lib/modules/2.4.12/kernel/drivers/cdrom/cdrom.o: insmod block-major-11 failed
Oct 24 21:40:50 thune kernel: Uniform CD-ROM driver unloaded

> modprobe is running in safe mode (user supplied input data) which
> suppresses some command expansions. Post your entire modules.conf
> exactly as is, i.e. read the file into your mail, do not cut and paste
> it.

A lot of cruft from over the years.

Also output from lsmod, since modules.conf implies more than I actually
load:

Module Size Used by
sg 26756 1 (autoclean)
sr_mod 12184 1 (autoclean)
ide-scsi 7488 2
ide-cd 26240 0
cdrom 27200 0 (autoclean) [sr_mod ide-cd]
scsi_mod 58572 3 (autoclean) [sg sr_mod ide-scsi]
nfsd 64864 1 (autoclean)
lockd 46688 1 (autoclean) [nfsd]
sunrpc 58388 1 (autoclean) [nfsd lockd]
ip_nat_ftp 2944 0 (autoclean) (unused)
ip_conntrack_ftp 3200 0 (autoclean) (unused)
iptable_nat 12756 1 (autoclean) [ip_nat_ftp]
ip_conntrack 12908 2 (autoclean) [ip_nat_ftp ip_conntrack_ftp iptable_nat]
ip_tables 10400 3 [iptable_nat]
ne2k-pci 4768 1 (autoclean)
8390 5920 0 (autoclean) [ne2k-pci]
tulip 35520 1 (autoclean)
lvm-mod 44704 10 (autoclean)
md 43520 0 (autoclean) (unused)
unix 13700 36 (autoclean)

:r /etc/modules.conf
alias block-major-58 lvm-mod
alias char-major-109 lvm-mod

alias char-major-14 sb
options sb irq=5 io=0x220 dma=1 dma16=5

add above sb adlib_card
options adlib_card io=0x388

alias parport_lowlevel parport_pc

alias char-major-15 joystick

alias block-major-8 ppa
add above ppa sd_mod

#pre-install serial modprobe -k lirc_serial
alias char-major-61 lirc_serial
options lirc_serial port=0x2f8 irq=3

alias eth0 tulip
alias eth1 ne2k-pci
# TV
alias char-major-81 videodev
alias char-major-81-0 bttv
#pre-install bttv modprobe -k msp3400; modprobe -k tuner
pre-install bttv modprobe -k tuner
options bttv radio=0 pll=0 card=0
options tuner debug=1 type=0

add above ip_conntrack ip_conntrack_ftp
add above iptable_nat ip_nat_ftp

options ide-cd ignore=hdc # tell the ide-cd module to ignore h
alias block-major-11 sr_mod # load sr_mod upon access of scd0
pre-install sg modprobe ide-scsi # load ide-scsi before sg
pre-install sr_mod modprobe ide-scsi # load ide-scsi before sr_mod
pre-install ide-scsi modprobe ide-cd # load ide-cd before ide-scsi
--
Mike Castle [email protected] http://www.netcom.com/~dalgoda/
We are all of us living in the shadow of Manhattan. -- Watchmen
fatal ("You are in a maze of twisty compiler features, all different"); -- gcc

2001-10-25 08:09:19

by Mike Castle

[permalink] [raw]
Subject: Re: modprobe problem with block-major-11

On Thu, Oct 25, 2001 at 03:51:36PM +1000, Keith Owens wrote:
> Check syslog for any error messages. The only unusual thing is that
> modprobe is running in safe mode (user supplied input data) which

Ok. Another point of interest.

If I do ``head /dev/scd0'' as a user, it fails.

If I do ``head /dev/scd0'' as root, it works.

I had always thought that since I could autoload the sound stuff as a
normal user, that this would work as well.

Course, I also just noticed that rmmod -a doesn't unload modules either.
Grrrr.

mrc
--
Mike Castle [email protected] http://www.netcom.com/~dalgoda/
We are all of us living in the shadow of Manhattan. -- Watchmen
fatal ("You are in a maze of twisty compiler features, all different"); -- gcc

2001-10-25 13:04:03

by Keith Owens

[permalink] [raw]
Subject: Re: modprobe problem with block-major-11

On Thu, 25 Oct 2001 00:52:03 -0700,
Mike Castle <[email protected]> wrote:
>alias block-major-11 sr_mod # load sr_mod upon access of scd0
>pre-install sr_mod modprobe ide-scsi # load ide-scsi before sr_mod

* User does 'head /dev/scd0'.
* The kernel runs modprobe block-major-11. modprobe is running
setuid(0) because the original user was not root.
* modprobe maps block-major-11 to sr_mod.
* modprobe sees a pre-install command for sr_mod and uses system() to
invoke the command.
* The system() function issues '/bin/sh -c "command"', sh is linked to
bash.
* Bash detects that it was invoked as 'sh' and is running setuid. Bash
silently turns off the setuid privilege before running the command.
WRONG!!
* The second command (modprobe ide-scsi) needs root authority but bash
has removed the authority. modprobe fails :(

The problem is caused by a bash "feature", it was added in bash 2.01.
I cannot fix it without writing my own replacement for the system()
function. Doing setuid(0) in modprobe before calling system() would
reopen the security exposure that was closed in modutils 2.3.21, that
is not an option.

Workaround: Replace
pre-install foo modprobe bar
with
before foo bar
That does all the work internally without using the system() function
and falling foul of the bash feature. It is also faster and it lets
modprobe maintain the chain of modules for unload.

BTW, users can never run rmmod, only root can do that.

2001-10-25 16:38:54

by Mike Castle

[permalink] [raw]
Subject: Re: modprobe problem with block-major-11

On Thu, Oct 25, 2001 at 11:03:56PM +1000, Keith Owens wrote:
> The problem is caused by a bash "feature", it was added in bash 2.01.

Gotcha. I take it you've seen this before then? :->

I didn't see any mention of this the docs. Would it be worth while to add
what you just wrote to a PROBLEMS file?

> Workaround: Replace
> pre-install foo modprobe bar
> with
> before foo bar

Will do.

> That does all the work internally without using the system() function
> and falling foul of the bash feature. It is also faster and it lets
> modprobe maintain the chain of modules for unload.
>
> BTW, users can never run rmmod, only root can do that.

Right. But it IS with root that rmmod -a is failing.

Maybe I'll get lucky and it will magically start working when I switch to
the above?

Appreciate your help!
mrc
--
Mike Castle [email protected] http://www.netcom.com/~dalgoda/
We are all of us living in the shadow of Manhattan. -- Watchmen
fatal ("You are in a maze of twisty compiler features, all different"); -- gcc

2001-10-25 18:20:33

by Mike Castle

[permalink] [raw]
Subject: Re: modprobe problem with block-major-11

On Thu, Oct 25, 2001 at 09:39:05AM -0700, Mike Castle wrote:
> I didn't see any mention of this the docs. Would it be worth while to add
> what you just wrote to a PROBLEMS file?

Though, upon retrospect, I think ISSUES would be a better file name.

mrc
--
Mike Castle [email protected] http://www.netcom.com/~dalgoda/
We are all of us living in the shadow of Manhattan. -- Watchmen
fatal ("You are in a maze of twisty compiler features, all different"); -- gcc

2001-10-25 18:51:39

by Mike Castle

[permalink] [raw]
Subject: Re: modprobe problem with block-major-11

On Thu, Oct 25, 2001 at 11:03:56PM +1000, Keith Owens wrote:
> Workaround: Replace
> pre-install foo modprobe bar
> with
> before foo bar

Actually, below foo bar, but that worked great.

I will ask the authors of CD-Writing-HOWTO to update their docs.

Thanks,
mrc
--
Mike Castle [email protected] http://www.netcom.com/~dalgoda/
We are all of us living in the shadow of Manhattan. -- Watchmen
fatal ("You are in a maze of twisty compiler features, all different"); -- gcc