BUG with 2.6.25-rc1 and smack
Subsystems (2)
Hi,
when booting linux 2.6.25-rc1 I get the following error:
BUG: unable to handle kernel NULL pointer dereference at 00000138 IP: [<c01aa59e>] smack_netlabel+0x13/0xc8 *pde = 00000000 Oops: 0000 [#1] PREEMPT Modules linked in: nfsd auth_rpcgss exportfs af_packet autofs4 ipt_MASQUERADE
iptable_nat nf_nat nf_conntrack_ipv4 xt_state ipt_REJECT ipt_LOG xt_limit xt_mark xt_tcpudp xt_mac iptable_filter xt_
MARK xt_multiport iptable_mangle ip_tables x_tables nf_conntrack_ftp nf_conntrack cpufreq_userspace cpufreq_stats cpufreq_powersave nfs lockd nfs_acl sunrpc deflate zlib_deflate zlib_inflate ctr
twofish twofish_common camellia serpent blowfish des_generic cbc aes_i586 aes_generic xcbc sha256_generic sha1_generic md5 crypto_null hmac crypto_hash af_key nls_utf8 ntfs nls_base ext2 fuse ebtable_broute bridge llc ebtable_nat ebtable_filter ebtables deadline_iosched as_iosched ircomm_tty ircomm tun acpi_cpufreq video output sbs sbshc joydev arc4 ecb crypto_blkcipher cryptomgr crypto_
algapi snd_intel8x0m irtty_sir sir_dev snd_intel8x0 snd_ac97_codec ac97_bus snd_pcm_oss snd_pcm snd_mixer_oss nsc_ircc irda crc_ccitt parport_pc snd_seq_oss parport 8250_pnp snd_seq_midi snd_rawm
idi snd_seq_midi_event snd_seq serio_raw snd_timer snd_seq_device psmouse ath5k snd mac80211 pcspkr 8250_pci yenta_socket rsrc_nonstatic cinergyT2 8250 cfg80211 pcmcia firmware_class dvb_core serial_core soundcore snd_page_alloc pcmcia_core i2c_i801 rng_core iTCO_wdt iTCO_vendor_support battery ac button intel_agp agpgart thinkpad_acpi hwmon evdev nvram ext3 jbd mbcache sg usbhid hid ff_
memless sr_mod cdrom sd_mod ata_generic pata_acpi floppy ata_piix e1000 libata scsi_mod ehci_hcd uhci_hcd usbcore thermal processor fan unix cpufreq_conservative cpufreq_ondemand freq_table bay d
ock fbcon tileblit font bitblit softcursor radeonfb fb fb_ddc backlight i2c_algo_bit cfbcopyarea i2c_core cfbimgblt cfbfillrect
Pid: 5307, comm: nfsd Not tainted (2.6.25-rc1 #1)
EIP: 0060:[<c01aa59e>] EFLAGS: 00010286 CPU: 0
EIP is at smack_netlabel+0x13/0xc8
EAX: 00000000 EBX: f682edf4 ECX: 00000006 EDX: 00000002
ESI: 00000000 EDI: 00000001 EBP: f682ee18 ESP: f682edd8
DS: 007b ES: 007b FS: 0000 GS: 0000 SS: 0068
Process nfsd (pid: 5307, ti=f682e000 task=f7f54e50 task.ti=f682e000)
Stack: 00000040 f732e1a4 c0331998 f732e290 f682edf8 c01aacf8 f732e1a4 f7468400
f682ee04 c01aad52 f732e1a4 f682ee0c c01a7510 c0331668 f732e180 00000001
f682ee20 c01aa665 f682ee34 c01a7a06 00000006 00000001 fffffff4 f682ee58
Call Trace:
[<c01aacf8>] ? new_inode_smack+0x39/0x3f
[<c01aad52>] ? smack_inode_alloc_security+0x16/0x27
[<c01a7510>] ? security_inode_alloc+0x19/0x1b
[<c01aa665>] ? smack_socket_post_create+0x12/0x18
[<c01a7a06>] ? security_socket_post_create+0x16/0x1b
[<c02116ce>] ? sock_create_lite+0x44/0x64
[<c0211712>] ? kernel_accept+0x24/0x5f
[<f9f77ef3>] ? svc_tcp_accept+0x51/0x526 [sunrpc]
[<c012f200>] ? getnstimeofday+0x2f/0xb4
[<c012db9e>] ? ktime_get_ts+0x3b/0x3f
[<c011508c>] ? hrtick_start_fair+0xcb/0x107
[<c0212730>] ? lock_sock_nested+0xab/0xb3
[<c0211e5f>] ? kernel_recvmsg+0x2b/0x3d
[<f9f7dcf0>] ? svc_xprt_received+0x1e/0x20 [sunrpc]
[<f9f77c88>] ? svc_udp_recvfrom+0xd3/0x2ed [sunrpc]
[<c01153da>] ? enqueue_task_fair+0x41/0x4c
[<f9f7dd02>] ? svc_xprt_put+0x10/0x12 [sunrpc]
[<f9f7de5b>] ? svc_xprt_release+0x92/0x9a [sunrpc]
[<f9f7ed20>] ? svc_recv+0x335/0x665 [sunrpc]
[<c01172d6>] ? default_wake_function+0x0/0xd
[<fa0676b3>] ? nfsd+0xd5/0x28e [nfsd]
[<fa0675de>] ? nfsd+0x0/0x28e [nfsd]
[<c01054a7>] ? kernel_thread_helper+0x7/0x10
=======================
Code: 5d f0 74 0d 46 8b 5d f0 c6 45 ef 80 83 eb 08 eb c6 59 5b 5b 5e 5f 5d c3 55 b9 06 00 00 00 89 e5 57 56 89 c6 53 83 ec 34 8d 5d dc <8b> 90 38 01 00 00 31 c0 89 df f3 ab 83 3d f4 19 33 c0 03 8
b 3a
EIP: [<c01aa59e>] smack_netlabel+0x13/0xc8 SS:ESP 0068:f682edd8
---[ end trace 499ec328c921ccf2 ]---
regards,
Jörg
Signature · 2 lines
PGP Key: send mail with subject 'SEND PGP-KEY' PGP Key-ID: FD 4E 21 1D PGP Fingerprint: 388A872AFC5649D3 BCEC65778BE0C605
Casey Schaufler
maintainerQuoted 79 lines · --- Joerg Platte
Hi,
when booting linux 2.6.25-rc1 I get the following error:
BUG: unable to handle kernel NULL pointer dereference at 00000138 IP: [<c01aa59e>] smack_netlabel+0x13/0xc8 *pde = 00000000 Oops: 0000 [#1] PREEMPT Modules linked in: nfsd auth_rpcgss exportfs af_packet autofs4 ipt_MASQUERADE
iptable_natnf_natnf_conntrack_ipv4xt_stateipt_REJECTipt_LOGxt_limitxt_markxt_tcpudpxt_maciptable_filterxt_
MARKxt_multiportiptable_mangleip_tablesx_tablesnf_conntrack_ftpnf_conntrackcpufreq_userspacecpufreq_statscpufreq_powersavenfs lockdnfs_aclsunrpc deflatezlib_deflatezlib_inflatectr
twofishtwofish_commoncamellia serpent blowfishdes_genericcbcaes_i586aes_genericxcbcsha256_genericsha1_genericmd5crypto_nullhmaccrypto_hash
af_keynls_utf8ntfsnls_baseext2 fuse ebtable_broutebridge llcebtable_natebtable_filterebtablesdeadline_ioschedas_ioschedircomm_ttyircomm tunacpi_cpufreqvideo output sbs sbshc joydev arc4 ecbcrypto_blkciphercryptomgrcrypto_
algapisnd_intel8x0mirtty_sirsir_devsnd_intel8x0snd_ac97_codecac97_bussnd_pcm_osssnd_pcmsnd_mixer_ossnsc_irccirdacrc_ccittparport_pcsnd_seq_ossparport 8250_pnpsnd_seq_midisnd_rawm
idisnd_seq_midi_eventsnd_seqserio_rawsnd_timersnd_seq_devicepsmouse ath5k snd mac80211 pcspkr 8250_pciyenta_socketrsrc_nonstaticcinergyT2 8250cfg80211 pcmcia
firmware_classdvb_coreserial_coresoundcoresnd_page_allocpcmcia_corei2c_i801rng_coreiTCO_wdtiTCO_vendor_supportbattery ac buttonintel_agpagpgartthinkpad_acpihwmon evdev nvram ext3 jbd mbcache sg usbhid hidff_
memlesssr_modcdromsd_modata_genericpata_acpifloppyata_piixe1000 libatascsi_modehci_hcduhci_hcdusbcore thermal processor fan unixcpufreq_conservativecpufreq_ondemandfreq_tablebay d
ock fbcon tileblit font bitblit softcursor radeonfb fbfb_ddcbacklighti2c_algo_bitcfbcopyareai2c_corecfbimgblt cfbfillrectPid: 5307, comm: nfsd Not tainted (2.6.25-rc1 #1)
EIP: 0060:[<c01aa59e>] EFLAGS: 00010286 CPU: 0
EIP is atsmack_netlabel+0x13/0xc8
EAX: 00000000 EBX:f682edf4ECX: 00000006 EDX: 00000002
ESI: 00000000 EDI: 00000001 EBP:f682ee18ESP:f682edd8
DS: 007b ES: 007b FS: 0000 GS: 0000 SS: 0068
Process nfsd (pid: 5307, ti=f682e000 task=f7f54e50 task.ti=f682e000)Stack: 00000040 f732e1a4 c0331998 f732e290 f682edf8 c01aacf8 f732e1a4 f7468400 f682ee04 c01aad52 f732e1a4 f682ee0c c01a7510 c0331668 f732e180 00000001 f682ee20 c01aa665 f682ee34 c01a7a06 00000006 00000001 fffffff4 f682ee58 Call Trace: [<c01aacf8>] ? new_inode_smack+0x39/0x3f [<c01aad52>] ? smack_inode_alloc_security+0x16/0x27 [<c01a7510>] ? security_inode_alloc+0x19/0x1b [<c01aa665>] ? smack_socket_post_create+0x12/0x18 [<c01a7a06>] ? security_socket_post_create+0x16/0x1b [<c02116ce>] ? sock_create_lite+0x44/0x64 [<c0211712>] ? kernel_accept+0x24/0x5f [<f9f77ef3>] ? svc_tcp_accept+0x51/0x526 [sunrpc] [<c012f200>] ? getnstimeofday+0x2f/0xb4 [<c012db9e>] ? ktime_get_ts+0x3b/0x3f [<c011508c>] ? hrtick_start_fair+0xcb/0x107 [<c0212730>] ? lock_sock_nested+0xab/0xb3 [<c0211e5f>] ? kernel_recvmsg+0x2b/0x3d [<f9f7dcf0>] ? svc_xprt_received+0x1e/0x20 [sunrpc] [<f9f77c88>] ? svc_udp_recvfrom+0xd3/0x2ed [sunrpc] [<c01153da>] ? enqueue_task_fair+0x41/0x4c [<f9f7dd02>] ? svc_xprt_put+0x10/0x12 [sunrpc] [<f9f7de5b>] ? svc_xprt_release+0x92/0x9a [sunrpc] [<f9f7ed20>] ? svc_recv+0x335/0x665 [sunrpc] [<c01172d6>] ? default_wake_function+0x0/0xd [<fa0676b3>] ? nfsd+0xd5/0x28e [nfsd] [<fa0675de>] ? nfsd+0x0/0x28e [nfsd] [<c01054a7>] ? kernel_thread_helper+0x7/0x10 ======================= Code: 5d f0 74 0d 46 8b 5d f0 c6 45 ef 80 83 eb 08 eb c6 59 5b 5b 5e 5f 5d c3
Quoted 5 lines
55 b9 06 00 00 00 89 e5 57 56 89 c6 53 83 ec 34 8d 5d dc <8b> 90 38 01 00 00 31 c0 89 df f3 ab 83 3d f4 19 33 c0 03 8
b 3a
EIP: [<c01aa59e>]smack_netlabel+0x13/0xc8SS:ESP 0068:f682edd8---[ end trace 499ec328c921ccf2 ]---
First analysis is that I've got an issue with kernel sockets. If you can turn off NFS for the time being (I know that may not be a helpful suggestion) you should be able to move forward. Thank you for the trace, I hope to have the fix in short order.
Casey Schaufler
[email protected]
Am Montag, 11. Februar 2008 schrieb Casey Schaufler:
Quoted 4 lines
First analysis is that I've got an issue with kernel sockets. If you can turn off NFS for the time being (I know that may not be a helpful suggestion) you should be able to move forward. Thank you for the trace, I hope to have the fix in short order.
Thank you for your quick reply. Just tell me if you need more information.
regards,
Jörg
Signature · 2 lines
PGP Key: send mail with subject 'SEND PGP-KEY' PGP Key-ID: FD 4E 21 1D PGP Fingerprint: 388A872AFC5649D3 BCEC65778BE0C605
PATCH 1/1 Smack: Check for 'struct socket' with NULL sk
In reply to Joerg PlatteQuoted 9 lines · Joerg Platte
Hi,
when booting linux 2.6.25-rc1 I get the following error:
BUG: unable to handle kernel NULL pointer dereference at 00000138 IP: [<c01aa59e>] smack_netlabel+0x13/0xc8 *pde = 00000000 Oops: 0000 [#1] PREEMPT Modules linked in: nfsd
[...]
Quoted 8 lines
Call Trace: [<c01aacf8>] ? new_inode_smack+0x39/0x3f [<c01aad52>] ? smack_inode_alloc_security+0x16/0x27 [<c01a7510>] ? security_inode_alloc+0x19/0x1b [<c01aa665>] ? smack_socket_post_create+0x12/0x18 [<c01a7a06>] ? security_socket_post_create+0x16/0x1b [<c02116ce>] ? sock_create_lite+0x44/0x64 [<c0211712>] ? kernel_accept+0x24/0x5f
Hi Joerg,
There's a small problem with smack and NFS. A similar report was also sent here: http://lkml.org/lkml/2007/10/27/85
Could you please check below patch ? I think it should fix your problem.
I've also added similar checks in inode_{get/set}security(). Cheating from SELinux post_create_socket(), it does the same. Casey, Thoughts ?
---
security/smack/smack_lsm.c +6 -4
@@ -701,7 +701,7 @@ static int smack_inode_getsecurity(const struct inode *inode,return -EOPNOTSUPP ; sock =SOCKET_I (ip); -if (sock ==NULL ) +if (sock ==NULL || sock->sk ==NULL )return -EOPNOTSUPP ; ssp = sock->sk->sk_security;
@@ -1280,10 +1280,12 @@ static void smack_to_secattr(char *smack, struct netlbl_lsm_secattr *nlsp)*/ static int smack_netlabel (struct sock *sk) { -struct socket_smack *ssp = sk->sk_security; +struct socket_smack *ssp;struct netlbl_lsm_secattr secattr;int rc =0 ; +BUG_ON (sk ==NULL ); + ssp = sk->sk_security;netlbl_secattr_init (&secattr);smack_to_secattr (ssp->smk_out, &secattr);if (secattr.flags !=NETLBL_SECATTR_NONE )
@@ -1331,7 +1333,7 @@ static int smack_inode_setsecurity(struct inode *inode, const char *name,return -EOPNOTSUPP ; sock =SOCKET_I (inode); -if (sock ==NULL ) +if (sock ==NULL || sock->sk ==NULL )return -EOPNOTSUPP ; ssp = sock->sk->sk_security;
@@ -1362,7 +1364,7 @@ static int smack_inode_setsecurity(struct inode *inode, const char *name,static int smack_socket_post_create (struct socket *sock,int family,int type,int protocol,int kern) { -if (family !=PF_INET ) +if (family !=PF_INET || sock->sk ==NULL )return 0 ;/* * Set the outbound netlbl.
Casey Schaufler
maintainerRe: [PATCH - BUGFIX] Smack: Check for 'struct socket' with NULL sk
Quoted 22 lines · --- "Ahmed S. Darwish
Quoted 9 lines · Joerg Platte
Hi,
when booting linux 2.6.25-rc1 I get the following error:
BUG: unable to handle kernel NULL pointer dereference at 00000138 IP: [<c01aa59e>] smack_netlabel+0x13/0xc8 *pde = 00000000 Oops: 0000 [#1] PREEMPT Modules linked in: nfsd[...]
Quoted 8 lines
Call Trace: [<c01aacf8>] ? new_inode_smack+0x39/0x3f [<c01aad52>] ? smack_inode_alloc_security+0x16/0x27 [<c01a7510>] ? security_inode_alloc+0x19/0x1b [<c01aa665>] ? smack_socket_post_create+0x12/0x18 [<c01a7a06>] ? security_socket_post_create+0x16/0x1b [<c02116ce>] ? sock_create_lite+0x44/0x64 [<c0211712>] ? kernel_accept+0x24/0x5fHi Joerg,
Quoted 7 lines
There's a small problem with smack and NFS. A similar report was also sent here: http://lkml.org/lkml/2007/10/27/85
Could you please check below patch ? I think it should fix your problem.
I've also added similar checks in inode_{get/set}security(). Cheating from SELinux
post_create_socket(), it does the same. Casey, Thoughts ?
If it's only NFS being uncooperative, as opposed to Smack not measuring up on socket handling in general, this might be the way to go about dealing with this problem until Smack NFS support proper goes in (no dates promised there!). I will have a better look once I get my posting-email working again.
Quoted 51 lines
Signed-off-by Ahmed S. Darwish <[email protected]>---
security/smack/smack_lsm.c +1
-1@@ -701,7 +701,7 @@ static int smack_inode_getsecurity(const struct inode *inode, return -EOPNOTSUPP ; sock =SOCKET_I (ip); -if (sock ==NULL ) +if (sock ==NULL || sock->sk ==NULL )return -EOPNOTSUPP ;security/smack/smack_lsm.c +3
-1ssp = sock->sk->sk_security;@@ -1280,10 +1280,12 @@ static void smack_to_secattr(char *smack, structnetlbl_lsm_secattr *nlsp) */ static int smack_netlabel (struct sock *sk) { -struct socket_smack *ssp = sk->sk_security; +struct socket_smack *ssp;struct netlbl_lsm_secattr secattr;int rc =0 ; +BUG_ON (sk ==NULL ); + ssp = sk->sk_security;netlbl_secattr_init (&secattr);smack_to_secattr (ssp->smk_out, &secattr);security/smack/smack_lsm.c +1
-1if (secattr.flags !=NETLBL_SECATTR_NONE )@@ -1331,7 +1333,7 @@ static int smack_inode_setsecurity(struct inode *inode,const char *name, return -EOPNOTSUPP; sock =SOCKET_I (inode); -if (sock ==NULL ) +if (sock ==NULL || sock->sk ==NULL )return -EOPNOTSUPP ;security/smack/smack_lsm.c +1
-1ssp = sock->sk->sk_security;@@ -1362,7 +1364,7 @@ static int smack_inode_setsecurity(struct inode *inode, const char *name, static int smack_socket_post_create(struct socket *sock, int family, int type, int protocol, int kern) { - if (family != PF_INET) + if (family != PF_INET || sock->sk == NULL) return 0; /*
Quoted 4 lines
* Set the outbound netlbl.
Casey Schaufler
[email protected]
Re: [PATCH - BUGFIX] Smack: Check for 'struct socket' with NULL sk
In reply to Ahmed S. DarwishAm Dienstag, 12. Februar 2008 schrieb Ahmed S. Darwish:
Quoted 6 lines
Hi Joerg,
There's a small problem with smack and NFS. A similar report was also sent here: http://lkml.org/lkml/2007/10/27/85
Could you please check below patch ? I think it should fix your problem.
Hi Ahmed,
your patch fixes the nfs problem! Thank you!
regards,
Jörg
Signature · 2 lines
PGP Key: send mail with subject 'SEND PGP-KEY' PGP Key-ID: FD 4E 21 1D PGP Fingerprint: 388A872AFC5649D3 BCEC65778BE0C605
Re: [PATCH - BUGFIX] Smack: Check for 'struct socket' with NULL sk
In reply to Ahmed S. DarwishQuoted 25 lines · --- "Ahmed S. Darwish
Quoted 9 lines · Joerg Platte
Hi,
when booting linux 2.6.25-rc1 I get the following error:
BUG: unable to handle kernel NULL pointer dereference at 00000138 IP: [<c01aa59e>] smack_netlabel+0x13/0xc8 *pde = 00000000 Oops: 0000 [#1] PREEMPT Modules linked in: nfsd[...]
Quoted 8 lines
Call Trace: [<c01aacf8>] ? new_inode_smack+0x39/0x3f [<c01aad52>] ? smack_inode_alloc_security+0x16/0x27 [<c01a7510>] ? security_inode_alloc+0x19/0x1b [<c01aa665>] ? smack_socket_post_create+0x12/0x18 [<c01a7a06>] ? security_socket_post_create+0x16/0x1b [<c02116ce>] ? sock_create_lite+0x44/0x64 [<c0211712>] ? kernel_accept+0x24/0x5fHi Joerg,
There's a small problem with smack and NFS. A similar report was also sent here: http://lkml.org/lkml/2007/10/27/85
Quoted 6 lines
Could you please check below patch ? I think it should fix your problem.
I've also added similar checks in inode_{get/set}security(). Cheating from SELinux
post_create_socket(), it does the same. Casey, Thoughts ?Signed-off-by Ahmed S. Darwish <[email protected]>
This looks like the right sort of thing to do. I would like to see it in. If you would like Ahmed, please submit with my Acknowlegement. Thank you for the work on this.
Quoted 49 lines
---
security/smack/smack_lsm.c +1
-1@@ -701,7 +701,7 @@ static int smack_inode_getsecurity(const struct inode *inode, return -EOPNOTSUPP ; sock =SOCKET_I (ip); -if (sock ==NULL ) +if (sock ==NULL || sock->sk ==NULL )return -EOPNOTSUPP ;security/smack/smack_lsm.c +3
-1ssp = sock->sk->sk_security;@@ -1280,10 +1280,12 @@ static void smack_to_secattr(char *smack, structnetlbl_lsm_secattr *nlsp) */ static int smack_netlabel (struct sock *sk) { -struct socket_smack *ssp = sk->sk_security; +struct socket_smack *ssp;struct netlbl_lsm_secattr secattr;int rc =0 ; +BUG_ON (sk ==NULL ); + ssp = sk->sk_security;netlbl_secattr_init (&secattr);smack_to_secattr (ssp->smk_out, &secattr);security/smack/smack_lsm.c +1
-1if (secattr.flags !=NETLBL_SECATTR_NONE )@@ -1331,7 +1333,7 @@ static int smack_inode_setsecurity(struct inode *inode,const char *name, return -EOPNOTSUPP; sock =SOCKET_I (inode); -if (sock ==NULL ) +if (sock ==NULL || sock->sk ==NULL )return -EOPNOTSUPP ;security/smack/smack_lsm.c +1
-1ssp = sock->sk->sk_security;@@ -1362,7 +1364,7 @@ static int smack_inode_setsecurity(struct inode *inode, const char *name, static int smack_socket_post_create(struct socket *sock, int family, int type, int protocol, int kern) { - if (family != PF_INET) + if (family != PF_INET || sock->sk == NULL) return 0; /*
Quoted 9 lines
* Set the outbound netlbl.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Casey Schaufler
[email protected]
Re: [PATCH - BUGFIX] Smack: Check for 'struct socket' with NULL sk
In reply to Ahmed S. Darwishsecurity/smack/smack_lsm.c static void smack_to_secattr(char *smack, struct netlbl_lsm_secattr *nlsp) · line 1288
Quoted 2 lines · On Tue, 12 Feb 2008 01:23:47 +0200 "Ahmed S. Darwish" <[email protected]>…
security/smack/smack_lsm.c +2
-0+BUG_ON (sk ==NULL ); + ssp = sk->sk_security;
I'll remove the BUG_ON - the oops on the next line will provide us with just the same information.
Thanks for the fix.