public inbox for linux-hardening@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH v1] Fix and rename nla_strlcpy to nla_strcpy
@ 2020-10-16 12:52 laniel_francis
  2020-10-16 12:52 ` [PATCH v1 1/3] Fix unefficient call to memset before memcpu in nla_strlcpy laniel_francis
                   ` (3 more replies)
  0 siblings, 4 replies; 31+ messages in thread
From: laniel_francis @ 2020-10-16 12:52 UTC (permalink / raw)
  To: linux-hardening


First, I do hope you are all fine and the same for your relatives.

This 3 patches set answers to three first steps of this issue:
https://github.com/KSPP/linux/issues/110
Basically, I fix an inefficiency in nla_strlcpy where memset was called before
memcpy.
Then I modified the returned value to follow strscpy behavior and update where
this function is called and returned value is checked.
Finally, I rename nla_strlcpy to nla_strcpy and propagate the modifications in
all files where nla_strlcpy was called.

Unfortunately, I did not understand how to instanciate struct nlattr objects so
I tested the modified function by calling it directly on char *, this is why I
marked this patch as RFC.

If you have any remarks, feel free to share them so I can improve the code.

Here are the stats:
 drivers/infiniband/core/nldev.c            | 10 +++++-----
 drivers/misc/lkdtm/Makefile                |  1 +
 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                      |  3 ++-
 kernel/taskstats.c                         |  2 +-
 lib/nlattr.c                               | 35 ++++++++++++++++++++++-------------
 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 +-
 30 files changed, 70 insertions(+), 59 deletions(-)

Best regards.



^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2020-10-20 17:23 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-16 12:52 [RFC][PATCH v1] Fix and rename nla_strlcpy to nla_strcpy laniel_francis
2020-10-16 12:52 ` [PATCH v1 1/3] Fix unefficient call to memset before memcpu in nla_strlcpy laniel_francis
2020-10-16 23:19   ` Kees Cook
2020-10-17  8:50     ` Francis Laniel
2020-10-16 23:29   ` Jann Horn
2020-10-17  8:50     ` Francis Laniel
2020-10-16 12:52 ` [PATCH v1 2/3] Modify return value of nla_strlcpy to match that of strscpy laniel_francis
2020-10-16 23:23   ` Kees Cook
2020-10-17  8:53     ` Francis Laniel
2020-10-17  0:41   ` Jann Horn
2020-10-17  8:56     ` Francis Laniel
2020-10-16 12:52 ` [PATCH v1 3/3] Rename nla_strlcpy to nla_strcpy laniel_francis
2020-10-16 23:18   ` Kees Cook
2020-10-19 15:23 ` [RFC][PATCH v2 0/3] Fix inefficiences and rename nla_strlcpy laniel_francis
2020-10-19 15:23   ` [RFC][PATCH v2 1/3] Fix unefficient call to memset before memcpu in nla_strlcpy laniel_francis
2020-10-19 15:23   ` [RFC][PATCH v2 2/3] Modify return value of nla_strlcpy to match that of strscpy laniel_francis
2020-10-19 16:43     ` Jakub Kicinski
2020-10-19 23:01       ` Kees Cook
2020-10-19 23:34         ` Jakub Kicinski
2020-10-20 10:28           ` Francis Laniel
2020-10-20 17:23             ` Kees Cook
2020-10-20 17:19           ` Kees Cook
2020-10-20 13:05         ` Francis Laniel
2020-10-20 10:17       ` Francis Laniel
2020-10-19 15:23   ` [RFC][PATCH v2 3/3] Rename nla_strlcpy to nla_strcpy laniel_francis
2020-10-19 16:45   ` [RFC][PATCH v2 0/3] Fix inefficiences and rename nla_strlcpy Jakub Kicinski
2020-10-19 22:58     ` Kees Cook
2020-10-19 23:34       ` Jakub Kicinski
2020-10-20 10:18         ` Francis Laniel
2020-10-19 23:03   ` Kees Cook
2020-10-20 13:06     ` Francis Laniel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox