From: Andi Shyti <andi.shyti@linux.intel.com>
To: intel-gfx <intel-gfx@lists.freedesktop.org>,
dri-devel <dri-devel@lists.freedesktop.org>
Cc: Nirmoy Das <nirmoy.das@intel.com>,
Chris Wilson <chris.p.wilson@linux.intel.com>,
Matthew Auld <matthew.auld@intel.com>,
Andi Shyti <andi.shyti@linux.intel.com>
Subject: [PATCH] drm/i915/gem: Return SIGBUS for wrong mapping parameters
Date: Mon, 17 Jun 2024 14:41:15 +0200 [thread overview]
Message-ID: <20240617124115.260250-1-andi.shyti@linux.intel.com> (raw)
We normally issue a warning when incorrect memory parameters are
provided. Typically, providing erroneous addresses to mmap,
results in a segmentation fault, and the default behavior
is to return VM_FAULT_SIGBUS.
This can happen for example when remap_io_mapping() or
remap_io_sg() return -EINVAL.
Because VM_FAULT_SIGBUS is already returned when memory
boundaries are improperly handled and numerous warnings are
already generated, avoid redundant logging to prevent
overprinting by translating -EINVAL to VM_FAULT_SIGBUS in the
i915_error_to_vmf_fault() helper.
Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
---
drivers/gpu/drm/i915/gem/i915_gem_mman.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_mman.c b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
index a2195e28b625..698ff42b004a 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_mman.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
@@ -223,6 +223,7 @@ static vm_fault_t i915_error_to_vmf_fault(int err)
default:
WARN_ONCE(err, "unhandled error in %s: %i\n", __func__, err);
fallthrough;
+ case -EINVAL: /* the memory parameters provided are wrong */
case -EIO: /* shmemfs failure from swap device */
case -EFAULT: /* purged object */
case -ENODEV: /* bad object, how did you get here! */
--
2.45.1
next reply other threads:[~2024-06-17 12:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-17 12:41 Andi Shyti [this message]
2024-06-17 13:29 ` ✗ Fi.CI.BAT: failure for drm/i915/gem: Return SIGBUS for wrong mapping parameters Patchwork
2024-06-17 21:04 ` ✓ Fi.CI.BAT: success for drm/i915/gem: Return SIGBUS for wrong mapping parameters (rev2) Patchwork
2024-06-18 9:35 ` ✓ Fi.CI.IGT: " Patchwork
2024-06-20 15:14 ` [PATCH] drm/i915/gem: Return SIGBUS for wrong mapping parameters Andi Shyti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240617124115.260250-1-andi.shyti@linux.intel.com \
--to=andi.shyti@linux.intel.com \
--cc=chris.p.wilson@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=matthew.auld@intel.com \
--cc=nirmoy.das@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox