From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH v19 07/12] landlock: Support filesystem access-control
Date: Wed, 08 Jul 2020 04:40:55 +0800 [thread overview]
Message-ID: <202007080427.dVWPaIKW%lkp@intel.com> (raw)
In-Reply-To: <20200707180955.53024-8-mic@digikod.net>
[-- Attachment #1: Type: text/plain, Size: 6000 bytes --]
Hi "Mickaël,
I love your patch! Perhaps something to improve:
[auto build test WARNING on kselftest/next]
[also build test WARNING on pcmoore-selinux/next linus/master v5.8-rc4 next-20200707]
[cannot apply to security/next-testing]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Micka-l-Sala-n/Landlock-LSM/20200708-022251
base: https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git next
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=ia64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
In file included from include/linux/bits.h:23,
from include/linux/bitops.h:5,
from include/linux/kernel.h:12,
from include/linux/list.h:9,
from include/linux/dcache.h:6,
from security/landlock/fs.c:11:
security/landlock/fs.c: In function 'check_access_path':
include/linux/bits.h:26:28: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
26 | __builtin_constant_p((l) > (h)), (l) > (h), 0)))
| ^
include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
| ^
include/linux/bits.h:45:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
45 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l))
| ^~~~~~~~~~~~~~~~~~~
>> security/landlock/fs.c:216:15: note: in expansion of macro 'GENMASK_ULL'
216 | layer_mask = GENMASK_ULL(domain->nb_layers - 1, 0);
| ^~~~~~~~~~~
include/linux/bits.h:26:40: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
26 | __builtin_constant_p((l) > (h)), (l) > (h), 0)))
| ^
include/linux/build_bug.h:16:62: note: in definition of macro 'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
| ^
include/linux/bits.h:45:3: note: in expansion of macro 'GENMASK_INPUT_CHECK'
45 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l))
| ^~~~~~~~~~~~~~~~~~~
>> security/landlock/fs.c:216:15: note: in expansion of macro 'GENMASK_ULL'
216 | layer_mask = GENMASK_ULL(domain->nb_layers - 1, 0);
| ^~~~~~~~~~~
vim +/GENMASK_ULL +216 security/landlock/fs.c
194
195 static int check_access_path(const struct landlock_ruleset *const domain,
196 const struct path *const path, u32 access_request)
197 {
198 bool allow = false;
199 struct path walker_path;
200 u64 layer_mask;
201
202 if (WARN_ON_ONCE(!domain || !path))
203 return 0;
204 /*
205 * Allows access to pseudo filesystems that will never be mountable
206 * (e.g. sockfs, pipefs), but can still be reachable through
207 * /proc/self/fd .
208 */
209 if ((path->dentry->d_sb->s_flags & SB_NOUSER) ||
210 (d_is_positive(path->dentry) &&
211 unlikely(IS_PRIVATE(d_backing_inode(path->dentry)))))
212 return 0;
213 if (WARN_ON_ONCE(domain->nb_layers < 1))
214 return -EACCES;
215
> 216 layer_mask = GENMASK_ULL(domain->nb_layers - 1, 0);
217 /*
218 * An access request which is not handled by the domain should be
219 * allowed.
220 */
221 access_request &= domain->fs_access_mask;
222 if (access_request == 0)
223 return 0;
224 walker_path = *path;
225 path_get(&walker_path);
226 /*
227 * We need to walk through all the hierarchy to not miss any relevant
228 * restriction.
229 */
230 while (check_access_path_continue(domain, &walker_path, access_request,
231 &allow, &layer_mask)) {
232 struct dentry *parent_dentry;
233
234 jump_up:
235 /*
236 * Does not work with orphaned/private mounts like overlayfs
237 * layers for now (cf. ovl_path_real() and ovl_path_open()).
238 */
239 if (walker_path.dentry == walker_path.mnt->mnt_root) {
240 if (follow_up(&walker_path)) {
241 /* Ignores hidden mount points. */
242 goto jump_up;
243 } else {
244 /*
245 * Stops at the real root. Denies access
246 * because not all layers have granted access.
247 */
248 allow = false;
249 break;
250 }
251 }
252 if (unlikely(IS_ROOT(walker_path.dentry))) {
253 /*
254 * Stops at disconnected root directories. Only allows
255 * access to internal filesystems (e.g. nsfs which is
256 * reachable through /proc/self/ns).
257 */
258 allow = !!(walker_path.mnt->mnt_flags & MNT_INTERNAL);
259 break;
260 }
261 parent_dentry = dget_parent(walker_path.dentry);
262 dput(walker_path.dentry);
263 walker_path.dentry = parent_dentry;
264 }
265 path_put(&walker_path);
266 return allow ? 0 : -EACCES;
267 }
268
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 61135 bytes --]
next prev parent reply other threads:[~2020-07-07 20:40 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-07 18:09 [PATCH v19 00/12] Landlock LSM Mickaël Salaün
2020-07-07 18:09 ` Mickaël Salaün
2020-07-07 18:09 ` [PATCH v19 01/12] landlock: Add object management Mickaël Salaün
2020-07-07 18:09 ` Mickaël Salaün
2020-07-07 18:09 ` [PATCH v19 02/12] landlock: Add ruleset and domain management Mickaël Salaün
2020-07-07 18:09 ` Mickaël Salaün
2020-07-07 18:09 ` [PATCH v19 03/12] landlock: Set up the security framework and manage credentials Mickaël Salaün
2020-07-07 18:09 ` Mickaël Salaün
2020-07-07 18:09 ` [PATCH v19 04/12] landlock: Add ptrace restrictions Mickaël Salaün
2020-07-07 18:09 ` Mickaël Salaün
2020-07-07 18:09 ` [PATCH v19 05/12] LSM: Infrastructure management of the superblock Mickaël Salaün
2020-07-07 18:09 ` Mickaël Salaün
2020-07-07 18:09 ` [PATCH v19 06/12] fs,security: Add sb_delete hook Mickaël Salaün
2020-07-07 18:09 ` Mickaël Salaün
2020-07-07 18:09 ` [PATCH v19 07/12] landlock: Support filesystem access-control Mickaël Salaün
2020-07-07 18:09 ` Mickaël Salaün
2020-07-07 20:11 ` Randy Dunlap
2020-07-07 20:11 ` Randy Dunlap
2020-07-08 7:03 ` Mickaël Salaün
2020-07-08 7:03 ` Mickaël Salaün
2020-07-07 20:40 ` kernel test robot [this message]
2020-07-07 18:09 ` [PATCH v19 08/12] landlock: Add syscall implementation Mickaël Salaün
2020-07-07 18:09 ` Mickaël Salaün
2020-07-08 8:57 ` Arnd Bergmann
2020-07-08 8:57 ` Arnd Bergmann
2020-07-08 13:04 ` Mickaël Salaün
2020-07-08 13:04 ` Mickaël Salaün
2020-07-08 13:49 ` Arnd Bergmann
2020-07-08 13:49 ` Arnd Bergmann
2020-07-08 17:50 ` Mickaël Salaün
2020-07-08 17:50 ` Mickaël Salaün
2020-07-09 17:26 ` Arnd Bergmann
2020-07-09 17:26 ` Arnd Bergmann
2020-07-09 17:47 ` Christian Brauner
2020-07-09 17:47 ` Christian Brauner
2020-07-10 12:57 ` Mickaël Salaün
2020-07-10 12:57 ` Mickaël Salaün
2020-07-07 18:09 ` [PATCH v19 09/12] arch: Wire up landlock() syscall Mickaël Salaün
2020-07-07 18:09 ` Mickaël Salaün
2020-07-08 7:22 ` Arnd Bergmann
2020-07-08 7:22 ` Arnd Bergmann
2020-07-08 7:31 ` Mickaël Salaün
2020-07-08 7:31 ` Mickaël Salaün
2020-07-08 7:47 ` Arnd Bergmann
2020-07-08 7:47 ` Arnd Bergmann
2020-07-08 8:23 ` Mickaël Salaün
2020-07-08 8:23 ` Mickaël Salaün
2020-07-08 8:58 ` Arnd Bergmann
2020-07-08 8:58 ` Arnd Bergmann
2020-07-07 18:09 ` [PATCH v19 10/12] selftests/landlock: Add initial tests Mickaël Salaün
2020-07-07 18:09 ` Mickaël Salaün
2020-07-07 18:09 ` [PATCH v19 11/12] samples/landlock: Add a sandbox manager example Mickaël Salaün
2020-07-07 18:09 ` Mickaël Salaün
2020-07-07 18:09 ` [PATCH v19 12/12] landlock: Add user and kernel documentation Mickaël Salaün
2020-07-07 18:09 ` Mickaël Salaün
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=202007080427.dVWPaIKW%lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild-all@lists.01.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.