03 May, 2017

2 commits

  • Pull networking updates from David Millar:
    "Here are some highlights from the 2065 networking commits that
    happened this development cycle:

    1) XDP support for IXGBE (John Fastabend) and thunderx (Sunil Kowuri)

    2) Add a generic XDP driver, so that anyone can test XDP even if they
    lack a networking device whose driver has explicit XDP support
    (me).

    3) Sparc64 now has an eBPF JIT too (me)

    4) Add a BPF program testing framework via BPF_PROG_TEST_RUN (Alexei
    Starovoitov)

    5) Make netfitler network namespace teardown less expensive (Florian
    Westphal)

    6) Add symmetric hashing support to nft_hash (Laura Garcia Liebana)

    7) Implement NAPI and GRO in netvsc driver (Stephen Hemminger)

    8) Support TC flower offload statistics in mlxsw (Arkadi Sharshevsky)

    9) Multiqueue support in stmmac driver (Joao Pinto)

    10) Remove TCP timewait recycling, it never really could possibly work
    well in the real world and timestamp randomization really zaps any
    hint of usability this feature had (Soheil Hassas Yeganeh)

    11) Support level3 vs level4 ECMP route hashing in ipv4 (Nikolay
    Aleksandrov)

    12) Add socket busy poll support to epoll (Sridhar Samudrala)

    13) Netlink extended ACK support (Johannes Berg, Pablo Neira Ayuso,
    and several others)

    14) IPSEC hw offload infrastructure (Steffen Klassert)"

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (2065 commits)
    tipc: refactor function tipc_sk_recv_stream()
    tipc: refactor function tipc_sk_recvmsg()
    net: thunderx: Optimize page recycling for XDP
    net: thunderx: Support for XDP header adjustment
    net: thunderx: Add support for XDP_TX
    net: thunderx: Add support for XDP_DROP
    net: thunderx: Add basic XDP support
    net: thunderx: Cleanup receive buffer allocation
    net: thunderx: Optimize CQE_TX handling
    net: thunderx: Optimize RBDR descriptor handling
    net: thunderx: Support for page recycling
    ipx: call ipxitf_put() in ioctl error path
    net: sched: add helpers to handle extended actions
    qed*: Fix issues in the ptp filter config implementation.
    qede: Fix concurrency issue in PTP Tx path processing.
    stmmac: Add support for SIMATIC IOT2000 platform
    net: hns: fix ethtool_get_strings overflow in hns driver
    tcp: fix wraparound issue in tcp_lp
    bpf, arm64: fix jit branch offset related to ldimm64
    bpf, arm64: implement jiting of BPF_XADD
    ...

    Linus Torvalds
     
  • Pull crypto updates from Herbert Xu:
    "Here is the crypto update for 4.12:

    API:
    - Add batch registration for acomp/scomp
    - Change acomp testing to non-unique compressed result
    - Extend algorithm name limit to 128 bytes
    - Require setkey before accept(2) in algif_aead

    Algorithms:
    - Add support for deflate rfc1950 (zlib)

    Drivers:
    - Add accelerated crct10dif for powerpc
    - Add crc32 in stm32
    - Add sha384/sha512 in ccp
    - Add 3des/gcm(aes) for v5 devices in ccp
    - Add Queue Interface (QI) backend support in caam
    - Add new Exynos RNG driver
    - Add ThunderX ZIP driver
    - Add driver for hardware random generator on MT7623 SoC"

    * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (101 commits)
    crypto: stm32 - Fix OF module alias information
    crypto: algif_aead - Require setkey before accept(2)
    crypto: scomp - add support for deflate rfc1950 (zlib)
    crypto: scomp - allow registration of multiple scomps
    crypto: ccp - Change ISR handler method for a v5 CCP
    crypto: ccp - Change ISR handler method for a v3 CCP
    crypto: crypto4xx - rename ce_ring_contol to ce_ring_control
    crypto: testmgr - Allow ecb(cipher_null) in FIPS mode
    Revert "crypto: arm64/sha - Add constant operand modifier to ASM_EXPORT"
    crypto: ccp - Disable interrupts early on unload
    crypto: ccp - Use only the relevant interrupt bits
    hwrng: mtk - Add driver for hardware random generator on MT7623 SoC
    dt-bindings: hwrng: Add Mediatek hardware random generator bindings
    crypto: crct10dif-vpmsum - Fix missing preempt_disable()
    crypto: testmgr - replace compression known answer test
    crypto: acomp - allow registration of multiple acomps
    hwrng: n2 - Use devm_kcalloc() in n2rng_probe()
    crypto: chcr - Fix error handling related to 'chcr_alloc_shash'
    padata: get_next is never NULL
    crypto: exynos - Add new Exynos RNG driver
    ...

    Linus Torvalds
     

