public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Mikhail Ivanov <ivanov.mikhail1@huawei-partners.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: Re: [RFC PATCH v2 3/8] landlock: Fix inconsistency of errors for TCP actions
Date: Sun, 20 Oct 2024 23:45:02 +0800	[thread overview]
Message-ID: <202410202353.RF5ZJUXV-lkp@intel.com> (raw)
In-Reply-To: <20241017110454.265818-4-ivanov.mikhail1@huawei-partners.com>

Hi Mikhail,

[This is a private test report for your RFC patch.]
kernel test robot noticed the following build warnings:

[auto build test WARNING on fe76bd133024aaef12d12a7d58fa3e8d138d3bf3]

url:    https://github.com/intel-lab-lkp/linux/commits/Mikhail-Ivanov/landlock-Fix-non-TCP-sockets-restriction/20241017-190842
base:   fe76bd133024aaef12d12a7d58fa3e8d138d3bf3
patch link:    https://lore.kernel.org/r/20241017110454.265818-4-ivanov.mikhail1%40huawei-partners.com
patch subject: [RFC PATCH v2 3/8] landlock: Fix inconsistency of errors for TCP actions
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20241020/202410202353.RF5ZJUXV-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241020/202410202353.RF5ZJUXV-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410202353.RF5ZJUXV-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> security/landlock/net.c:94:3: warning: label followed by a declaration is a C23 extension [-Wc23-extensions]
      94 |                 const struct sockaddr_in *const addr =
         |                 ^
   1 warning generated.


vim +94 security/landlock/net.c

    72	
    73	/*
    74	 * Checks that TCP @sock and @address attributes are correct for bind(2).
    75	 *
    76	 * On success, extracts port from @address in @port and returns 0.
    77	 *
    78	 * This validation is consistent with network stack and returns the error
    79	 * in the order corresponding to the order of errors from the network stack.
    80	 * It's required to not wrongfully return -EACCES instead of meaningful network
    81	 * stack level errors. Consistency is tested with kselftest.
    82	 *
    83	 * This helper does not provide consistency of error codes for BPF filter
    84	 * (if any).
    85	 */
    86	static int
    87	check_tcp_bind_consistency_and_get_port(struct socket *const sock,
    88						struct sockaddr *const address,
    89						const int addrlen, __be16 *port)
    90	{
    91		/* IPV6_ADDRFORM can change sk->sk_family under us. */
    92		switch (READ_ONCE(sock->sk->sk_family)) {
    93		case AF_INET:
  > 94			const struct sockaddr_in *const addr =
    95				(struct sockaddr_in *)address;
    96	
    97			/* Cf. inet_bind_sk(). */
    98			if (addrlen < sizeof(struct sockaddr_in))
    99				return -EINVAL;
   100			/*
   101			 * For compatibility reason, accept AF_UNSPEC for bind
   102			 * accesses (mapped to AF_INET) only if the address is
   103			 * INADDR_ANY (cf. __inet_bind).
   104			 */
   105			if (addr->sin_family != AF_INET) {
   106				if (addr->sin_family != AF_UNSPEC ||
   107				    addr->sin_addr.s_addr != htonl(INADDR_ANY))
   108					return -EAFNOSUPPORT;
   109			}
   110			*port = ((struct sockaddr_in *)address)->sin_port;
   111			break;
   112	#if IS_ENABLED(CONFIG_IPV6)
   113		case AF_INET6:
   114			/* Cf. inet6_bind_sk(). */
   115			if (addrlen < SIN6_LEN_RFC2133)
   116				return -EINVAL;
   117			/* Cf. __inet6_bind(). */
   118			if (address->sa_family != AF_INET6)
   119				return -EAFNOSUPPORT;
   120			*port = ((struct sockaddr_in6 *)address)->sin6_port;
   121			break;
   122	#endif /* IS_ENABLED(CONFIG_IPV6) */
   123		default:
   124			WARN_ON_ONCE(0);
   125			return -EACCES;
   126		}
   127		return 0;
   128	}
   129	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

           reply	other threads:[~2024-10-20 15:45 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20241017110454.265818-4-ivanov.mikhail1@huawei-partners.com>]

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=202410202353.RF5ZJUXV-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=ivanov.mikhail1@huawei-partners.com \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox