Re: [PATCH] fuse: require /dev/fuse reads to have enough buffer capacity (take 2)

From: Sander Eikelenboom
Date: Wed Jun 12 2019 - 09:05:16 EST


On 12/06/2019 13:25, Kirill Smelkov wrote:
> On Wed, Jun 12, 2019 at 09:44:49AM +0200, Miklos Szeredi wrote:
>> On Tue, Jun 11, 2019 at 10:28 PM Kirill Smelkov <kirr@xxxxxxxxxx> wrote:
>>
>>> Miklos, would 4K -> `sizeof(fuse_in_header) + sizeof(fuse_write_in)` for
>>> header room change be accepted?
>>
>> Yes, next cycle. For 4.2 I'll just push the revert.
>
> Thanks Miklos. Please consider queuing the following patch for 5.3.
> Sander, could you please confirm that glusterfs is not broken with this
> version of the check?
>
> Thanks beforehand,
> Kirill


Hmm unfortunately it doesn't build, see below.

--
Sander


In file included from ./include/linux/list.h:9:0,
from ./include/linux/wait.h:7,
from ./include/linux/wait_bit.h:8,
from ./include/linux/fs.h:6,
from fs/fuse/fuse_i.h:17,
from fs/fuse/dev.c:9:
fs/fuse/dev.c: In function âfuse_dev_do_readâ:
fs/fuse/dev.c:1336:14: error: âfuse_in_headerâ undeclared (first use in this function)
sizeof(fuse_in_header) + sizeof(fuse_write_in) + fc->max_write))
^
./include/linux/kernel.h:818:40: note: in definition of macro â__typecheckâ
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
^
./include/linux/kernel.h:842:24: note: in expansion of macro â__safe_cmpâ
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~
./include/linux/kernel.h:918:27: note: in expansion of macro â__careful_cmpâ
#define max_t(type, x, y) __careful_cmp((type)(x), (type)(y), >)
^~~~~~~~~~~~~
fs/fuse/dev.c:1335:15: note: in expansion of macro âmax_tâ
if (nbytes < max_t(size_t, FUSE_MIN_READ_BUFFER,
^~~~~
fs/fuse/dev.c:1336:14: note: each undeclared identifier is reported only once for each function it appears in
sizeof(fuse_in_header) + sizeof(fuse_write_in) + fc->max_write))
^
./include/linux/kernel.h:818:40: note: in definition of macro â__typecheckâ
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
^
./include/linux/kernel.h:842:24: note: in expansion of macro â__safe_cmpâ
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~
./include/linux/kernel.h:918:27: note: in expansion of macro â__careful_cmpâ
#define max_t(type, x, y) __careful_cmp((type)(x), (type)(y), >)
^~~~~~~~~~~~~
fs/fuse/dev.c:1335:15: note: in expansion of macro âmax_tâ
if (nbytes < max_t(size_t, FUSE_MIN_READ_BUFFER,
^~~~~
fs/fuse/dev.c:1336:39: error: âfuse_write_inâ undeclared (first use in this function)
sizeof(fuse_in_header) + sizeof(fuse_write_in) + fc->max_write))
^
./include/linux/kernel.h:818:40: note: in definition of macro â__typecheckâ
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
^
./include/linux/kernel.h:842:24: note: in expansion of macro â__safe_cmpâ
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~
./include/linux/kernel.h:918:27: note: in expansion of macro â__careful_cmpâ
#define max_t(type, x, y) __careful_cmp((type)(x), (type)(y), >)
^~~~~~~~~~~~~
fs/fuse/dev.c:1335:15: note: in expansion of macro âmax_tâ
if (nbytes < max_t(size_t, FUSE_MIN_READ_BUFFER,
^~~~~
./include/linux/kernel.h:842:2: error: first argument to â__builtin_choose_exprâ not a constant
__builtin_choose_expr(__safe_cmp(x, y), \
^
./include/linux/kernel.h:918:27: note: in expansion of macro â__careful_cmpâ
#define max_t(type, x, y) __careful_cmp((type)(x), (type)(y), >)
^~~~~~~~~~~~~
fs/fuse/dev.c:1335:15: note: in expansion of macro âmax_tâ
if (nbytes < max_t(size_t, FUSE_MIN_READ_BUFFER,
^~~~~
scripts/Makefile.build:278: recipe for target 'fs/fuse/dev.o' failed
make[3]: *** [fs/fuse/dev.o] Error 1
scripts/Makefile.build:489: recipe for target 'fs/fuse' failed
make[2]: *** [fs/fuse] Error 2