02 May, 2017

1 commit

  • Current code silently ignores driver errors when configuring
    IPSec offload xfrm_state, and falls back to host-based crypto.

    Fail the xfrm_state creation if the driver has an error, because
    the NIC offloading was explicitly requested by the user program.

    This will communicate back to the user that there was an error.

    Fixes: d77e38e612a0 ("xfrm: Add an IPsec hardware offloading API")
    Signed-off-by: Ilan Tayari
    Signed-off-by: David S. Miller

    Ilan Tayari
     

22 Apr, 2017

1 commit

  • Steffen Klassert says:

    ====================
    pull request (net-next): ipsec-next 2017-04-20

    This adds the basic infrastructure for IPsec hardware
    offloading, it creates a configuration API and adjusts
    the packet path.

    1) Add the needed netdev features to configure IPsec offloads.

    2) Add the IPsec hardware offloading API.

    3) Prepare the ESP packet path for hardware offloading.

    4) Add gso handlers for esp4 and esp6, this implements
    the software fallback for GSO packets.

    5) Add xfrm replay handler functions for offloading.

    6) Change ESP to use a synchronous crypto algorithm on
    offloading, we don't have the option for asynchronous
    returns when we handle IPsec at layer2.

    7) Add a xfrm validate function to validate_xmit_skb. This
    implements the software fallback for non GSO packets.

    8) Set the inner_network and inner_transport members of
    the SKB, as well as encapsulation, to reflect the actual
    positions of these headers, and removes them only once
    encryption is done on the payload.
    From Ilan Tayari.

    9) Prepare the ESP GRO codepath for hardware offloading.

    10) Fix incorrect null pointer check in esp6.
    From Colin Ian King.

    11) Fix for the GSO software fallback path to detect the
    fallback correctly.
    From Ilan Tayari.

    Please pull or let me know if there are problems.
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     

14 Apr, 2017

