mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michail Andreas Michalopoulos <mike.michalo@gmail.com>
To: pc@manguebit.org
Cc: bharathsm@microsoft.com, linkinjeon@kernel.org,
	linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org,
	ronniesahlberg@gmail.com, samba-technical@lists.samba.org,
	sprasad@microsoft.com,
	syzbot+c2ec61adfbcb24e5ec20@syzkaller.appspotmail.com,
	syzkaller-bugs@googlegroups.com, tom@talpey.com,
	Michail Andreas Michalopoulos <mike.michalo@gmail.com>
Subject: Re: [syzbot] [cifs?] KASAN: slab-use-after-free Read in cifs_crypto_secmech_release
Date: Sat, 24 Oct 2026 20:46:05 +0200	[thread overview]
Message-ID: <20261024184605.44432-1-mike.michalo@gmail.com> (raw)
In-Reply-To: <8bb0534e33a5f5d152d2b1768d1fd7c6@manguebit.org>

Hi Paulo,

On Tue, Oct 20, 2026, Paulo Alcantara wrote:
> #syz test: git://git.manguebit.org/linux.git cifs-fixes 

Not sure if you already have verified your patch but
In case this is still helpful:

syzbot has no reproducer for this one, so I tried to make one. The
natural window is tiny (the demultiplex thread only rechecks
tcpStatus when its 7 s receive timeout expires), so I widened it
with a debug msleep(10000) right after tcpStatus = CifsExiting in
cifs_put_tcp_session(). The trigger itself is simple: a TCP listener
on 127.0.0.1:445 that accepts but never answers, a cifs mount of
//127.0.0.1/share against it, and SIGKILL to the mount after 1 s, so
cifs_mount() fails with -ERESTARTSYS and drops the last reference.

Without your patch this gives the same report as syzbot:

  BUG: KASAN: slab-use-after-free in cifs_crypto_secmech_release
   cifs_put_tcp_session
  Freed by task ...:
   clean_demultiplex_info
  CIFS: VFS: cifs_mount failed w/return code = -512

With your patch ("smb: client: fix UAF of TCP_Server_Info in
cifs_put_tcp_session()", fcf942f9eeca) and the same delay at the
same point, 5 rounds run without any KASAN report.

Tested on UML (x86_64, KASAN, PREEMPT) on top of ksmbd-for-next
4623da395dc4, whose fs/smb/client/connect.c is the blob your patch
applies to. Without the delay, 50 rounds on the unfixed kernel did
not hit the race.

The reproducer, run as root:

  import ctypes, os, signal, socket, time
  srv = socket.socket()
  srv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
  srv.bind(("127.0.0.1", 445))
  srv.listen(64)
  held = []
  if os.fork() == 0:          # accept, never reply
      while True:
          held.append(srv.accept()[0])
  libc = ctypes.CDLL(None, use_errno=True)
  os.makedirs("/run/cifsmnt", exist_ok=True)
  pid = os.fork()
  if pid == 0:
      libc.mount(b"//127.0.0.1/share", b"/run/cifsmnt", b"cifs", 0,
                 b"username=u,password=p,vers=3.1.1")
      os._exit(0)
  time.sleep(1)
  os.kill(pid, signal.SIGKILL)
  os.waitpid(pid, 0)

In case it helps when you post the patch:

Tested-by: Michail Andreas Michalopoulos <mike.michalo@gmail.com>

Thanks,
Michalis

  parent reply	other threads:[~2026-10-24 18:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-20  1:05 syzbot
2026-10-20  4:06 ` Paulo Alcantara
2026-10-20  4:06   ` syzbot
2026-10-24 18:46   ` Michail Andreas Michalopoulos [this message]
2026-10-25 17:29     ` Paulo Alcantara
2026-10-25 17:57       ` mixalhs
2026-10-25 18:05         ` Paulo Alcantara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261024184605.44432-1-mike.michalo@gmail.com \
    --to=mike.michalo@gmail.com \
    --cc=bharathsm@microsoft.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pc@manguebit.org \
    --cc=ronniesahlberg@gmail.com \
    --cc=samba-technical@lists.samba.org \
    --cc=sprasad@microsoft.com \
    --cc=syzbot+c2ec61adfbcb24e5ec20@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=tom@talpey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®