[LTP] fs/acl: Add ACL_USER_OBJ permission test

linuxtestproject.agent@gmail.com linuxtestproject.agent@gmail.com
Fri Jun 12 14:27:54 CEST 2026


Hi Sachin,

On Fri, 12 Jun 2026 15:54:55 +0530, Sachin Sant wrote:
> fs/acl: Add ACL_USER_OBJ permission test

--- [PATCH 1/8] ---

> +	SAFE_SETGROUPS(0, NULL);
> +
> +	if (setresgid(gid, gid, gid) < 0)
> +		tst_brk(TBROK | TERRNO, "setresgid(%u) failed",
> +			(unsigned int)gid);
> +
> +	if (setresuid(uid, uid, uid) < 0)
> +		tst_brk(TBROK | TERRNO, "setresuid(%u) failed",
> +			(unsigned int)uid);

SAFE_SETRESGID() and SAFE_SETRESUID() exist in
include/tst_safe_macros.h. Since SAFE_SETGROUPS() is already
used on the line above, could these be switched to the SAFE_
variants as well?

> +		if (exp_errno) {
> +			TST_EXP_FAIL(open(TESTFILE, O_CREAT | O_WRONLY, mode),
> +				     exp_errno, "open(%s)", TESTFILE);

open() returns a positive file descriptor on success, not 0.
TST_EXP_FAIL2 should be used here instead of TST_EXP_FAIL.

With TST_EXP_FAIL the PASS_COND is TST_RET == 0, so if open()
unexpectedly succeeds with e.g. fd 5, the macro falls through
to the "invalid retval" branch instead of reporting "succeeded".

Verdict: Needs revision

---
Note:

The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer


More information about the ltp mailing list