[PATCH v2 4/9] setpriv: dump no-new-privs info
Patrick Steinhardt
ps at pks.im
Mon Jul 3 06:22:44 UTC 2017
Hi Tito,
On Sun, Jul 02, 2017 at 05:07:53PM +0200, Tito wrote:
> Hi,
> just a few hints (untested).
thanks for your hints, will queue fixes locally and send out v3
soon-ish.
Regards
Patrick
> Ciao,
> Tito
>
> On 07/02/2017 03:42 PM, Patrick Steinhardt wrote:
> > Introduce the ability to dump the state of the no-new-privs flag, which
> > states whethere it is allowed to grant new privileges.
> > ---
> > util-linux/setpriv.c | 11 ++++++++++-
> > 1 file changed, 10 insertions(+), 1 deletion(-)
> >
> > diff --git a/util-linux/setpriv.c b/util-linux/setpriv.c
> > index dabc6d355..740b51610 100644
> > --- a/util-linux/setpriv.c
> > +++ b/util-linux/setpriv.c
> > @@ -63,6 +63,10 @@
> > #define PR_SET_NO_NEW_PRIVS 38
> > #endif
> >
> > +#ifndef PR_GET_NO_NEW_PRIVS
> > +#define PR_GET_NO_NEW_PRIVS 39
> > +#endif
> > +
> > enum {
> > IF_FEATURE_SETPRIV_DUMP(OPTBIT_DUMP,)
> > OPTBIT_NNP,
> > @@ -77,7 +81,7 @@ static int dump(void)
> > uid_t ruid, euid, suid;
> > gid_t rgid, egid, sgid;
> > gid_t *gids;
> > - int ngids;
> > + int ngids, nnp;
> >
> > if (getresuid(&ruid, &euid, &suid) < 0)
> > bb_simple_perror_msg_and_die("getresgid");
> > @@ -91,6 +95,9 @@ static int dump(void)
> > if ((ngids = getgroups(ngids, gids)) < 0)
> > bb_simple_perror_msg_and_die("getgroups");
> >
> > + if ((nnp = prctl(PR_GET_NO_NEW_PRIVS, 0, 0, 0, 0)) < 0)
> > + bb_simple_perror_msg_and_die("prctl: GET_NO_NEW_PRIVS");
> > +
> > printf("uid: %d\n", ruid);
> > printf("euid: %d\n", euid);
> > printf("gid: %d\n", rgid);
> > @@ -109,6 +116,8 @@ static int dump(void)
> > }
>
> just one line ?
> printf("\nno_new_privs: %d\n", nnp);
>
> > putchar('\n');
> >
> > + printf("no_new_privs: %d\n", nnp);
> > +
> > free(gids);
> > return 0;
> > }
> >
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20170703/f3ac7b6a/attachment-0001.asc>
More information about the busybox
mailing list