All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'David Ahern' <dsahern@gmail.com>,
	Xin Long <lucien.xin@gmail.com>,
	"Jakub Kicinski" <kuba@kernel.org>
Cc: network dev <netdev@vger.kernel.org>, davem <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>
Subject: RE: [PATCH net] udp: fix the len check in udp_lib_getsockopt
Date: Mon, 31 May 2021 10:13:07 +0000	[thread overview]
Message-ID: <dc7d16bce9114bce8292ad07835fc083@AcuMS.aculab.com> (raw)
In-Reply-To: <54cb4e46-28f9-b6db-85ec-f67df1e6bacf@gmail.com>

From: David Ahern
> Sent: 29 May 2021 02:58
> 
> On 5/28/21 7:47 PM, Xin Long wrote:
> > The partial byte(or even 0) of the value returned due to passing a wrong
> > optlen should be considered as an error. "On error, -1 is returned, and
> > errno is set appropriately.". Success returned in that case only confuses
> > the user.
> 
> It is feasible that some app could use bool or u8 for options that have
> 0 or 1 values and that code has so far worked. This change would break that.

Especially since the code is also likely to ignore the return
value since the call isn't excepted to actually fail!

Most (but not all) ABI have 'bool' defined the same as 'u32'.
However there will be code that uses 'char' (especially for
setsockopt) and expects it to work.
(And it probably always has done on LE systems.)

A certain other common OS defines the argument as either BOOL
or DWORD - both of which are 32bit.
But I believe it works fine if 'char' is used.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

      parent reply	other threads:[~2021-05-31 10:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-27 19:12 [PATCH net] udp: fix the len check in udp_lib_getsockopt Xin Long
2021-05-27 19:13 ` Xin Long
2021-05-28 22:39   ` Jakub Kicinski
2021-05-29  1:47     ` Xin Long
2021-05-29  1:57       ` David Ahern
2021-05-29 16:47         ` Xin Long
2021-05-31  1:31           ` David Ahern
2021-05-31  2:02             ` Xin Long
2021-05-31 10:13         ` David Laight [this message]

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=dc7d16bce9114bce8292ad07835fc083@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@gmail.com \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=lucien.xin@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.