[Samba] vfs fruit disk_free fails on tmsize overflow with macOS Time Machine

Jeremy Allison jra at samba.org
Mon Feb 24 19:32:37 UTC 2020


On Mon, Feb 24, 2020 at 10:26:38AM +0000, Art MG via samba wrote:
> Thanks torch – I tried those suggestions but nothing changed. 
> 
> I did however manage to find an existing bug which matches my symptoms: https://bugzilla.samba.org/show_bug.cgi?id=13622
> 
> Fortunately it mentions a fix, but that was never implemented, so I created a new branch from v4-11-test on the gitlab shadow copy and tried the fix there. After compiling, my tests on Raspbian show that this does indeed fix the issue for me.
> 
> The diff for the patch is
> 
> --- source3/modules/vfs_fruit.c 2019-10-24 15:15:00.000000000 +0000
> +++ source3/modules/vfs_fruit.c 2020-02-18 19:54:00.000000000 +0000
> @@ -6971,18 +6971,7 @@
> return true;
> }
> 
> - if (bandsize > SIZE_MAX/nbands) {
> - DBG_ERR("tmsize overflow: bandsize [%zu] nbands [%zu]\n",
> - bandsize, nbands);
> - return false;
> - }
> - tm_size = bandsize * nbands;
> -
> - if (state->total_size + tm_size < state->total_size) {
> - DBG_ERR("tmsize overflow: bandsize [%zu] nbands [%zu]\n",
> - bandsize, nbands);
> - return false;
> - }
> + tm_size = (off_t)bandsize * (off_t)nbands;
> 
> state->total_size += tm_size;
> 
> 
> and I have the branch ready at https://gitlab.com/artmg/samba/-/blob/artmg-tmsize-overflow-fix/
> Should I just raise a PR from this, or do I need to go through some additional process?

Raise a PR from this at gitlab please.

Having said that, your fix looks like it's
removing a bunch of overflow safety checks,
so I'm not sure it's the right one.



More information about the samba mailing list