4 commits

  • This patch adds all the bits that are needed to do
    IPsec hardware offload for IPsec states and ESP packets.
    We add xfrmdev_ops to the net_device. xfrmdev_ops has
    function pointers that are needed to manage the xfrm
    states in the hardware and to do a per packet
    offloading decision.

    Joint work with:
    Ilan Tayari
    Guy Shapiro
    Yossi Kuperman

    Signed-off-by: Guy Shapiro
    Signed-off-by: Ilan Tayari
    Signed-off-by: Yossi Kuperman
    Signed-off-by: Steffen Klassert

    Steffen Klassert
     
  • This is an add-on to the previous patch that passes the extended ACK
    structure where it's already available by existing genl_info or extack
    function arguments.

    This was done with this spatch (with some manual adjustment of
    indentation):

    @@
    expression A, B, C, D, E;
    identifier fn, info;
    @@
    fn(..., struct genl_info *info, ...) {
    ...
    -nlmsg_parse(A, B, C, D, E, NULL)
    +nlmsg_parse(A, B, C, D, E, info->extack)
    ...
    }

    @@
    expression A, B, C, D, E;
    identifier fn, info;
    @@
    fn(..., struct genl_info *info, ...) {
    extack)
    ...>
    }

    @@
    expression A, B, C, D, E;
    identifier fn, extack;
    @@
    fn(..., struct netlink_ext_ack *extack, ...) {

    }

    @@
    expression A, B, C, D, E;
    identifier fn, extack;
    @@
    fn(..., struct netlink_ext_ack *extack, ...) {

    }

    @@
    expression A, B, C, D, E;
    identifier fn, extack;
    @@
    fn(..., struct netlink_ext_ack *extack, ...) {
    ...
    -nlmsg_parse(A, B, C, D, E, NULL)
    +nlmsg_parse(A, B, C, D, E, extack)
    ...
    }

    @@
    expression A, B, C, D;
    identifier fn, extack;
    @@
    fn(..., struct netlink_ext_ack *extack, ...) {

    }

    @@
    expression A, B, C, D;
    identifier fn, extack;
    @@
    fn(..., struct netlink_ext_ack *extack, ...) {

    }

    @@
    expression A, B, C, D;
    identifier fn, extack;
    @@
    fn(..., struct netlink_ext_ack *extack, ...) {

    }

    @@
    expression A, B, C;
    identifier fn, extack;
    @@
    fn(..., struct netlink_ext_ack *extack, ...) {

    }

    Signed-off-by: Johannes Berg
    Reviewed-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Johannes Berg
     
  • Pass the new extended ACK reporting struct to all of the generic
    netlink parsing functions. For now, pass NULL in almost all callers
    (except for some in the core.)

    Signed-off-by: Johannes Berg
    Signed-off-by: David S. Miller

    Johannes Berg
     
  • Add the base infrastructure and UAPI for netlink extended ACK
    reporting. All "manual" calls to netlink_ack() pass NULL for now and
    thus don't get extended ACK reporting.

    Big thanks goes to Pablo Neira Ayuso for not only bringing up the
    whole topic at netconf (again) but also coming up with the nlattr
    passing trick and various other ideas.

    Signed-off-by: Johannes Berg
    Reviewed-by: David Ahern
    Signed-off-by: David S. Miller

    Johannes Berg
     

11 Apr, 2017

1 commit


10 Apr, 2017

1 commit

  • This patch fixes the xfrm_user code to use the actual array size
    rather than the hard-coded CRYPTO_MAX_ALG_NAME length. This is
    because the array size is fixed at 64 bytes while we want to increase
    the in-kernel CRYPTO_MAX_ALG_NAME value.

    Signed-off-by: Herbert Xu
    Acked-by: Alexander Sverdlin
    Tested-by: Alexander Sverdlin
    Acked-by: Steffen Klassert

    Herbert Xu
     

29 Mar, 2017

2 commits

  • Kees Cook has pointed out that xfrm_replay_state_esn_len() is subject to
    wrapping issues. To ensure we are correctly ensuring that the two ESN
    structures are the same size compare both the overall size as reported
    by xfrm_replay_state_esn_len() and the internal length are the same.

    CVE-2017-7184
    Signed-off-by: Andy Whitcroft
    Acked-by: Steffen Klassert
    Signed-off-by: Linus Torvalds

    Andy Whitcroft
     
  • When a new xfrm state is created during an XFRM_MSG_NEWSA call we
    validate the user supplied replay_esn to ensure that the size is valid
    and to ensure that the replay_window size is within the allocated
    buffer. However later it is possible to update this replay_esn via a
    XFRM_MSG_NEWAE call. There we again validate the size of the supplied
    buffer matches the existing state and if so inject the contents. We do
    not at this point check that the replay_window is within the allocated
    memory. This leads to out-of-bounds reads and writes triggered by
    netlink packets. This leads to memory corruption and the potential for
    priviledge escalation.

    We already attempt to validate the incoming replay information in
    xfrm_new_ae() via xfrm_replay_verify_len(). This confirms that the user
    is not trying to change the size of the replay state buffer which
    includes the replay_esn. It however does not check the replay_window
    remains within that buffer. Add validation of the contained
    replay_window.

    CVE-2017-7184
    Signed-off-by: Andy Whitcroft
    Acked-by: Steffen Klassert
    Signed-off-by: Linus Torvalds

    Andy Whitcroft
     

