From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796389450; b=GBXBNQuUNXYbVIPf5ZiCO50FYLzGM7BU9x2yld+COnoTeiiDIhI7qfRSPWyxMmulGout aAtycYTo7xothnAw6epyb/9UKBS5ytEw7Pp//L6t165VRQl3eP5hmIh1+V21cu245N19e XIKhZQ3w0AOxbc2wA0s0iGToF83Cye6X8jjrnwJ2GNOZw5l50PREztKhqcIsP+j5uHb+Y qXjT4kpjRF5A6mpOH9EFXdljjfBEjXvalymWXuIVwgPaTOFrcvTSAUVc80aBMzxWk5GKq A8DpnBZA4ceWeic2gQ9hJim2ZWaz94+5ckgiuBsTgzcwX/hipJ4ooJJLQ0iOlgA6RgA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796389450; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=k3xBS8fqP2RZapZdckdItlzFbaqDmnJSuMsMqDD1vQ0=; b=wHNJhqQvwNhLLrhLU0Rn3wQ89sNyaZf5GrkoG9D0EX7PNr+ucMpv6mIudIeavT8KktCN OZSFTBpcw++8kalhXkBOOiOhRIDXHndCOMOufV4qxsyKXGLQ9bogPWSygQH4tUTLuqzQH DDdD0a5f8zViAaEm07pMjBqEeqHhbgrY4TX01wby8HHj+HERSZ+ATdviz/vrM0wpZtfCq iAf3U8puvrZdMLb01Rf8r2k6b1BpFmu0S60hOfkmcnNdHTkIXZ/+qtpcskly/1jyuAB50 efi8by+mEn/eElG8OwC0EGe8AMusgYT+oQplnJFbI16tFrjRsCd96BIh9/Inrs1mj8Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=f4utae43; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 261F7606A32C; Fri, 4 Dec 2026 13:04:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=f4utae43 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D28F1F00931; Fri, 4 Dec 2026 13:04:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796389449; bh=k3xBS8fqP2RZapZdckdItlzFbaqDmnJSuMsMqDD1vQ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=f4utae43t1011suuvmH90Tx9jA6zcApQYVgz6vScxH+JmgrzNR/cyrXE7ZY4zGu3/ 0MPcI3rXSZISPpPy0PS27OIuelzvSnAcTeDWw0iP9lGzLVvcTGuENF0YhdhpzXR8vF 54VIDi4F1EF7HZj6j/bZy60HDrxtN3gxX4IqnMKg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ding Feng , Damien Le Moal Subject: [PATCH 6.1 0996/1059] zonefs: ignore RLIMIT_FSIZE above LLONG_MAX in zonefs_write_check_limits() Date: Fri, 4 Dec 2026 19:08:47 +0900 Message-ID: <20261204100709.793839659@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ding Feng commit fb5289b697c965581104bafdd875b969a1db3e79 upstream. zonefs_write_check_limits() follows generic_write_check_limits() and has the same problem: it stores rlimit(RLIMIT_FSIZE), an unsigned long, in a loff_t, so a soft limit between 2^63 and RLIM_INFINITY is negative and every write fails with -EFBIG and raises SIGXFSZ. Keep the limit unsigned and apply it only when it is at most LLONG_MAX, as the generic helper now does. Fixes: ebfd68cd0c1e ("zonefs: Fix O_APPEND async write handling") Cc: stable@vger.kernel.org Assisted-by: Claude:claude-opus-5-5 Frama-C Signed-off-by: Ding Feng Signed-off-by: Damien Le Moal Signed-off-by: Greg Kroah-Hartman --- fs/zonefs/file.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) --- a/fs/zonefs/file.c +++ b/fs/zonefs/file.c @@ -474,15 +474,16 @@ static loff_t zonefs_write_check_limits( { struct inode *inode = file_inode(file); struct zonefs_zone *z = zonefs_inode_zone(inode); - loff_t limit = rlimit(RLIMIT_FSIZE); + u64 limit = rlimit(RLIMIT_FSIZE); loff_t max_size = z->z_capacity; - if (limit != RLIM_INFINITY) { - if (pos >= limit) { + /* No file position reaches a limit above LLONG_MAX. */ + if (limit != RLIM_INFINITY && limit <= LLONG_MAX) { + if (pos >= (loff_t)limit) { send_sig(SIGXFSZ, current, 0); return -EFBIG; } - count = min(count, limit - pos); + count = min(count, (loff_t)limit - pos); } if (!(file->f_flags & O_LARGEFILE))