lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 26 Sep 2018 22:24:42 +0200
From:   Johannes Berg <johannes@...solutions.net>
To:     linux-wireless@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH] netlink: add policy attribute range validation

Another thing to note:

Given the union of validation_data pointer and min/max, we'll always get
into this:

> +	/* validate range */
> +	if (pt->min || pt->max) {

if validation_data is set, but of course end up taking the default case,
where nothing further happens:

> +		default:
> +			/* no further validation */
> +			validate = false;
> +			break;
> +		}
> +
> +		if (validate && (value < pt->min || value > pt->max)) {
> +			NL_SET_ERR_MSG_ATTR(extack, nla,
> +					    "integer out of range");
> +			return -ERANGE;
> +		}
> +	}
> +
>  	return 0;

I'm not *entirely* happy with this, but I haven't been able to come up
with a way that doesn't do this, doesn't duplicate the nla types list
(NLA_{U,S}{8,16,32,64}) in the code, and also loads the attribute value
only if validation is needed.

johannes

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