24 Mar, 2017

1 commit


25 Dec, 2016

1 commit


30 Nov, 2016

1 commit

  • It doesn't support to run 32bit 'ip' to set xfrm objdect on 64bit host.
    But the return value is unknown for user program:

    ip xfrm policy list
    RTNETLINK answers: Unknown error 524

    Replace ENOTSUPP with EOPNOTSUPP:

    ip xfrm policy list
    RTNETLINK answers: Operation not supported

    Signed-off-by: Yi Zhao
    Signed-off-by: Steffen Klassert

    Yi Zhao
     

09 Sep, 2016

1 commit

  • When we fail to attach the security context in xfrm_state_construct()
    we'll return 0 as error value which, in turn, will wrongly claim success
    to userland when, in fact, we won't be adding / updating the XFRM state.

    This is a regression introduced by commit fd21150a0fe1 ("[XFRM] netlink:
    Inline attach_encap_tmpl(), attach_sec_ctx(), and attach_one_addr()").

    Fix it by propagating the error returned by security_xfrm_state_alloc()
    in this case.

    Fixes: fd21150a0fe1 ("[XFRM] netlink: Inline attach_encap_tmpl()...")
    Signed-off-by: Mathias Krause
    Cc: Thomas Graf
    Signed-off-by: Steffen Klassert

    Mathias Krause
     

27 Jul, 2016

2 commits

  • During fuzzing I regularly run into this WARN(). According to Herbert Xu,
    this "certainly shouldn't be a WARN, it probably shouldn't print anything
    either".

    Cc: Stephen Hemminger
    Cc: Steffen Klassert
    Cc: Herbert Xu
    Signed-off-by: Vegard Nossum
    Signed-off-by: Steffen Klassert

    Vegard Nossum
     
  • AFAICT this message is just printed whenever input validation fails.
    This is a normal failure and we shouldn't be dumping the stack over it.

    Looks like it was originally a printk that was maybe incorrectly
    upgraded to a WARN:

    commit 62db5cfd70b1ef53aa21f144a806fe3b78c84fab
    Author: stephen hemminger
    Date: Wed May 12 06:37:06 2010 +0000

    xfrm: add severity to printk

    Cc: Stephen Hemminger
    Cc: Steffen Klassert
    Signed-off-by: Vegard Nossum
    Signed-off-by: Steffen Klassert

    Vegard Nossum
     

18 Jul, 2016

1 commit

  • If we hit any of the error conditions inside xfrm_dump_sa(), then
    xfrm_state_walk_init() never gets called. However, we still call
    xfrm_state_walk_done() from xfrm_dump_sa_done(), which will crash
    because the state walk was never initialized properly.

    We can fix this by setting cb->args[0] only after we've processed the
    first element and checking this before calling xfrm_state_walk_done().

    Fixes: d3623099d3 ("ipsec: add support of limited SA dump")
    Cc: Nicolas Dichtel
    Cc: Steffen Klassert
    Signed-off-by: Vegard Nossum
    Acked-by: Nicolas Dichtel
    Signed-off-by: Steffen Klassert

    Vegard Nossum
     

24 Apr, 2016

1 commit


23 Mar, 2016

1 commit


30 Oct, 2015

1 commit

  • Steffen Klassert says:

    ====================
    pull request (net-next): ipsec-next 2015-10-30

    1) The flow cache is limited by the flow cache limit which
    depends on the number of cpus and the xfrm garbage collector
    threshold which is independent of the number of cpus. This
    leads to the fact that on systems with more than 16 cpus
    we hit the xfrm garbage collector limit and refuse new
    allocations, so new flows are dropped. On systems with 16
    or less cpus, we hit the flowcache limit. In this case, we
    shrink the flow cache instead of refusing new flows.

    We increase the xfrm garbage collector threshold to INT_MAX
    to get the same behaviour, independent of the number of cpus.

    2) Fix some unaligned accesses on sparc systems.
    From Sowmini Varadhan.

    3) Fix some header checks in _decode_session4. We may call
    pskb_may_pull with a negative value converted to unsigened
    int from pskb_may_pull. This can lead to incorrect policy
    lookups. We fix this by a check of the data pointer position
    before we call pskb_may_pull.

    4) Reload skb header pointers after calling pskb_may_pull
    in _decode_session4 as this may change the pointers into
    the packet.

    5) Add a missing statistic counter on inner mode errors.

    Please pull or let me know if there are problems.
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     

