From nobody Fri Jun 17 19:38:52 2022 X-Original-To: dev-commits-src-all@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 450A285BB24; Fri, 17 Jun 2022 19:38:53 +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 4LPq984XYxz3Qbk; Fri, 17 Jun 2022 19:38:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494733; 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=KsnFspu35b/b4Ab6ZAA22axRPhK3MetJz39JiOogksQ=; b=JV0yKjNSlHbkMjvmHRSIl+1utuqk6TUrxFPa8GZJi+uothQJYosEg8wxC+KqEvBDBY9sDk WXlqtS8YNMhWci0BiPNLml0gLvVLK226zNoCks92O3+lty4GRww6ZmmkMnjqRQ+bBdptE7 kRzYbJhyD1gCQLejmcHDDsOjs3uQHiGRzDOV7eK1E8f1iYR+SeVruX4uGsFU3eGkIe0pU3 oCk2B7LEx9GEDKgDrACxisWhCNHt5LF7WoRc3mZfn797bGtSTDzPA1Ih8ayu3/PgTMOhU6 zm8a1a9ZEsaCxmKUKOt5BjOUvG+DucoeEM51M342/U2mWuM5mIjQiMiBCXGcIQ== 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 47995257DA; Fri, 17 Jun 2022 19:38:52 +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 25HJcqlB015253; Fri, 17 Jun 2022 19:38:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25HJcqhl015252; Fri, 17 Jun 2022 19:38:52 GMT (envelope-from git) Date: Fri, 17 Jun 2022 19:38:52 GMT Message-Id: <202206171938.25HJcqhl015252@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: 71d5b525f5d2 - stable/13 - linux(4): Fixup miscalculation of d_off of struct dirent in getdents() syscalls. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 71d5b525f5d2a3d7f99ceb4540f8512c491dd003 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494733; 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=KsnFspu35b/b4Ab6ZAA22axRPhK3MetJz39JiOogksQ=; b=ghRFH19vj2HV0I89J5mUx9A8QdDionvrNP/MSMj57HmeXPn+Ba5bve4BvLP8n/DIjmvExx zILBpFxsaMsXOhTeN9IuyQS7KR4Ap+LuyfzoBtkInsCOb6aXey732eEEdvf+5k4w8FW/b3 c1UUydMlNZf3x6JMpLs0fupYlrlI/1DDQR1VWvFn8jVgaIUXUx+ySSpTugFCp+tDLXWUmY pin3+udNdGgyyT2gFH2+04QUhmV2yI9dRus5xmQPzaF48C2WSIdDnocioP7odtqYuBiE2n n/ovKWpx2Y+Aiiubjtz3q7auVyuw5BAN9pHtJuyLUVN8Ry62rTR3ae4tsysoSw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1655494733; a=rsa-sha256; cv=none; b=U2EFrK+hBqC41R3hIvPAQKWsepAcPiH8H/5EaZ4kEWQTuXYBi2Z9Ih8kYDrO3aaS1IcmRD wALV3z8N7N2yGPDd6PlON8KpsUT1TyNb4ywoDcnfG1jRjsWWWbUuDVxBkd5wcXO+7bS8cA 5jT/L9FXF7p74TG1VFpp0S9wYJc3i5TcW+ens0QjZsLLUu1KYTqDJ9EO6RRyi3qtyaQUOu dOm/I4q2w+zgITha9O1kp5sjBlCZvCUg49Mx0R4AEME3eActBZUg+jdC/YJJaQIropRjzp 5dUoQwCPddzeYr+SVIMCPJyn2zvPyVagywRawOexOmm00Oz6iRnJH6i8RPofzg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=71d5b525f5d2a3d7f99ceb4540f8512c491dd003 commit 71d5b525f5d2a3d7f99ceb4540f8512c491dd003 Author: Dmitry Chagin AuthorDate: 2022-03-31 17:50:09 +0000 Commit: Dmitry Chagin CommitDate: 2022-06-17 19:33:46 +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 (cherry picked from commit 099fa2feb36fe6a68a87dfdb0f290b882139a88d) --- 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));