Bug#1029968: bttv/v4l: WARNING: CPU: 6 PID: 6164 at mm/vmalloc.c:487 __vmap_pages_range_noflush+0x3e0/0x4d0

2023-02-04 Thread Diederik de Haas
On Saturday, 4 February 2023 02:06:02 CET Dr. David Alan Gilbert wrote:
> a) The patch I bisected to is not the root cause of the bug; it just
> triggers a ~9 year old bug in the v4l code - so this patch isn't going
> to get changed.
> 
> b) The ~9 year old bug is in a particularly hairy piece of memory management
> code  in v4l that I doubt anyone is going to fix.
> 
> c) The plan is all the drivers using that API are to either be retired
> or rewritten using a new API; that's already been done for some of the
> drivers and the bttv one is a few months out.  I'm not sure that's
> any use to this version of Debian though.
> 
> d) The work arounds are:
>   1) Disable iommu
>   2) some v4l tools can use an mmap interface rather than the read(2)
> interface; that seems to be OK.

Also reading the upstream conversation, that seems like a good summary :)

I could be wrong (ofc), but I doubt this issue will be fixed in kernel 6.1 
which is planned to be Bookworm's kernel.

What you could do is test any patch(es) they put out and provide feedback on 
those and if you find that the patch(es) fixes the/your issue, you could 
consider providing a "Tested-By: yourname " which can have a 
positive effect on the maintainer accepting the patch from which it then can 
procede further up the chain to Linus.
When it does end up in Linus' tree and it would need to have a new Kconfig 
option enabled in Debian's kernel, feel free to request that.

I think IOMMU is a really good thing, so disabling that does not sound ideal, 
but it could be an acceptable workaround (for now).
If you want to run Bookworm on your system, you'd probably have to wait till a 
suitable Backports kernel becomes available. If you go for Trixie, you should 
get (in time) the proper fix by just upgrading.

Thanks for all the investigative work and bringing it to upstream :-)

Cheers,
  Diederik

signature.asc
Description: This is a digitally signed message part.


Bug#1029968: bttv/v4l: WARNING: CPU: 6 PID: 6164 at mm/vmalloc.c:487 __vmap_pages_range_noflush+0x3e0/0x4d0

2023-01-29 Thread David Alan Gilbert
Package: src:linux
Version: 6.1.4-1
Severity: normal

Dear Maintainer,

*** Reporter, please consider answering these questions, where appropriate ***

   * What led up to the situation?

This was triggered when trying to capture video via a bt878 card using the
https://github.com/ali1234/vhs-teletext  script.  Note 'xawtv' is working
fine, so the card is generally happy.

   * What exactly did you do (or not do) that was effective (or
 ineffective)?

I ran 'teletext record -d /dev/vbi0 > capture.vbi' from the above package
that triggers a read from vbi0; an strace shows:
[pid  6466] read(3, 0x27feb20, 65536)   = -1 ENOMEM (Cannot allocate memory)

and the WARN_ON in the dmesg

   * What was the outcome of this action?

a WARNING in the dmesg, see below; and the python script backtraced
with apparently an -ENOMEM; but there's plenty of RAM:
dg@major:~/vhs-teletext$ free -m
   totalusedfree  shared  buff/cache   available
Mem:7937 7892963   244847147
Swap:974   0 974

   * What outcome did you expect instead?
Happy gathered video.

*** End of the template - remove these template lines ***


-- Package-specific info:
** Version:
Linux version 6.1.0-1-amd64 (debian-ker...@lists.debian.org) (gcc-12 (Debian 
12.2.0-13) 12.2.0, GNU ld (GNU Binutils for Debian) 2.39.90.20221231) #1 SMP 
PREEMPT_DYNAMIC Debian 6.1.4-1 (2023-01-07)

** Command line:
BOOT_IMAGE=/boot/vmlinuz-6.1.0-1-amd64 
root=UUID=bce3fb05-edb4-4c73-b71d-86707031ffd1 ro intremap=nosid quiet

** Tainted: WI (2560)
 * kernel issued warning
 * workaround for bug in platform firmware applied