23 Oct, 2015

1 commit

  • On sparc, deleting established SAs (e.g., by restarting ipsec)
    results in unaligned access messages via xfrm_del_sa ->
    km_state_notify -> xfrm_send_state_notify().

    Even though struct xfrm_usersa_info is aligned on 8-byte boundaries,
    netlink attributes are fundamentally only 4 byte aligned, and this
    cannot be changed for nla_data() that is passed up to userspace.
    As a result, the put_unaligned() macro needs to be used to
    set up potentially unaligned fields such as the xfrm_stats in
    copy_to_user_state()

    Signed-off-by: Sowmini Varadhan
    Signed-off-by: Steffen Klassert

    Sowmini Varadhan
     

29 Sep, 2015

1 commit

  • Allow to change the replay threshold (XFRMA_REPLAY_THRESH) and expiry
    timer (XFRMA_ETIMER_THRESH) of a state without having to set other
    attributes like replay counter and byte lifetime. Changing these other
    values while traffic flows will break the state.

    Signed-off-by: Michael Rossberg
    Signed-off-by: Steffen Klassert

    Michael Rossberg
     

11 Aug, 2015

1 commit


21 Jul, 2015

1 commit


28 May, 2015

1 commit


03 Mar, 2015

1 commit

  • structure like xfrm_usersa_info or xfrm_userpolicy_info
    has different sizeof when compiled as 32bits and 64bits
    due to not appending pack attribute in their definition.
    This will result in broken SA and SP information when user
    trying to configure them through netlink interface.

    Inform user land about this situation instead of keeping
    silent, the upper test scripts would behave accordingly.

    Signed-off-by: Fan Du
    Signed-off-by: Steffen Klassert

    Fan Du
     

18 Jan, 2015

1 commit

  • Contrary to common expectations for an "int" return, these functions
    return only a positive value -- if used correctly they cannot even
    return 0 because the message header will necessarily be in the skb.

    This makes the very common pattern of

    if (genlmsg_end(...) < 0) { ... }

    be a whole bunch of dead code. Many places also simply do

    return nlmsg_end(...);

    and the caller is expected to deal with it.

    This also commonly (at least for me) causes errors, because it is very
    common to write

    if (my_function(...))
    /* error condition */

    and if my_function() does "return nlmsg_end()" this is of course wrong.

    Additionally, there's not a single place in the kernel that actually
    needs the message length returned, and if anyone needs it later then
    it'll be very easy to just use skb->len there.

    Remove this, and make the functions void. This removes a bunch of dead
    code as described above. The patch adds lines because I did

    - return nlmsg_end(...);
    + nlmsg_end(...);
    + return 0;

    I could have preserved all the function's return values by returning
    skb->len, but instead I've audited all the places calling the affected
    functions and found that none cared. A few places actually compared
    the return value with < 0 with no change in behaviour, so I opted for the more
    efficient version.

    One instance of the error I've made numerous times now is also present
    in net/phonet/pn_netlink.c in the route_dumpit() function - it didn't
    check for
    Signed-off-by: David S. Miller

    Johannes Berg
     

