From nobody Mon Jun 8 05:24:56 2026 Received: from mail-ot1-f70.google.com (mail-ot1-f70.google.com [209.85.210.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C780340403 for ; Mon, 1 Jun 2026 23:48:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.70 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780357740; cv=none; b=sax/X5X63DPGS30O8QcBXn/jNcub64qSpvEtjyY6JHtznFJfdGOsE+tZI68hka+s6usQD4UzQ5i9AwHCdAABtfyq0q8vRfT36Rt1rB6a6FZFcRemTBGOhd8J/4zPk6hZ/r1q3xchWZv7/DqL+1f6FM/NqTBlwdTL/aAqT9ucm+w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780357740; c=relaxed/simple; bh=R7tbD04kJh3lRnF/CTl4+Pv/eWx9F/rgIDAnKEPWI4c=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=CAS9KvxylrdgKFkynD4er3neasCsPhr6O60YMDAP5NcZuwxHxL/4WCRIIPp570qtgjEPvfyhJaP8pmsKqGZCblLR5sl9e9ZJgmHBJ+mOyLxstXFpPihIfc1l7N/1Io+dSBzuZwM1e/w4GjDW3CiWNh8gz9spRbZmLiAjV0PDrLU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.210.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com Received: by mail-ot1-f70.google.com with SMTP id 46e09a7af769-7e67ba226ddso6139325a34.1 for ; Mon, 01 Jun 2026 16:48:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780357738; x=1780962538; h=to:from:subject:message-id:in-reply-to:date:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=yxbgD26QMEbo+1YwAng7mw5/MDN8d0Zp2zXSIdfOqmI=; b=eq+X7cfQuo+vtpiHfKqth62KPIKEpaF1BwbDz2zCaZVRAPI1fkzSZVDsWFZqBLebvM 0+D2lBC6uxVUhLaPyZlwPvvIhZgFBaXLRi00eSk+vxu7wFaWy/MoeB3YXTOBIb/hCLmB 0iGJGdOUmb9VWuWgattXUGNiGDj4pjJpOIYweqrKsqficvMFBuobxCL1xT9pUTVyAN6w tXs+lZUvHlmySyoSChGRRih5M9h1EYecVtQiy6TbEQvsKeDYkjsfyJ437IvwQ5EFR5xt H1uPLtX74WtNaDI858LjCmL63LgjMfVyuOUdz5HAc7tqqA9HTyo6oY45khh50r7rOdwP jQ6A== X-Gm-Message-State: AOJu0Yxg21kM4p1WQRuvc1BDosEHOOT4E2jutMvWsdAagAtosbmC6PSN nJSEqKKH12NLrROnuM4+f04N28RN7RPq8qzONSrPERS7gbZC2mAFzdqKXVlGo/5KG5klDMbqqZT nr4IO//lyjEWeHwKUzVj5ewk1GKuYZ91vTAkQJd4akheizdhjAF+j+Iw9uXs= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a05:6820:825:b0:67e:251a:bd3e with SMTP id 006d021491bc7-69e104e7240mr7389051eaf.18.1780357738277; Mon, 01 Jun 2026 16:48:58 -0700 (PDT) Date: Mon, 01 Jun 2026 16:48:58 -0700 In-Reply-To: <6a1dbc91.fbc46276.3c3783.0004.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <6a1e1a6a.b111c304.35cd64.0029.GAE@google.com> Subject: Forwarded: [PATCH] fs/namei: fix UAF in pick_link() by unlazying before atime check From: syzbot To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com. *** Subject: [PATCH] fs/namei: fix UAF in pick_link() by unlazying before atime= check Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git= master In pick_link(), atime_needs_update() is called while the path walk may still be in RCU mode (LOOKUP_RCU set), meaning no reference is held on the inode. A concurrent iput() from another task can free the inode while atime_needs_update() reads inode->i_opflags (offset +2) inside current_time() -> is_mgtime(), causing a use-after-free. KASAN reports: BUG: KASAN: slab-use-after-free in is_mgtime include/linux/fs.h:2313 Read of size 2 at addr ffff8880407e4282 (offset +2 =3D i_opflags) The race: Task A (pick_link) Task B (unlinkat) ------------------ ----------------- atime_needs_update(inode) iput(inode) current_time(inode) evict() is_mgtime(inode) destroy_inode() inode->i_opflags UAF inode FREED Fix: call try_to_unlazy() before atime_needs_update() so that a proper inode reference is held before any inode fields are read. If try_to_unlazy() detects the inode is already gone, it returns false and we exit safely with -ECHILD without touching freed memory. Reported-by: syzbot+36e50496c8ac4bcde3f9@syzkaller.appspotmail.com Link: https://syzkaller.appspot.com/bug?extid=3D36e50496c8ac4bcde3f9 Signed-off-by: Deepanshu Kartikey " --- fs/namei.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index c7fac83c9a85..eac0ec35be37 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2037,11 +2037,11 @@ static noinline const char *pick_link(struct nameid= ata *nd, struct path *link, unlikely(link->mnt->mnt_flags & MNT_NOSYMFOLLOW)) return ERR_PTR(-ELOOP); =20 + if (nd->flags & LOOKUP_RCU) { + if (!try_to_unlazy(nd)) + return ERR_PTR(-ECHILD); + } if (unlikely(atime_needs_update(&last->link, inode))) { - if (nd->flags & LOOKUP_RCU) { - if (!try_to_unlazy(nd)) - return ERR_PTR(-ECHILD); - } touch_atime(&last->link); cond_resched(); } --=20 2.43.0