Re: [PATCH 4/4] xfrm_user: Add new 32/64-agnostic netlink messages

From: kbuild test robot
Date: Sat Jan 21 2017 - 03:24:34 EST


Hi Kevin,

[auto build test ERROR on ipsec-next/master]
[also build test ERROR on v4.10-rc4 next-20170120]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Kevin-Cernekee/Make-xfrm-usable-by-32-bit-programs/20170121-150712
base: https://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next.git master
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 6.2.0
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=ia64

All errors (new ones prefixed by >>):

>> net/xfrm/xfrm_user_legacy.c:845:5: error: redefinition of 'xfrm_exp_state_notify_legacy'
int xfrm_exp_state_notify_legacy(const struct xfrm_state *x,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from net/xfrm/xfrm_user_legacy.c:30:0:
net/xfrm/xfrm_user.h:131:19: note: previous definition of 'xfrm_exp_state_notify_legacy' was here
static inline int xfrm_exp_state_notify_legacy(const struct xfrm_state *x,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> net/xfrm/xfrm_user_legacy.c:863:5: error: redefinition of 'xfrm_notify_sa_legacy'
int xfrm_notify_sa_legacy(const struct xfrm_state *x, const struct km_event *c)
^~~~~~~~~~~~~~~~~~~~~
In file included from net/xfrm/xfrm_user_legacy.c:30:0:
net/xfrm/xfrm_user.h:137:19: note: previous definition of 'xfrm_notify_sa_legacy' was here
static inline int xfrm_notify_sa_legacy(const struct xfrm_state *x,
^~~~~~~~~~~~~~~~~~~~~
>> net/xfrm/xfrm_user_legacy.c:983:5: error: redefinition of 'xfrm_send_acquire_legacy'
int xfrm_send_acquire_legacy(struct xfrm_state *x,
^~~~~~~~~~~~~~~~~~~~~~~~
In file included from net/xfrm/xfrm_user_legacy.c:30:0:
net/xfrm/xfrm_user.h:143:19: note: previous definition of 'xfrm_send_acquire_legacy' was here
static inline int xfrm_send_acquire_legacy(struct xfrm_state *x,
^~~~~~~~~~~~~~~~~~~~~~~~
>> net/xfrm/xfrm_user_legacy.c:1043:5: error: redefinition of 'xfrm_exp_policy_notify_legacy'
int xfrm_exp_policy_notify_legacy(const struct xfrm_policy *xp,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from net/xfrm/xfrm_user_legacy.c:30:0:
net/xfrm/xfrm_user.h:150:19: note: previous definition of 'xfrm_exp_policy_notify_legacy' was here
static inline int xfrm_exp_policy_notify_legacy(const struct xfrm_policy *xp,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> net/xfrm/xfrm_user_legacy.c:1060:5: error: redefinition of 'xfrm_notify_policy_legacy'
int xfrm_notify_policy_legacy(const struct xfrm_policy *xp,
^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from net/xfrm/xfrm_user_legacy.c:30:0:
net/xfrm/xfrm_user.h:157:19: note: previous definition of 'xfrm_notify_policy_legacy' was here
static inline int xfrm_notify_policy_legacy(const struct xfrm_policy *xp,
^~~~~~~~~~~~~~~~~~~~~~~~~

vim +/xfrm_exp_state_notify_legacy +845 net/xfrm/xfrm_user_legacy.c

839 return err;
840
841 nlmsg_end(skb, nlh);
842 return 0;
843 }
844
> 845 int xfrm_exp_state_notify_legacy(const struct xfrm_state *x,
846 const struct km_event *c)
847 {
848 struct net *net = xs_net(x);
849 struct sk_buff *skb;
850
851 skb = nlmsg_new(xfrm_expire_msgsize(), GFP_ATOMIC);
852 if (skb == NULL)
853 return -ENOMEM;
854
855 if (build_expire(skb, x, c) < 0) {
856 kfree_skb(skb);
857 return -EMSGSIZE;
858 }
859
860 return xfrm_nlmsg_multicast(net, skb, 0, XFRMNLGRP_EXPIRE);
861 }
862
> 863 int xfrm_notify_sa_legacy(const struct xfrm_state *x, const struct km_event *c)
864 {
865 struct net *net = xs_net(x);
866 struct xfrm_usersa_info_legacy *p;
867 struct xfrm_usersa_id *id;
868 struct nlmsghdr *nlh;
869 struct sk_buff *skb;
870 int len = xfrm_sa_len(x);
871 int headlen, err;
872 u32 event = 0;
873
874 headlen = sizeof(*p);
875 if (c->event == XFRM_MSG_DELSA) {
876 len += nla_total_size(headlen);
877 headlen = sizeof(*id);
878 len += nla_total_size(sizeof(struct xfrm_mark));
879 }
880 len += NLMSG_ALIGN(headlen);
881
882 skb = nlmsg_new(len, GFP_ATOMIC);
883 if (skb == NULL)
884 return -ENOMEM;
885
886 switch (c->event) {
887 case XFRM_MSG_NEWSA:
888 event = XFRM_MSG_NEWSA_LEGACY;
889 break;
890 case XFRM_MSG_UPDSA:
891 event = XFRM_MSG_UPDSA_LEGACY;
892 break;
893 case XFRM_MSG_DELSA:
894 event = XFRM_MSG_DELSA_LEGACY;
895 break;
896 }
897
898 nlh = nlmsg_put(skb, c->portid, c->seq, event, headlen, 0);
899 err = -EMSGSIZE;
900 if (nlh == NULL)
901 goto out_free_skb;
902
903 p = nlmsg_data(nlh);
904 if (c->event == XFRM_MSG_DELSA) {
905 struct nlattr *attr;
906
907 id = nlmsg_data(nlh);
908 memcpy(&id->daddr, &x->id.daddr, sizeof(id->daddr));
909 id->spi = x->id.spi;
910 id->family = x->props.family;
911 id->proto = x->id.proto;
912
913 attr = nla_reserve(skb, XFRMA_SA, sizeof(*p));
914 err = -EMSGSIZE;
915 if (attr == NULL)
916 goto out_free_skb;
917
918 p = nla_data(attr);
919 }
920 err = copy_to_user_state_extra(x, p, skb);
921 if (err)
922 goto out_free_skb;
923
924 nlmsg_end(skb, nlh);
925
926 return xfrm_nlmsg_multicast(net, skb, 0, XFRMNLGRP_SA);
927
928 out_free_skb:
929 kfree_skb(skb);
930 return err;
931 }
932
933 static inline size_t xfrm_acquire_msgsize(const struct xfrm_state *x,
934 const struct xfrm_policy *xp)
935 {
936 return NLMSG_ALIGN(sizeof(struct xfrm_user_acquire_legacy))
937 + nla_total_size(sizeof(struct xfrm_user_tmpl) * xp->xfrm_nr)
938 + nla_total_size(sizeof(struct xfrm_mark))
939 + nla_total_size(xfrm_user_sec_ctx_size(x->security))
940 + userpolicy_type_attrsize();
941 }
942
943 static int build_acquire(struct sk_buff *skb,
944 struct xfrm_state *x,
945 const struct xfrm_tmpl *xt,
946 const struct xfrm_policy *xp)
947 {
948 __u32 seq = xfrm_get_acqseq();
949 struct xfrm_user_acquire_legacy *ua;
950 struct nlmsghdr *nlh;
951 int err;
952
953 nlh = nlmsg_put(skb, 0, 0, XFRM_MSG_ACQUIRE_LEGACY, sizeof(*ua), 0);
954 if (nlh == NULL)
955 return -EMSGSIZE;
956
957 ua = nlmsg_data(nlh);
958 memcpy(&ua->id, &x->id, sizeof(ua->id));
959 memcpy(&ua->saddr, &x->props.saddr, sizeof(ua->saddr));
960 memcpy(&ua->sel, &x->sel, sizeof(ua->sel));
961 copy_to_user_policy(xp, &ua->policy, XFRM_POLICY_OUT);
962 ua->aalgos = xt->aalgos;
963 ua->ealgos = xt->ealgos;
964 ua->calgos = xt->calgos;
965 ua->seq = x->km.seq = seq;
966
967 err = xfrm_copy_to_user_tmpl(xp, skb);
968 if (!err)
969 err = copy_to_user_state_sec_ctx(x, skb);
970 if (!err)
971 err = copy_to_user_policy_type(xp->type, skb);
972 if (!err)
973 err = xfrm_mark_put(skb, &xp->mark);
974 if (err) {
975 nlmsg_cancel(skb, nlh);
976 return err;
977 }
978
979 nlmsg_end(skb, nlh);
980 return 0;
981 }
982
> 983 int xfrm_send_acquire_legacy(struct xfrm_state *x,
984 const struct xfrm_tmpl *xt,
985 const struct xfrm_policy *xp)
986 {
987 struct net *net = xs_net(x);
988 struct sk_buff *skb;
989
990 skb = nlmsg_new(xfrm_acquire_msgsize(x, xp), GFP_ATOMIC);
991 if (skb == NULL)
992 return -ENOMEM;
993
994 if (build_acquire(skb, x, xt, xp) < 0)
995 BUG();
996
997 return xfrm_nlmsg_multicast(net, skb, 0, XFRMNLGRP_ACQUIRE);
998 }
999
1000 static inline size_t xfrm_polexpire_msgsize(const struct xfrm_policy *xp)
1001 {
1002 return NLMSG_ALIGN(sizeof(struct xfrm_user_polexpire_legacy))
1003 + nla_total_size(sizeof(struct xfrm_user_tmpl) * xp->xfrm_nr)
1004 + nla_total_size(xfrm_user_sec_ctx_size(xp->security))
1005 + nla_total_size(sizeof(struct xfrm_mark))
1006 + userpolicy_type_attrsize();
1007 }
1008
1009 static int build_polexpire(struct sk_buff *skb,
1010 const struct xfrm_policy *xp,
1011 int dir,
1012 const struct km_event *c)
1013 {
1014 struct xfrm_user_polexpire_legacy *upe;
1015 int hard = c->data.hard;
1016 struct nlmsghdr *nlh;
1017 int err;
1018
1019 nlh = nlmsg_put(skb, c->portid, 0, XFRM_MSG_POLEXPIRE_LEGACY,
1020 sizeof(*upe), 0);
1021 if (nlh == NULL)
1022 return -EMSGSIZE;
1023
1024 upe = nlmsg_data(nlh);
1025 copy_to_user_policy(xp, &upe->pol, dir);
1026 err = xfrm_copy_to_user_tmpl(xp, skb);
1027 if (!err)
1028 err = copy_to_user_sec_ctx(xp, skb);
1029 if (!err)
1030 err = copy_to_user_policy_type(xp->type, skb);
1031 if (!err)
1032 err = xfrm_mark_put(skb, &xp->mark);
1033 if (err) {
1034 nlmsg_cancel(skb, nlh);
1035 return err;
1036 }
1037 upe->hard = !!hard;
1038
1039 nlmsg_end(skb, nlh);
1040 return 0;
1041 }
1042
> 1043 int xfrm_exp_policy_notify_legacy(const struct xfrm_policy *xp,
1044 int dir,
1045 const struct km_event *c)
1046 {

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip