All of lore.kernel.org
 help / color / mirror / Atom feed
From: laniel_francis@privacyrequired.com
To: linux-hardening@vger.kernel.org, netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org,
	Francis Laniel <laniel_francis@privacyrequired.com>
Subject: [RFC][PATCH v3 0/3] Fix inefficiences and rename nla_strlcpy
Date: Tue, 20 Oct 2020 18:47:04 +0200	[thread overview]
Message-ID: <20201020164707.30402-1-laniel_francis@privacyrequired.com> (raw)

From: Francis Laniel <laniel_francis@privacyrequired.com>

Hi.


I hope your relatives and yourselves are fine.

This patch set answers to first three issues listed in:
https://github.com/KSPP/linux/issues/110

To sum up, the first patch fixes an inefficiency where some bytes in dst were
written twice, one with 0 the other with src content.
The second one modifies nla_strlcpy to return the same value as strscpy,
i.e. number of bytes written or -E2BIG if src was truncated.
The third rename nla_strlcpy to nla_strscpy.

The name nla_strscpy should be discussed and agreed to find a representative
name (nla_strscpy_pad, nla_strcpy, nla_strzcpy, etc.).

Unfortunately, I did not find how to create struct nlattr objects so I tested
my modifications on simple char* and withing GDB with tc to get to
tcf_proto_check_kind.
This is why I tagged this patch set as RFC.

If you see any way to improve the code or have any remark, feel free to comment.


Best regards.

Francis Laniel (3):
  Fix unefficient call to memset before memcpu in nla_strlcpy.
  Modify return value of nla_strlcpy to match that of strscpy.
  Rename nla_strlcpy to nla_strscpy.

 drivers/infiniband/core/nldev.c            | 10 +++---
 drivers/net/can/vxcan.c                    |  4 +--
 drivers/net/veth.c                         |  4 +--
 include/linux/genl_magic_struct.h          |  2 +-
 include/net/netlink.h                      |  4 +--
 include/net/pkt_cls.h                      |  2 +-
 kernel/taskstats.c                         |  2 +-
 lib/nlattr.c                               | 42 ++++++++++++++--------
 net/core/fib_rules.c                       |  4 +--
 net/core/rtnetlink.c                       | 12 +++----
 net/decnet/dn_dev.c                        |  2 +-
 net/ieee802154/nl-mac.c                    |  2 +-
 net/ipv4/devinet.c                         |  2 +-
 net/ipv4/fib_semantics.c                   |  2 +-
 net/ipv4/metrics.c                         |  2 +-
 net/netfilter/ipset/ip_set_hash_netiface.c |  4 +--
 net/netfilter/nf_tables_api.c              |  6 ++--
 net/netfilter/nfnetlink_acct.c             |  2 +-
 net/netfilter/nfnetlink_cthelper.c         |  4 +--
 net/netfilter/nft_ct.c                     |  2 +-
 net/netfilter/nft_log.c                    |  2 +-
 net/netlabel/netlabel_mgmt.c               |  2 +-
 net/nfc/netlink.c                          |  2 +-
 net/sched/act_api.c                        |  2 +-
 net/sched/act_ipt.c                        |  2 +-
 net/sched/act_simple.c                     |  4 +--
 net/sched/cls_api.c                        |  2 +-
 net/sched/sch_api.c                        |  2 +-
 net/tipc/netlink_compat.c                  |  2 +-
 29 files changed, 73 insertions(+), 61 deletions(-)

-- 
2.20.1


             reply	other threads:[~2020-10-20 16:57 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-20 16:47 laniel_francis [this message]
2020-10-20 16:47 ` [RFC][PATCH v3 1/3] Fix unefficient call to memset before memcpu in nla_strlcpy laniel_francis
2020-10-21 23:46   ` Kees Cook
2020-10-20 16:47 ` [RFC][PATCH v3 2/3] Modify return value of nla_strlcpy to match that of strscpy laniel_francis
2020-10-21 23:48   ` Kees Cook
2020-10-22  9:40     ` Francis Laniel
2020-10-20 16:47 ` [RFC][PATCH v3 3/3] Rename nla_strlcpy to nla_strscpy laniel_francis
2020-10-21 23:49   ` Kees Cook
2020-10-22  9:41     ` Francis Laniel
2020-10-22 20:04       ` Kees Cook
2020-10-22 23:05         ` Jakub Kicinski
2020-10-23  8:07           ` David Laight
2020-10-23 15:15             ` Francis Laniel
2020-10-23 15:29             ` Jakub Kicinski
2020-10-23 17:41               ` Kees Cook
2020-10-23 15:16           ` Francis Laniel
2020-10-24 10:41         ` Francis Laniel

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=20201020164707.30402-1-laniel_francis@privacyrequired.com \
    --to=laniel_francis@privacyrequired.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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.