public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: t.martitz@avm.de
Cc: stable@vger.kernel.org, Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: proc_lseek backport request
Date: Thu, 17 Aug 2023 16:43:24 +0200	[thread overview]
Message-ID: <2023081752-giddily-anytime-237e@gregkh> (raw)
In-Reply-To: <OF964B0E9A.174E142D-ONC1258A0E.0032FEAA-C1258A0E.00337FA7@avm.de>

On Thu, Aug 17, 2023 at 11:22:30AM +0200, t.martitz@avm.de wrote:
> Dear stable team,
> 
> I'm asking that 
> 
> commit 3f61631d47f1 ("take care to handle NULL ->proc_lseek()")
> 
> gets backported to the stable and LTS kernels down to 5.10.
> 
> Background:
> We are in the process of upgrading our kernels. One target kernel
> is based on 5.15 LTS.
> 
> Here we found that, if proc file drivers do not implement proc_lseek,
> user space crashes easily, because various library routines internally
> perform lseek(2). The crash happens in proc_reg_llseek, where it
> wants to jump to a NULL pointer.
> 
> We could, arguably, fix these drivers to use ".proc_lseek = no_llseek".
> But this doesn't seem like a worthwhile path forward, considering that
> latest Linux kernels (including 6.1 LTS) allow proc_lseek == NULL again 
> and *remove* no_lseek. Essentially, on HEAD, it's best practice to leave 
> proc_lseek == NULL.
> Therefore, I ask that the above procfs fix gets backported so that our
> drivers can work across all kernel versions, including latest 6.x.

For obvious technical, and legal reasons, we can not take kernel changes
only for out-of-tree kernel modules, you know this :)

So sorry, no, we should not backport this change because as-is, all
in-tree code works just fine, right?

Attempting to keep kernel code outside of the kernel tree is, on
purpose, very expensive in time and resources.  The very simple way to
solve this is to get your drivers merged properly into the mainline
kernel tree.

Have you submitted your drivers and had them rejected?

Have you taken advantage of the projects that are willing to take
out-of-tree drivers and get them merged upstream properly for free?

Is there anything else preventing your code from being accepted into the
upstream kernel tree that we can help with?

thanks,

greg k-h



> 
> I checked that this commit applies and works as expected on a board that
> runs Linux 5.15, and the observed crash goes away.
> 
> Furthermore, I investigated that the fix applies to older LTS kernels, down
> to 5.10. The lseek(2) path uses vfs_llseek() which checks for FMODE_LSEEK. This
> has been like that forever since the initial git import. However, 5.4 LTS and 
> older kernels do not have "struct proc_ops".
> 
> Thank you in advance.
> 
> Best regards,
> Thomas Martitz

  reply	other threads:[~2023-08-17 14:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-17  9:22 proc_lseek backport request t.martitz
2023-08-17 14:43 ` Greg KH [this message]
2023-08-17 15:42   ` David Laight
2023-08-17 15:59     ` 'Greg KH'
2023-08-21  6:28   ` t.martitz
2023-08-21 13:17     ` Greg KH

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=2023081752-giddily-anytime-237e@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=stable@vger.kernel.org \
    --cc=t.martitz@avm.de \
    --cc=viro@zeniv.linux.org.uk \
    /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