** Kernel log:
[ 5398.299139] kauditd_printk_skb: 15 callbacks suppressed
[ 5398.299142] audit: type=1400 audit(1675007035.570:27): apparmor="STATUS" 
operation="profile_replace" info="same as current profile, skipping" 
profile="unconfined" name="libreoffice-oosplash" pid=4269 comm="apparmor_parser"
[ 5398.365964] audit: type=1400 audit(1675007035.638:28): apparmor="STATUS" 
operation="profile_replace" info="same as current profile, skipping" 
profile="unconfined" name="libreoffice-senddoc" pid=4272 comm="apparmor_parser"
[ 5403.855538] audit: type=1400 audit(1675007041.126:29): apparmor="STATUS" 
operation="profile_replace" profile="unconfined" name="libreoffice-soffice" 
pid=4275 comm="apparmor_parser"
[ 5403.879158] audit: type=1400 audit(1675007041.150:30): apparmor="STATUS" 
operation="profile_replace" profile="unconfined" 
name="libreoffice-soffice//gpg" pid=4275 comm="apparmor_parser"
[ 5403.927433] audit: type=1400 audit(1675007041.198:31): apparmor="STATUS" 
operation="profile_replace" info="same as current profile, skipping" 
profile="unconfined" name="libreoffice-xpdfimport" pid=4278 
comm="apparmor_parser"
[ 7268.952515] [ cut here ]
[ 7268.952518] WARNING: CPU: 6 PID: 6164 at mm/vmalloc.c:487 
__vmap_pages_range_noflush+0x3e0/0x4d0
[ 7268.952529] Modules linked in: rfkill qrtr binfmt_misc tuner_simple 
tuner_types tuner tda7432 tvaudio intel_powerclamp coretemp msp3400 kvm_intel 
bttv tveeprom kvm snd_hda_codec_via videobuf_dma_sg snd_hda_codec_generic 
videobuf_core irqbypass tea575x snd_hda_codec_hdmi ledtrig_audio sha512_ssse3 
sha512_generic snd_hda_intel videodev snd_intel_dspcfg snd_intel_sdw_acpi 
intel_cstate iTCO_wdt snd_hda_codec snd_bt87x intel_uncore mc snd_hda_core 
serio_raw intel_pmc_bxt snd_hwdep iTCO_vendor_support pcspkr i7core_edac 
watchdog snd_pcm snd_timer joydev snd soundcore acpi_cpufreq evdev sg 
firewire_sbp2 msr parport_pc ppdev lp parport fuse configfs efi_pstore 
ip_tables x_tables autofs4 ext4 crc16 mbcache jbd2 crc32c_generic sd_mod t10_pi 
crc64_rocksoft crc64 crc_t10dif crct10dif_generic crct10dif_common hid_generic 
usbhid hid nouveau mxm_wmi video wmi i2c_algo_bit drm_display_helper cec 
rc_core ahci ata_generic drm_ttm_helper libahci pata_via ttm libata 
drm_kms_helper r8169 ehci_pci realtek
[ 7268.952592]  firewire_ohci psmouse ehci_hcd scsi_mod drm mdio_devres 
crc32c_intel usbcore libphy firewire_core i2c_i801 crc_itu_t i2c_smbus lpc_ich 
scsi_common usb_common button
[ 7268.952603] CPU: 6 PID: 6164 Comm: teletext Tainted: G  I
6.1.0-1-amd64 #1  Debian 6.1.4-1
[ 7268.952605] Hardware name: To Be Filled By O.E.M. To Be Filled By 
O.E.M./P55M Pro, BIOS P1.50 09/10/2009
[ 7268.952607] RIP: 0010:__vmap_pages_range_noflush+0x3e0/0x4d0
[ 7268.952610] Code: 48 48 83 c6 08 4d 39 d6 0f 85 39 fd ff ff 48 83 c4 58 31 
c0 5b 5d 41 5c 41 5d 41 5e 41 5f c3 cc cc cc cc 0f 0b e9 5f fc ff ff <0f> 0b b8 
f4 ff ff ff e9 bd fc ff ff 48 8b 4c 24 18 48 31 cf 48 21
[ 7268.952611] RSP: 0018:ac9307073b50 EFLAGS: 00010246
[ 7268.952613] RAX: 00023b68 RBX: 9ab8cbb7f480 RCX: eeafad0aae40
[ 7268.952614] RDX: 00011db42ab9 RSI:  RDI: 00011db42ab9
[ 7268.952615] RBP:  R08: 0476 R09: ac93072a
[ 7268.952617]