03 Nov, 2014

1 commit

  • After this commit, the attribute XFRMA_REPLAY_VAL is added when no ESN replay
    value is defined. Thus sequence number values are always notified to userspace.

    Signed-off-by: dingzhi
    Signed-off-by: Adrien Mazarguil
    Signed-off-by: Nicolas Dichtel
    Signed-off-by: Steffen Klassert

    dingzhi
     

18 Sep, 2014

1 commit

  • While tracking down the MAX_AH_AUTH_LEN crash in an old kernel
    I thought that this limit was rather arbitrary and we should
    just get rid of it.

    In fact it seems that we've already done all the work needed
    to remove it apart from actually removing it. This limit was
    there in order to limit stack usage. Since we've already
    switched over to allocating scratch space using kmalloc, there
    is no longer any need to limit the authentication length.

    This patch kills all references to it, including the BUG_ONs
    that led me here.

    Signed-off-by: Herbert Xu
    Signed-off-by: Steffen Klassert

    Herbert Xu
     

02 Sep, 2014

1 commit

  • Enable to specify local and remote prefix length thresholds for the
    policy hash table via a netlink XFRM_MSG_NEWSPDINFO message.

    prefix length thresholds are specified by XFRMA_SPD_IPV4_HTHRESH and
    XFRMA_SPD_IPV6_HTHRESH optional attributes (struct xfrmu_spdhthresh).

    example:

    struct xfrmu_spdhthresh thresh4 = {
    .lbits = 0;
    .rbits = 24;
    };
    struct xfrmu_spdhthresh thresh6 = {
    .lbits = 0;
    .rbits = 56;
    };
    struct nlmsghdr *hdr;
    struct nl_msg *msg;

    msg = nlmsg_alloc();
    hdr = nlmsg_put(msg, NL_AUTO_PORT, NL_AUTO_SEQ, XFRMA_SPD_IPV4_HTHRESH, sizeof(__u32), NLM_F_REQUEST);
    nla_put(msg, XFRMA_SPD_IPV4_HTHRESH, sizeof(thresh4), &thresh4);
    nla_put(msg, XFRMA_SPD_IPV6_HTHRESH, sizeof(thresh6), &thresh6);
    nla_send_auto(sk, msg);

    The numbers are the policy selector minimum prefix lengths to put a
    policy in the hash table.

    - lbits is the local threshold (source address for out policies,
    destination address for in and fwd policies).

    - rbits is the remote threshold (destination address for out
    policies, source address for in and fwd policies).

    The default values are:

    XFRMA_SPD_IPV4_HTHRESH: 32 32
    XFRMA_SPD_IPV6_HTHRESH: 128 128

    Dynamic re-building of the SPD is performed when the thresholds values
    are changed.

    The current thresholds can be read via a XFRM_MSG_GETSPDINFO request:
    the kernel replies to XFRM_MSG_GETSPDINFO requests by an
    XFRM_MSG_NEWSPDINFO message, with both attributes
    XFRMA_SPD_IPV4_HTHRESH and XFRMA_SPD_IPV6_HTHRESH.

    Signed-off-by: Christophe Gouault
    Signed-off-by: Steffen Klassert

    Christophe Gouault
     

30 Jun, 2014

1 commit

  • The SPI check introduced in ea9884b3acf3311c8a11db67bfab21773f6f82ba
    was intended for IPComp SAs but actually prevented AH SAs from getting
    installed (depending on the SPI).

    Fixes: ea9884b3acf3 ("xfrm: check user specified spi for IPComp")
    Cc: Fan Du
    Signed-off-by: Tobias Brunner
    Signed-off-by: Steffen Klassert

    Tobias Brunner
     

04 Jun, 2014

