lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJD7tkbEuFkGuQeYjKS02rQoAAKOKieAJ1P2mwukirW3e2JN9A@mail.gmail.com>
Date: Mon, 18 Mar 2024 13:17:19 -0700
From: Yosry Ahmed <yosryahmed@...gle.com>
To: Nhat Pham <nphamcs@...il.com>
Cc: syzbot <syzbot+adbc983a1588b7805de3@...kaller.appspotmail.com>, 
	akpm@...ux-foundation.org, chengming.zhou@...ux.dev, hannes@...xchg.org, 
	linux-kernel@...r.kernel.org, linux-mm@...ck.org, 
	syzkaller-bugs@...glegroups.com, Barry Song <v-songbaohua@...o.com>
Subject: Re: [syzbot] [mm?] kernel BUG in sg_init_one

On Mon, Mar 18, 2024 at 11:00 AM Nhat Pham <nphamcs@...il.com> wrote:
>
> On Mon, Mar 18, 2024 at 9:58 AM syzbot
> <syzbot+adbc983a1588b7805de3@...kaller.appspotmail.com> wrote:
> >
> > Hello,
> >
> > syzbot found the following issue on:
> >
> > HEAD commit:    e5eb28f6d1af Merge tag 'mm-nonmm-stable-2024-03-14-09-36' ..
> > git tree:       upstream
> > console output: https://syzkaller.appspot.com/x/log.txt?x=13043abe180000
> > kernel config:  https://syzkaller.appspot.com/x/.config?x=19bb57c23dffc38e
> > dashboard link: https://syzkaller.appspot.com/bug?extid=adbc983a1588b7805de3
> > compiler:       arm-linux-gnueabi-gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
> > userspace arch: arm
> > syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1706d231180000
> > C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=13ba7959180000
> >
> > Downloadable assets:
> > disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/8ead8862021c/non_bootable_disk-e5eb28f6.raw.xz
> > vmlinux: https://storage.googleapis.com/syzbot-assets/0a7371c63ff2/vmlinux-e5eb28f6.xz
> > kernel image: https://storage.googleapis.com/syzbot-assets/7539441b4add/zImage-e5eb28f6.xz
> >
> > IMPORTANT: if you fix the issue, please add the following tag to the commit:
> > Reported-by: syzbot+adbc983a1588b7805de3@...kaller.appspotmail.com
> >
> > ------------[ cut here ]------------
> > kernel BUG at include/linux/scatterlist.h:187!
>
> Looks like the provided buffer is invalid:
>
> #ifdef CONFIG_DEBUG_SG
> BUG_ON(!virt_addr_valid(buf));
> #endif
>
> which is "src" from:
>
> sg_init_one(&input, src, entry->length);
>
> Looking at the surrounding code and recent history, there's this
> commit that stands out:
>
> mm/zswap: remove the memcpy if acomp is not sleepable
> (sha: 270700dd06ca41a4779c19eb46608f076bb7d40e)
>
> which has the effect of, IIUC, using the zpool mapped memory directly
> as src, instead of acomp_ctx->buffer (which was previously the case,
> as zsmalloc was not sleepable).
>
> This might not necessarily be a bug with that commit itself, but might
> have revealed another bug elsewhere.
>
> Anyway, cc-ing the author, Barry Song, to fact check me :) Will take a
> closer look later.

I am not a highmem expert, but the reproducer has CONFIG_HIGHMEM=y,
and it seems like zs_map_object() may return a highmem address if the
compressed object is entirely in a single page to avoid copying to a
buffer:

if (off + class->size <= PAGE_SIZE) {
   /* this object is contained entirely within a page */
   area->vm_addr = kmap_atomic(page);
   ret = area->vm_addr + off;
   goto out;
}

The virt_addr_valid() check seems to indicate that we expect a direct
map address in sg_init_one(), right?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