[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250821032156.4946-1-chentaotao@didiglobal.com>
Date: Thu, 21 Aug 2025 03:21:59 +0000
From: 陈涛涛 Taotao Chen <chentaotao@...iglobal.com>
To: "andi.shyti@...nel.org" <andi.shyti@...nel.org>, "rodrigo.vivi@...el.com"
<rodrigo.vivi@...el.com>
CC: "airlied@...il.com" <airlied@...il.com>, "brauner@...nel.org"
<brauner@...nel.org>, 陈涛涛 Taotao Chen
<chentaotao@...iglobal.com>, "intel-gfx@...ts.freedesktop.org"
<intel-gfx@...ts.freedesktop.org>, "jani.nikula@...ux.intel.com"
<jani.nikula@...ux.intel.com>, "joonas.lahtinen@...ux.intel.com"
<joonas.lahtinen@...ux.intel.com>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "lkp@...el.com" <lkp@...el.com>,
"oe-lkp@...ts.linux.dev" <oe-lkp@...ts.linux.dev>, "oliver.sang@...el.com"
<oliver.sang@...el.com>, "simona@...ll.ch" <simona@...ll.ch>,
"tursulin@...ulin.net" <tursulin@...ulin.net>
Subject: Re: [PATCH 1/2] drm/i915: set O_LARGEFILE in __create_shmem()
From: Taotao Chen <chentaotao@...iglobal.com>
Hi Andi,
> Hi Taotao,
>
>> Reported-by: kernel test robot <oliver.sang@...el.com>
>> Closes: https://lore.kernel.org/oe-lkp/202508081029.343192ec-lkp@intel.com
>
> ...
>
>> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
>> index e3d188455f67..2b53aad915f5 100644
>> --- a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
>> +++ b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
>> @@ -514,6 +514,11 @@ static int __create_shmem(struct drm_i915_private *i915,
>> if (IS_ERR(filp))
>> return PTR_ERR(filp);
>>
>> + /*
>> + * Prevent -EFBIG by allowing large writes beyond MAX_NON_LFS on shmem
>> + * objects by setting O_LARGEFILE.
>> + */
>> + filp->f_flags |= O_LARGEFILE;
>
> I don't have anything against this, but is it really fixing the
> issue? I thought that O_LARGEFILE is ignored in 64 bit machines,
> while here the failure is happening in 64 bit machines.
As mentioned in the commit body, without O_LARGEFILE, file->f_op->write_iter
calls generic_write_check_limits(), which enforces the 2GB (MAX_NON_LFS) limit
and causes -EFBIG on large writes.
On 64-bit systems O_LARGEFILE is still set when opening files (e.g. via open()),
so we also need to set it here for shmem objects created inside the kernel.
However, on older 32-bit systems, setting O_LARGEFILE unconditionally may be risky.
Previously I did not check this, but to reduce the risk a safer approach is to wrap
it in a check, for example:
+ if (force_o_largefile())
+ filp->f_flags |= O_LARGEFILE;
>
> Besides, where do you see in the LKP logs the -EFBIG error
> message?
>
Due to the previous return order in shmem_pwrite(), this -EFBIG was being overwritten
by -EIO on short writes. This issue will be fixed in PATCH 2/2.
Taotao
> Andi
>
>> obj->filp = filp;
>> return 0;
>> }
>> --
>> 2.34.1
Powered by blists - more mailing lists