2 commits

  • Conflicts:
    include/net/inetpeer.h
    net/ipv6/output_core.c

    Changes in net were fixing bugs in code removed in net-next.

    Signed-off-by: David S. Miller

    David S. Miller
     
  • The xfrm_user module registers its pernet init/exit after xfrm
    itself so that its net exit function xfrm_user_net_exit() is
    executed before xfrm_net_exit() which calls xfrm_state_fini() to
    cleanup the SA's (xfrm states). This opens a window between
    zeroing net->xfrm.nlsk pointer and deleting all xfrm_state
    instances which may access it (via the timer). If an xfrm state
    expires in this window, xfrm_exp_state_notify() will pass null
    pointer as socket to nlmsg_multicast().

    As the notifications are called inside rcu_read_lock() block, it
    is sufficient to retrieve the nlsk socket with rcu_dereference()
    and check the it for null.

    Signed-off-by: Michal Kubecek
    Signed-off-by: David S. Miller

    Michal Kubecek
     

23 May, 2014

1 commit

  • Steffen Klassert says:

    ====================
    pull request (net-next): ipsec-next 2014-05-22

    This is the last ipsec pull request before I leave for
    a three weeks vacation tomorrow. David, can you please
    take urgent ipsec patches directly into net/net-next
    during this time?

    I'll continue to run the ipsec/ipsec-next trees as soon
    as I'm back.

    1) Simplify the xfrm audit handling, from Tetsuo Handa.

    2) Codingstyle cleanup for xfrm_output, from abian Frederick.

    Please pull or let me know if there are problems.
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     

25 Apr, 2014

1 commit

  • It is possible by passing a netlink socket to a more privileged
    executable and then to fool that executable into writing to the socket
    data that happens to be valid netlink message to do something that
    privileged executable did not intend to do.

    To keep this from happening replace bare capable and ns_capable calls
    with netlink_capable, netlink_net_calls and netlink_ns_capable calls.
    Which act the same as the previous calls except they verify that the
    opener of the socket had the desired permissions as well.

    Reported-by: Andy Lutomirski
    Signed-off-by: "Eric W. Biederman"
    Signed-off-by: David S. Miller

    Eric W. Biederman
     

23 Apr, 2014

1 commit

  • Commit f1370cc4 "xfrm: Remove useless secid field from xfrm_audit." changed
    "struct xfrm_audit" to have either
    { audit_get_loginuid(current) / audit_get_sessionid(current) } or
    { INVALID_UID / -1 } pair.

    This means that we can represent "struct xfrm_audit" as "bool".
    This patch replaces "struct xfrm_audit" argument with "bool".

    Signed-off-by: Tetsuo Handa
    Signed-off-by: Steffen Klassert

    Tetsuo Handa
     

22 Apr, 2014

1 commit

  • It seems to me that commit ab5f5e8b "[XFRM]: xfrm audit calls" is doing
    something strange at xfrm_audit_helper_usrinfo().
    If secid != 0 && security_secid_to_secctx(secid) != 0, the caller calls
    audit_log_task_context() which basically does
    secid != 0 && security_secid_to_secctx(secid) == 0 case
    except that secid is obtained from current thread's context.

    Oh, what happens if secid passed to xfrm_audit_helper_usrinfo() was
    obtained from other thread's context? It might audit current thread's
    context rather than other thread's context if security_secid_to_secctx()
    in xfrm_audit_helper_usrinfo() failed for some reason.

    Then, are all the caller of xfrm_audit_helper_usrinfo() passing either
    secid obtained from current thread's context or secid == 0?
    It seems to me that they are.

    If I didn't miss something, we don't need to pass secid to
    xfrm_audit_helper_usrinfo() because audit_log_task_context() will
    obtain secid from current thread's context.

    Signed-off-by: Tetsuo Handa
    Signed-off-by: Steffen Klassert

    Tetsuo Handa
     

26 Mar, 2014

1 commit