From nobody Fri Dec 22 15:50:11 2023 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 4SxWw40BF9z547c4; Fri, 22 Dec 2023 15:50:12 +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 4SxWw36WdVz3R3V; Fri, 22 Dec 2023 15:50:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703260211; 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=VtlDcP/MNuWWb0sfDY0zV3vmljpZuk7wWKL3hmIPEiI=; b=WkRRXQ1+m56gJg8smJLk2jTYpaHMULf9Cuz6tJmKhgKqXu/1DBL/rJ+yBnLy7XvaM47gvS dnsLZ6tUyz+YQqsUAlD7cv/Hzqa/4flUImzFz9phSHbT4auNVA7MAj8wGNkXOWoBRlpG4T p54NSZ67b84rMejO+4NJIb5NRdRQox0L+U1CjeVRz5PHQsE0u57Z0tCq2jIDNaHaF4FFYo wxwH7z8oRJrxqAEjeOF61cSTkB3wC4Xge2+G55shDNwODazZBUFd3bCBL7s48f7lZgRm7N pYsTYhKKe1MwzimoP9upKYv3GHeAjlM3hcKv7axtaGHlndND2izoANyY1L9cRw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703260211; a=rsa-sha256; cv=none; b=n+JtKXfRJHR23hmfRFE3LvBSn7OERVKINn49vLSSosP5t2XxwMdkK+ActxLZP065wJDzKb IcYWpSBKiAAomkgaxcyLB0k4YWrWng944LZZHDso65ISCZYheLjh75yUqEV3h6gOx8CAgw cgE8mPnnIiBgcOF1wBIEJ6xGcdbnotAgU6Oqnx7oHrk21uRBYvLZ87mgQ5zGJOsRvIVPZz cWAUT0yRJfdxxt1inYarZ2XGdCSpehRn4gtdta1tkTzCqzQEUnAZunRQIzua4opO3MCzdt LA+ykJCsFmxMd+aQHoExFDNS+2qotV+a/tlqh+N+WpsZlwUZgNJwCRKr5+6Fpg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703260211; 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=VtlDcP/MNuWWb0sfDY0zV3vmljpZuk7wWKL3hmIPEiI=; b=if/83ubH3xVEB8EVsF+48aeNP9VkPrCOPn1VqtmWr4wHY9En2w2rs1hUgW/wTFqwR/kRQJ SiCUcChnxwv0anwh3Qf9HUyGhALRkX1Lt7nHHLn0EFJUJ76bQsFs+9mByYKjQmYg+o0RwD vRxo1DLszO91ixjTUEzOacdmoLD4hAa6D6PORHF2Hqqp9VTky36E5JPRuh8gOnezbbTaxx Aa9YSpEVJEYPltcNxmtVg7CW3OkcQOznb9U++0K9cF4yIuMQ+eMsRyNdfhYNtZeUktgfdg I5jdSBby0mdlTJ9ZM7Gje/4xyJ5So57jpl5+OeVmtIGdUCPpBCzXM/vHUmzzzQ== 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 4SxWw34C1Bz70L; Fri, 22 Dec 2023 15:50:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BMFoBI2099288; Fri, 22 Dec 2023 15:50:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BMFoBKu099281; Fri, 22 Dec 2023 15:50:11 GMT (envelope-from git) Date: Fri, 22 Dec 2023 15:50:11 GMT Message-Id: <202312221550.3BMFoBKu099281@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: ed96fd7fc652 - main - kldxref: Simplify elf_read_raw_data 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ed96fd7fc652d77ae5e34727e54610e87854defc Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=ed96fd7fc652d77ae5e34727e54610e87854defc commit ed96fd7fc652d77ae5e34727e54610e87854defc Author: John Baldwin AuthorDate: 2023-12-22 15:49:03 +0000 Commit: John Baldwin CommitDate: 2023-12-22 15:49:03 +0000 kldxref: Simplify elf_read_raw_data Use pread as a valid offset is always passed now. Originally the DSO code read the .hash section in two separate requests and relied on the implicit offset for the second read, but now the hash table is fetched in a single call. Reviewed by: imp Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D43125 --- usr.sbin/kldxref/elf.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/usr.sbin/kldxref/elf.c b/usr.sbin/kldxref/elf.c index f8a6510ed352..cc9bf9e6cb38 100644 --- a/usr.sbin/kldxref/elf.c +++ b/usr.sbin/kldxref/elf.c @@ -170,11 +170,7 @@ elf_read_raw_data(struct elf_file *efile, off_t offset, void *dst, size_t len) { ssize_t nread; - if (offset != (off_t)-1) { - if (lseek(efile->ef_fd, offset, SEEK_SET) == -1) - return (EIO); - } - nread = read(efile->ef_fd, dst, len); + nread = pread(efile->ef_fd, dst, len, offset); if (nread == -1) return (errno); if (nread != len)