aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/prog_tests/autoload.c
blob: 3693f7d133eb0082fe3c72e2c43dfc40b4be5fb5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2020 Facebook */

#include <test_progs.h>
#include <time.h>
#include "test_autoload.skel.h"

void test_autoload(void)
{
	int duration = 0, err;
	struct test_autoload* skel;

	skel = test_autoload__open_and_load();
	/* prog3 should be broken */
	if (CHECK(skel, "skel_open_and_load", "unexpected success\n"))
		goto cleanup;

	skel = test_autoload__open();
	if (CHECK(!skel, "skel_open", "failed to open skeleton\n"))
		goto cleanup;

	/* don't load prog3 */
	bpf_program__set_autoload(skel->progs.prog3, false);

	err = test_autoload__load(skel);
	if (CHECK(err, "skel_load", "failed to load skeleton: %d\n", err))
		goto cleanup;

	err = test_autoload__attach(skel);
	if (CHECK(err, "skel_attach", "skeleton attach failed: %d\n", err))
		goto cleanup;

	usleep(1);

	CHECK(!skel->bss->prog1_called, "prog1", "not called\n");
	CHECK(!skel->bss->prog2_called, "prog2", "not called\n");
	CHECK(skel->bss->prog3_called, "prog3", "called?!\n");

cleanup:
	test_autoload__destroy(skel);
}
se memmove() instead of strcpy()Matthew Wilcox1-1/+1 strcpy is undefined if src and dest overlap. That's clearly possible here with a sufficiently deep path on the server. Use memmove instead. Signed-off-by: Matthew Wilcox <matthew@wil.cx> Signed-off-by: David S. Miller <davem@davemloft.net> 2005-02-06[ATM]: [zatm] replace sleep_on() with wait_event()Chas Williams1-18/+9 Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com> Signed-off-by: Chas Williams <chas@cmf.nrl.navy.mil> Signed-off-by: David S. Miller <davem@davemloft.net> 2005-02-06[ATM]: [iphase] remove sleep_on*() usageChas Williams1-14/+12 Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com> Signed-off-by: Chas Williams <chas@cmf.nrl.navy.mil> Signed-off-by: David S. Miller <davem@davemloft.net> 2005-02-06[ATM]: [horizon] replace interruptible_sleep_on() with ↵Chas Williams1-7/+6 wait_event_interruptible() Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com> Signed-off-by: Chas Williams <chas@cmf.nrl.navy.mil> Signed-off-by: David S. Miller <davem@davemloft.net> 2005-02-06[CRYPTO]: Make some code static in i386 crypto AES.Adrian Bunk1-3/+3 This patch makes some needlessly global code static. Signed-off-by: Adrian Bunk <bunk@stusta.de> Signed-off-by: James Morris <jmorris@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net> 2005-02-06[NETLINK]: Use SKB_MAXORDER to calculate NLMSG_GOODSIZEThomas Graf1-3/+2 NLMSG_GOODSIZE specifies a good default size for the skb tailroom used in netlink messages when the size is unknown at the time of the allocation. The current value doesn't make much sense anymore because skb_shared_info isn't taken into account which means that depending on the architecture NLMSG_GOOSIZE can exceed PAGE_SIZE resulting in a waste of almost a complete page. Using SKB_MAXORDER solves this potential leak at the cost of slightly smaller but safer sizes for some architectures. Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net> 2005-02-06[NETFILTER]: Clean NAT status bits on module unloadPatrick McHardy1-0/+1 another patch which I think should go in 2.6.11, it fixes a crash when unloading, then reloading iptable_nat. ip_nat_core doesn't clear the status bits in struct ip_conntrack on module unload, but zeroes out the nat area. When the module is loaded again and a connection times out ip_nat_cleanup_conntrack tries to list_del the zeroed list-head and crashes. There are probably more conditions under which it can crash or cause other misbehaviour. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net> 2005-02-06[PKT_SCHED]: netem: memory leakStephen Hemminger1-0/+1 Good catch.. netem needs to free skb's that are dropped due to loss simulation. Signed-off-by: David S. Miller <davem@davemloft.net> 2005-02-06[IPV6]: Fix tunnel list locking in ip6_tunnel.cHideaki Yoshifuji1-2/+2 We need to fix tunnel list locking in ip6_tunnel.c as well. Noticed by jean-mickael guerin <jean-mickael.guerin@6WIND.com>. Signed-off-by: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net> 2005-02-06[PKT_SCHED]: ipt action: add back pskb_expand_head() callPatrick McHardy1-0/+5 Jamal asked me to add back the call to pskb_expand_head before 2.6.11. This fixes a regression caused by my tc action cleanup patches, the tc actions most not replace packets, so it must prevent netfilter from doing so. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net> 2005-02-06[DOC]: Some atomic_ops.txt updates.David S. Miller1-2/+111 Based upon feedback from Linus: - Touch on xchg(), cmpxchg() and spinlocks lightly. - Discuss atomic_dec_and_test() - Add some historical platform notes. Signed-off-by: David S. Miller <davem@davemloft.net> 2005-02-06[SPARC64]: Correct rwlock membars.David S. Miller2-1/+4 read_unlock should order all previous memory operations before the atomic counter update to drop the lock. The debugging version of write_unlock had a similar error. Signed-off-by: David S. Miller <davem@davemloft.net> 2005-02-06[SPARC64]: Add missing membars for xchg() and cmpxchg().David S. Miller1-2/+6 Signed-off-by: David S. Miller <davem@davemloft.net> 2005-02-06[ARM] Re-order lubbock includesRussell King1-1/+2 Include asm/hardware/*.h before asm/arch/*.h Signed-off-by: Russell King <rmk@arm.linux.org.uk> 2005-02-06[ARM PATCH] 2458/1: prevent PXA2xx defines from clashing with SA1111'sNicolas Pitre1-38/+31 Patch from Nicolas Pitre A more elegant solution could be applied which would require more work. However there is only one platform using both chips (Lubbock) and half of the SA1111 features are unusable due to botched DMA support at the PCB level anyway. Therefore this solution should be sufficient for now. Also removed the SADIV defines which use would not constitute good programming practice. Divisors should be computed directly in the code especially since different PXA2xx versions have different clock source frequencies. No in-tree driver uses them so this is low impact.. Finally changed alignment to fit rest of file. Signed-off-by: Nicolas Pitre Signed-off-by: Russell King 2005-02-06[ide] remove unused pkt_task_t definition from ide.hTejun Heo1-14/+0 Signed-off-by: Tejun Heo <tj@home-tj.org> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> 2005-02-06[ide serverworks] merge serverworks.h into serverworks.cTejun Heo2-68/+50 Signed-off-by: Tejun Heo <tj@home-tj.org> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> 2005-02-06[ide serverworks] remove unused SVWKS_DEBUG_DRIVE_INFOTejun Heo1-2/+0 Signed-off-by: Tejun Heo <tj@home-tj.org> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> 2005-02-06[ide piix] merge piix.h into piix.cTejun Heo2-59/+46 Signed-off-by: Tejun Heo <tj@home-tj.org> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> 2005-02-06[ide piix] remove useless commentBartlomiej Zolnierkiewicz1-5/+0 Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> 2005-02-06[ide pdc202xx_old] merge pdc202xx_old.h into pdc202xx_old.cTejun Heo2-142/+124 Signed-off-by: Tejun Heo <tj@home-tj.org> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> 2005-02-06[ide pdc202xx_old] remove SPLIT_BYTE() macroTejun Heo2-5/+2 Signed-off-by: Tejun Heo <tj@home-tj.org> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> 2005-02-06[ide pdc202xx_new] merge pdc202xx_new.h into pdc202xx_new.cTejun Heo2-120/+104 Signed-off-by: Tejun Heo <tj@home-tj.org> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> 2005-02-06[ide opti621] merge opti621.h into opti621.cTejun Heo2-30/+18 Signed-off-by: Tejun Heo <tj@home-tj.org> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> 2005-02-06[ide it8172] merge it8172.h into it8172.cTejun Heo2-33/+12 Signed-off-by: Tejun Heo <tj@home-tj.org> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> 2005-02-06[ide hpt366] merge hpt366.h into hpt366.cTejun Heo2-466/+434 bart: while at it do whitespace cleanup and add missing FIXME Signed-off-by: Tejun Heo <tj@home-tj.org> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> 2005-02-06[ide hpt366] remove dead fifty_base_hpt374[] tableBartlomiej Zolnierkiewicz1-20/+2 Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> 2005-02-06[ide pci generic] merge generic.h into generic.cTejun Heo2-95/+83 Signed-off-by: Tejun Heo <tj@home-tj.org> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> 2005-02-06[ide pci generic] remove dummy init_chipset_generic()Bartlomiej Zolnierkiewicz2-19/+0 ->init_chipset is optional Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> 2005-02-06[ide pci generic] remove dead unknown_chipset[] table from generic.hBartlomiej Zolnierkiewicz1-13/+0 Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> 2005-02-06[ide cy82c693] merge cy82c693.h into cy82c693.cTejun Heo2-84/+70 bart: do small whitespace cleanup while at it Signed-off-by: Tejun Heo <tj@home-tj.org> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> 2005-02-06[ide cmd64x] merge cmd64x.h into cmd64x.cTejun Heo2-96/+83 Signed-off-by: Tejun Heo <tj@home-tj.org> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> 2005-02-06[ide aec62xx] merge aec62xx.h into aec62xx.cTejun Heo2-116/+100 bart: s/byte/u8/ Signed-off-by: Tejun Heo <tj@home-tj.org> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> 2005-02-06[ide aec62xx] remove SPLIT_BYTE() and MAKE_WORD() macrosTejun Heo2-9/+1 bart: leave BUSCLOCK() alone for now Signed-off-by: Tejun Heo <tj@home-tj.org> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> 2005-02-06[ide] fix ide_dump_atapi_status()Alexander Viro1-1/+2 From: Al Viro <viro@parcelfarce.linux.theplanet.co.uk> On Fri, 4 Feb 2005, Al Viro wrote: > BTW, ide-lib.c code that triggers the ICE happens to be completely broken. > Jens, it's your patch from September 2002 - what used to be > if ((stat & (BUSY_STAT|ERR_STAT)) == ERR_STAT) { > became > if ((status.all & (status.b.bsy|status.b.check)) == status.b.check) { > and that's *not* an equivalent transformation. Fixing it doesn't get rid > of ICE, but it certainly deserves fixing. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> 2005-02-06[ide] fix hwif_init() to not return error for "empty" interfacesJean Delvare1-1/+2 Return success if no device is connected to the interface. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> 2005-02-05[libata ahci] Add support for ULi M5288Jeff Garzik1-0/+2 Contributed by Peer Chen @ ULi 2005-02-05[PATCH] libata: fix ata_piix on ICH6R in RAID modeMartins Krikis1-1/+2 Here is the cleaned up patch (as you suggested) that enables ata_piix to work in RAID mode on ICH6R. I tested it and it seems to behave correctly in all the modes---sees all 4 disks in IDE and RAID modes, doesn't see any in Compatibility mode (which is right, because only two are available and the regular IDE driver has picked them up already). Change description: only test for PCI IDE legacy mode, via the PCI programming interface register, if the PCI device is of class PCI_CLASS_STORAGE_IDE. Signed-off-by: Martins Krikis <mkrikis@yahoo.com> Signed-off-by: Jeff Garzik <jgarzik@pobox.com> 2005-02-05[libata sata_promise] add PCI ID for new SATAII TX2 cardJarno Paananen1-0/+2 2005-02-05[libata sata_sil] add another Seagate drive to blacklistDaniel E. Markle1-0/+1 2005-02-05[libata] fix probe object allocation bugsPete Zaitcev2-44/+47 The code previously alloced a 2-entry array, then freed each entry individually, for users of "combined mode". Convert code to use allocation function that only allocates one object at a time. Also, un-export ata_pci_init_legacy_mode(), as its only user is libata-core. 2005-02-05[libata scsi] verify cmd bug fixes/supportBrett Russ2-11/+18 Also, trim trailing whitespace. 2005-02-05[SPARC64]: Kill spurious semicolons in some system.h macrosDavid S. Miller1-6/+6 Signed-off-by: David S. Miller <davem@davemloft.net> 2005-02-05[NET]: Add barriers for dst refcnt.Herbert Xu2-0/+3 In light of the recent discussion about sk_buff, I think we need the following patch for dst_entry. This adds a memory barrier before dst_release drops the refcnt, and a read memory barrier before dst_destroy starts destroying the entry. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net> 2005-02-05[NET]: Add missing memory barrier to kfree_skb().Herbert Xu1-9/+5 Also kill kfree_skb_fast(), that is a relic from fast switching which was killed off years ago. The bug is that in the case where we do the atomic_read() optimization, we need to make sure that reads of skb state later in __kfree_skb() processing (particularly the skb->list BUG check) are not reordered to occur before the counter read by the cpu. Thanks to Olaf Kirch and Anton Blanchard for discovering and helping fix this bug. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>