From nobody Thu Mar 31 17:50:44 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 30A521A56C4E; Thu, 31 Mar 2022 17:50:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KTrSN6Yl0z4s9B; Thu, 31 Mar 2022 17:50:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648749045; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=b3mm1QLMLBN3VvCjhFyxnlEnFbLauKItuWMRQZE1NUo=; b=PTDmMV2Ax9nrP2eKYa0cYw5h7uXShH2vYZu/9r9CR9E1xYQoLsIHIn8kzM0cdWh/gzbn0N aRRzV6ZCR7Aa2r82sd+WUT7aEHoVA4C1Rdd24jUwiyCX6BmF5YqLlxCTygBtDyqiQpkddg l/euoA23xr1ruxQwaEIV2AiFHFo9ZoWsWy4Bzl8MOvL4sT+J4dqSgBRDnjf2ZKgnIz+sGZ S81Ply0OzHDoMfzQyb199UjeDBW2ItuqrhhZtlH0W8kWlhwUemfyoAMqljdHLc0yf5+vRg G+oa0guBPUDOSeTlQQnF0vN0v07gH18fepsyyT5XKYjNsP+q9+q2sbaROyn4LA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B82082BF30; Thu, 31 Mar 2022 17:50:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 22VHoikK038803; Thu, 31 Mar 2022 17:50:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22VHoinC038802; Thu, 31 Mar 2022 17:50:44 GMT (envelope-from git) Date: Thu, 31 Mar 2022 17:50:44 GMT Message-Id: <202203311750.22VHoinC038802@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 099fa2feb36f - main - linux(4): Fixup miscalculation of d_off of struct dirent in getdents() syscalls. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 099fa2feb36fe6a68a87dfdb0f290b882139a88d Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648749045; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=b3mm1QLMLBN3VvCjhFyxnlEnFbLauKItuWMRQZE1NUo=; b=IzFJuOeX37eqpGsD6TmDANJ7akoAzRP/HrwdGxSaZIJ3mNNiK67U9hNun2Iket/krdIHzG nQcZSD9mWwY5Daqa3X+rwvjPW2M88XKpjJjEJairSEe4MdlJan9M1xeovMCNmsS2j0yQhI A5PYdGKTn+GJ8jRsToU0USPqibgfVSOTFgQVtVNqLACRQWTBJcKDvdeh1ktFEgfmtjS5dY /6PxNxCB7hSh3nYnvDHOqjuTlgRTUniltPvnAlRfRzgJmF/M3pyHYe7QDczZ1p8CPeKVpD mksv1iOXbAleLvHOU7jRCzfiKKgnU2zYBMUFXWEnv8DdAtDL7HKoC+fRgDuyBw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1648749045; a=rsa-sha256; cv=none; b=wJEQWE6b0QB1PxGdrRmxBLddpJMdJlmA4tpkEMqlokLgTO9iThXzznhJGTpwHIu45t6ZCT /NYNvYwJ3u2a+zJrPgZXn0jk+uJRApXWMSzvA4J9ennhU4/dKBnRWQtwIYe2H51bwqW1jd h840Gn+gkqtWfy4W88Lx+AEEJOAWZhtDtrc3DU+FSepPctUCRCbA37xff9T3A8WKf5vfRB AdFMwIQvrVlHg6z3wbUDcBzoQHUlmKVjdpfjMb6HOKoS2SvQ5Abv9bWWPLU6VHkl0Mnsva /cR0iKv8IUUhU6Pe4dTbVBrK5D8+tZOOm95EN30b6hBK88LLnE67awvYIkeuBg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=099fa2feb36fe6a68a87dfdb0f290b882139a88d commit 099fa2feb36fe6a68a87dfdb0f290b882139a88d Author: Dmitry Chagin AuthorDate: 2022-03-31 17:50:09 +0000 Commit: Dmitry Chagin CommitDate: 2022-03-31 17:50:09 +0000 linux(4): Fixup miscalculation of d_off of struct dirent in getdents() syscalls. Avoid calculating d_off value as it is specific to the underlying filesystem and can be used by others API, like lseek(), seekdir() as input offset. Differential revision: https://reviews.freebsd.org/D31551 MFC after: 2 weeks --- sys/compat/linux/linux_file.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c index 285faaf8927b..6a1402c09456 100644 --- a/sys/compat/linux/linux_file.c +++ b/sys/compat/linux/linux_file.c @@ -497,7 +497,7 @@ linux_getdents(struct thread *td, struct linux_getdents_args *args) linux_dirent = (struct l_dirent*)lbuf; linux_dirent->d_ino = bdp->d_fileno; - linux_dirent->d_off = base + reclen; + linux_dirent->d_off = bdp->d_off; linux_dirent->d_reclen = linuxreclen; /* * Copy d_type to last byte of l_dirent buffer @@ -574,7 +574,7 @@ linux_getdents64(struct thread *td, struct linux_getdents64_args *args) linux_dirent64 = (struct l_dirent64*)lbuf; linux_dirent64->d_ino = bdp->d_fileno; - linux_dirent64->d_off = base + reclen; + linux_dirent64->d_off = bdp->d_off; linux_dirent64->d_reclen = linuxreclen; linux_dirent64->d_type = bdp->d_type; strlcpy(linux_dirent64->d_name, bdp->d_name, @@ -631,7 +631,7 @@ linux_readdir(struct thread *td, struct linux_readdir_args *args) linux_dirent = (struct l_dirent*)lbuf; linux_dirent->d_ino = bdp->d_fileno; - linux_dirent->d_off = linuxreclen; + linux_dirent->d_off = bdp->d_off; linux_dirent->d_reclen = bdp->d_namlen; strlcpy(linux_dirent->d_name, bdp->d_name, linuxreclen - offsetof(struct l_dirent, d_name));